diff --git a/.gitignore b/.gitignore index 11cfefed5f2..a05a65c95c1 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,5 @@ tests/*.d.ts *.config scripts/debug.bat scripts/run.bat +scripts/word2md.js coverage/ diff --git a/Jakefile b/Jakefile index 79907e8a63a..da91239d7a5 100644 --- a/Jakefile +++ b/Jakefile @@ -2,6 +2,7 @@ var fs = require("fs"); var path = require("path"); +var child_process = require("child_process"); // Variables var compilerDirectory = "src/compiler/"; @@ -9,6 +10,7 @@ var servicesDirectory = "src/services/"; var harnessDirectory = "src/harness/"; var libraryDirectory = "src/lib/"; var scriptsDirectory = "scripts/"; +var docDirectory = "doc/"; var builtDirectory = "built/"; var builtLocalDirectory = "built/local/"; @@ -54,6 +56,10 @@ var servicesSources = [ }).concat([ "services.ts", "shims.ts", + "signatureHelp.ts", + "utilities.ts", + "navigationBar.ts", + "outliningElementsCollector.ts" ].map(function (f) { return path.join(servicesDirectory, f); })); @@ -63,7 +69,6 @@ var harnessSources = [ "sourceMapRecorder.ts", "harnessLanguageService.ts", "fourslash.ts", - "external/json2.ts", "runnerbase.ts", "compilerRunner.ts", "typeWriter.ts", @@ -123,6 +128,7 @@ function concatenateFiles(destinationFile, sourceFiles) { } var useDebugMode = false; +var generateDeclarations = false; var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node"); var compilerFilename = "tsc.js"; /* Compiles a file from a list of sources @@ -137,6 +143,9 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu file(outFile, prereqs, function() { var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory; var options = "-removeComments --module commonjs -noImplicitAny "; //" -propagateEnumConstants " + if (generateDeclarations) { + options += "--declaration "; + } var cmd = host + " " + dir + compilerFilename + " " + options + " "; if (useDebugMode) { @@ -245,7 +254,7 @@ task("local", ["generate-diagnostics", "lib", tscFile, servicesFile]); // Local target to build the compiler and services desc("Emit debug mode files with sourcemaps"); task("debug", function() { - useDebugMode = true; + useDebugMode = true; }); @@ -259,6 +268,44 @@ task("clean", function() { jake.rmRf(builtDirectory); }); +// generate declarations for compiler and services +desc("Generate declarations for compiler and services"); +task("declaration", function() { + generateDeclarations = true; +}); + +// Generate Markdown spec +var word2mdJs = path.join(scriptsDirectory, "word2md.js"); +var word2mdTs = path.join(scriptsDirectory, "word2md.ts"); +var specWord = path.join(docDirectory, "TypeScript Language Specification.docx"); +var specMd = path.join(docDirectory, "spec.md"); +var headerMd = path.join(docDirectory, "header.md"); + +file(word2mdTs); + +// word2md script +compileFile(word2mdJs, + [word2mdTs], + [word2mdTs], + [], + false); + +// The generated spec.md; built for the 'generate-spec' task +file(specMd, [word2mdJs, specWord], function () { + jake.cpR(headerMd, specMd, {silent: true}); + var specWordFullPath = path.resolve(specWord); + var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" >>' + specMd; + console.log(cmd); + child_process.exec(cmd, function () { + complete(); + }); +}, {async: true}) + + +desc("Generates a Markdown version of the Language Specification"); +task("generate-spec", [specMd]) + + // Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory desc("Makes a new LKG out of the built js files"); task("LKG", libraryTargets, function() { @@ -318,7 +365,7 @@ function exec(cmd, completeHandler) { complete(); }) try{ - ex.run(); + ex.run(); } catch(e) { console.log('Exception: ' + e) } @@ -342,7 +389,7 @@ function cleanTestDirs() { function writeTestConfigFile(tests, testConfigFile) { console.log('Running test(s): ' + tests); var testConfigContents = '{\n' + '\ttest: [\'' + tests + '\']\n}'; - fs.writeFileSync('test.config', testConfigContents); + fs.writeFileSync('test.config', testConfigContents); } function deleteTemporaryProjectOutput() { @@ -385,7 +432,7 @@ desc("Generates code coverage data via instanbul") task("generate-code-coverage", ["tests", builtLocalDirectory], function () { var cmd = 'istanbul cover node_modules/mocha/bin/_mocha -- -R min -t ' + testTimeout + ' ' + run; console.log(cmd); - exec(cmd); + exec(cmd); }, { async: true }); // Browser tests diff --git a/README.md b/README.md index c87c8ce5ee9..f7e55d2dffe 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript) +[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/pr)](http://issuestats.com/github/microsoft/typescript) +[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/issue)](http://issuestats.com/github/microsoft/typescript) + # TypeScript [TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [twitter account](https://twitter.com/typescriptlang). @@ -18,7 +22,7 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob * [Quick tutorial](http://www.typescriptlang.org/Tutorial) * [Programming handbook](http://www.typescriptlang.org/Handbook) -* [Language specification](http://go.microsoft.com/fwlink/?LinkId=267238) +* [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md) * [Homepage](http://www.typescriptlang.org/) ## Building @@ -47,16 +51,18 @@ npm install Use one of the following to build and test: ``` -jake local # Build the compiler into built/local -jake clean # Delete the built compiler -jake LKG # Replace the last known good with the built one. - # Bootstrapping step to be executed when the built compiler reaches a stable state. -jake tests # Build the test infrastructure using the built compiler. -jake runtests # Run tests using the built compiler and test infrastructure. - # You can override the host or specify a test for this command. - # Use host= or tests=. -jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests. -jake -T # List the above commands. +jake local # Build the compiler into built/local +jake clean # Delete the built compiler +jake LKG # Replace the last known good with the built one. + # Bootstrapping step to be executed when the built compiler reaches a stable state. +jake tests # Build the test infrastructure using the built compiler. +jake runtests # Run tests using the built compiler and test infrastructure. + # You can override the host or specify a test for this command. + # Use host= or tests=. +jake runtests-browser # Runs the tests using the built run.js file. Syntax is jake runtests. Optional + parameters 'host=', 'tests=[regex], reporter=[list|spec|json|]'. +jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests. +jake -T # List the above commands. ``` diff --git a/ThirdPartyNoticeText.txt b/ThirdPartyNoticeText.txt index 93c3e4fcb3f..6fbb7e4a0ce 100644 --- a/ThirdPartyNoticeText.txt +++ b/ThirdPartyNoticeText.txt @@ -19,67 +19,6 @@ limitations under the License. --------------------------------------------- Third Party Code Components -------------------------------------------- ----- Mozilla Developer Code--------- -The following Mozilla Developer Code is under Public Domain as updated after Aug. 20, 2012, see, https://developer.mozilla.org/en-US/docs/Project:Copyrights -1. Array filter Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter -Any copyright is dedicated to the Public Domain. - -2. Array forEach Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach -Any copyright is dedicated to the Public Domain. - -3. Array indexOf Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf -Any copyright is dedicated to the Public Domain. - -4. Array map Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map -Any copyright is dedicated to the Public Domain. - -5. Array Reduce Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce -Any copyright is dedicated to the Public Domain. - -6. String Trim Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim -Any copyright is dedicated to the Public Domain. - -7. Date now Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now -Any copyright is dedicated to the Public Domain. - -------------JSON2 Script------------------------ -json2.js 2012-10-08 -Public Domain. -NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. -See, http://www.JSON.org/js.html - ---------------r.js---------------------- -Copyright (c) 2010-2011 Dojo Foundation. All Rights Reserved. -Originally License under MIT License -------------------------------------------------------------------------- -Provided for Informational Purposes Only -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------- DefinitelyTyped -------------------- This file is based on or incorporates material from the projects listed below (collectively ?Third Party Code?). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise. diff --git a/bin/lib.d.ts b/bin/lib.d.ts index ebf92241aff..8fb56ba3129 100644 --- a/bin/lib.d.ts +++ b/bin/lib.d.ts @@ -1182,14 +1182,14 @@ interface Int8Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int8Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1240,14 +1240,14 @@ interface Uint8Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint8Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1298,14 +1298,14 @@ interface Int16Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int16Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1356,14 +1356,14 @@ interface Uint16Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint16Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1414,14 +1414,14 @@ interface Int32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1472,14 +1472,14 @@ interface Uint32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1530,14 +1530,14 @@ interface Float32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Float32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -1588,14 +1588,14 @@ interface Float64Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Float64Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; diff --git a/bin/lib.dom.d.ts b/bin/lib.dom.d.ts index 0fe2922830a..26d30d3a027 100644 --- a/bin/lib.dom.d.ts +++ b/bin/lib.dom.d.ts @@ -79,14 +79,14 @@ interface Int8Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int8Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -137,14 +137,14 @@ interface Uint8Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint8Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -195,14 +195,14 @@ interface Int16Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int16Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -253,14 +253,14 @@ interface Uint16Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint16Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -311,14 +311,14 @@ interface Int32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -369,14 +369,14 @@ interface Uint32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -427,14 +427,14 @@ interface Float32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Float32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -485,14 +485,14 @@ interface Float64Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Float64Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; diff --git a/bin/lib.webworker.d.ts b/bin/lib.webworker.d.ts index 02485d2602a..8675d267aa4 100644 --- a/bin/lib.webworker.d.ts +++ b/bin/lib.webworker.d.ts @@ -79,14 +79,14 @@ interface Int8Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int8Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -137,14 +137,14 @@ interface Uint8Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint8Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -195,14 +195,14 @@ interface Int16Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int16Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -253,14 +253,14 @@ interface Uint16Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint16Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -311,14 +311,14 @@ interface Int32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -369,14 +369,14 @@ interface Uint32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -427,14 +427,14 @@ interface Float32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Float32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -485,14 +485,14 @@ interface Float64Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Float64Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; diff --git a/bin/tsc.js b/bin/tsc.js index af5f939a80d..07cccb86d1b 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -98,6 +98,7 @@ var ts; An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1 /* Error */, key: "An object literal cannot have property and accessor with the same name." }, An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1 /* Error */, key: "An export assignment cannot have modifiers." }, Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1 /* Error */, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1 /* Error */, key: "A tuple type element list cannot be empty." }, Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1 /* Error */, key: "Variable declaration list cannot be empty." }, Digit_expected: { code: 1124, category: 1 /* Error */, key: "Digit expected." }, Hexadecimal_digit_expected: { code: 1125, category: 1 /* Error */, key: "Hexadecimal digit expected." }, @@ -151,9 +152,9 @@ var ts; Type_0_is_not_assignable_to_type_1_Colon: { code: 2322, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}':" }, Type_0_is_not_assignable_to_type_1: { code: 2323, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}'." }, Property_0_is_missing_in_type_1: { code: 2324, category: 1 /* Error */, key: "Property '{0}' is missing in type '{1}'." }, - Private_property_0_cannot_be_reimplemented: { code: 2325, category: 1 /* Error */, key: "Private property '{0}' cannot be reimplemented." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1 /* Error */, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, Types_of_property_0_are_incompatible_Colon: { code: 2326, category: 1 /* Error */, key: "Types of property '{0}' are incompatible:" }, - Required_property_0_cannot_be_reimplemented_with_optional_property_in_1: { code: 2327, category: 1 /* Error */, key: "Required property '{0}' cannot be reimplemented with optional property in '{1}'." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1 /* Error */, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, Types_of_parameters_0_and_1_are_incompatible_Colon: { code: 2328, category: 1 /* Error */, key: "Types of parameters '{0}' and '{1}' are incompatible:" }, Index_signature_is_missing_in_type_0: { code: 2329, category: 1 /* Error */, key: "Index signature is missing in type '{0}'." }, Index_signatures_are_incompatible_Colon: { code: 2330, category: 1 /* Error */, key: "Index signatures are incompatible:" }, @@ -166,8 +167,8 @@ var ts; Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1 /* Error */, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1 /* Error */, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, Property_0_does_not_exist_on_type_1: { code: 2339, category: 1 /* Error */, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_inaccessible: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is inaccessible." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1 /* Error */, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, Type_0_does_not_satisfy_the_constraint_1_Colon: { code: 2343, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}':" }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}'." }, @@ -211,7 +212,7 @@ var ts; Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1 /* Error */, key: "Specialized overload signature is not assignable to any non-specialized signature." }, Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1 /* Error */, key: "Overload signatures must all be exported or not exported." }, Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1 /* Error */, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_or_private: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public or private." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public, private or protected." }, Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1 /* Error */, key: "Overload signatures must all be optional or required." }, Function_overload_must_be_static: { code: 2387, category: 1 /* Error */, key: "Function overload must be static." }, Function_overload_must_not_be_static: { code: 2388, category: 1 /* Error */, key: "Function overload must not be static." }, @@ -268,6 +269,11 @@ var ts; Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1 /* Error */, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1 /* Error */, key: "Import declaration conflicts with local declaration of '{0}'" }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1 /* Error */, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1 /* Error */, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1 /* Error */, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1 /* Error */, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* Error */, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, @@ -404,117 +410,121 @@ var ts; Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1 /* Error */, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1 /* Error */, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." } }; })(ts || (ts = {})); var ts; (function (ts) { var textToToken = { - "any": 101 /* AnyKeyword */, - "boolean": 102 /* BooleanKeyword */, - "break": 56 /* BreakKeyword */, - "case": 57 /* CaseKeyword */, - "catch": 58 /* CatchKeyword */, - "class": 59 /* ClassKeyword */, - "continue": 61 /* ContinueKeyword */, - "const": 60 /* ConstKeyword */, - "constructor": 103 /* ConstructorKeyword */, - "debugger": 62 /* DebuggerKeyword */, - "declare": 104 /* DeclareKeyword */, - "default": 63 /* DefaultKeyword */, - "delete": 64 /* DeleteKeyword */, - "do": 65 /* DoKeyword */, - "else": 66 /* ElseKeyword */, - "enum": 67 /* EnumKeyword */, - "export": 68 /* ExportKeyword */, - "extends": 69 /* ExtendsKeyword */, - "false": 70 /* FalseKeyword */, - "finally": 71 /* FinallyKeyword */, - "for": 72 /* ForKeyword */, - "function": 73 /* FunctionKeyword */, - "get": 105 /* GetKeyword */, - "if": 74 /* IfKeyword */, - "implements": 92 /* ImplementsKeyword */, - "import": 75 /* ImportKeyword */, - "in": 76 /* InKeyword */, - "instanceof": 77 /* InstanceOfKeyword */, - "interface": 93 /* InterfaceKeyword */, - "let": 94 /* LetKeyword */, - "module": 106 /* ModuleKeyword */, - "new": 78 /* NewKeyword */, - "null": 79 /* NullKeyword */, - "number": 108 /* NumberKeyword */, - "package": 95 /* PackageKeyword */, - "private": 96 /* PrivateKeyword */, - "protected": 97 /* ProtectedKeyword */, - "public": 98 /* PublicKeyword */, - "require": 107 /* RequireKeyword */, - "return": 80 /* ReturnKeyword */, - "set": 109 /* SetKeyword */, - "static": 99 /* StaticKeyword */, - "string": 110 /* StringKeyword */, - "super": 81 /* SuperKeyword */, - "switch": 82 /* SwitchKeyword */, - "this": 83 /* ThisKeyword */, - "throw": 84 /* ThrowKeyword */, - "true": 85 /* TrueKeyword */, - "try": 86 /* TryKeyword */, - "typeof": 87 /* TypeOfKeyword */, - "var": 88 /* VarKeyword */, - "void": 89 /* VoidKeyword */, - "while": 90 /* WhileKeyword */, - "with": 91 /* WithKeyword */, - "yield": 100 /* YieldKeyword */, - "{": 5 /* OpenBraceToken */, - "}": 6 /* CloseBraceToken */, - "(": 7 /* OpenParenToken */, - ")": 8 /* CloseParenToken */, - "[": 9 /* OpenBracketToken */, - "]": 10 /* CloseBracketToken */, - ".": 11 /* DotToken */, - "...": 12 /* DotDotDotToken */, - ";": 13 /* SemicolonToken */, - ",": 14 /* CommaToken */, - "<": 15 /* LessThanToken */, - ">": 16 /* GreaterThanToken */, - "<=": 17 /* LessThanEqualsToken */, - ">=": 18 /* GreaterThanEqualsToken */, - "==": 19 /* EqualsEqualsToken */, - "!=": 20 /* ExclamationEqualsToken */, - "===": 21 /* EqualsEqualsEqualsToken */, - "!==": 22 /* ExclamationEqualsEqualsToken */, - "=>": 23 /* EqualsGreaterThanToken */, - "+": 24 /* PlusToken */, - "-": 25 /* MinusToken */, - "*": 26 /* AsteriskToken */, - "/": 27 /* SlashToken */, - "%": 28 /* PercentToken */, - "++": 29 /* PlusPlusToken */, - "--": 30 /* MinusMinusToken */, - "<<": 31 /* LessThanLessThanToken */, - ">>": 32 /* GreaterThanGreaterThanToken */, - ">>>": 33 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 34 /* AmpersandToken */, - "|": 35 /* BarToken */, - "^": 36 /* CaretToken */, - "!": 37 /* ExclamationToken */, - "~": 38 /* TildeToken */, - "&&": 39 /* AmpersandAmpersandToken */, - "||": 40 /* BarBarToken */, - "?": 41 /* QuestionToken */, - ":": 42 /* ColonToken */, - "=": 43 /* EqualsToken */, - "+=": 44 /* PlusEqualsToken */, - "-=": 45 /* MinusEqualsToken */, - "*=": 46 /* AsteriskEqualsToken */, - "/=": 47 /* SlashEqualsToken */, - "%=": 48 /* PercentEqualsToken */, - "<<=": 49 /* LessThanLessThanEqualsToken */, - ">>=": 50 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 51 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 52 /* AmpersandEqualsToken */, - "|=": 53 /* BarEqualsToken */, - "^=": 54 /* CaretEqualsToken */ + "any": 105 /* AnyKeyword */, + "boolean": 106 /* BooleanKeyword */, + "break": 60 /* BreakKeyword */, + "case": 61 /* CaseKeyword */, + "catch": 62 /* CatchKeyword */, + "class": 63 /* ClassKeyword */, + "continue": 65 /* ContinueKeyword */, + "const": 64 /* ConstKeyword */, + "constructor": 107 /* ConstructorKeyword */, + "debugger": 66 /* DebuggerKeyword */, + "declare": 108 /* DeclareKeyword */, + "default": 67 /* DefaultKeyword */, + "delete": 68 /* DeleteKeyword */, + "do": 69 /* DoKeyword */, + "else": 70 /* ElseKeyword */, + "enum": 71 /* EnumKeyword */, + "export": 72 /* ExportKeyword */, + "extends": 73 /* ExtendsKeyword */, + "false": 74 /* FalseKeyword */, + "finally": 75 /* FinallyKeyword */, + "for": 76 /* ForKeyword */, + "function": 77 /* FunctionKeyword */, + "get": 109 /* GetKeyword */, + "if": 78 /* IfKeyword */, + "implements": 96 /* ImplementsKeyword */, + "import": 79 /* ImportKeyword */, + "in": 80 /* InKeyword */, + "instanceof": 81 /* InstanceOfKeyword */, + "interface": 97 /* InterfaceKeyword */, + "let": 98 /* LetKeyword */, + "module": 110 /* ModuleKeyword */, + "new": 82 /* NewKeyword */, + "null": 83 /* NullKeyword */, + "number": 112 /* NumberKeyword */, + "package": 99 /* PackageKeyword */, + "private": 100 /* PrivateKeyword */, + "protected": 101 /* ProtectedKeyword */, + "public": 102 /* PublicKeyword */, + "require": 111 /* RequireKeyword */, + "return": 84 /* ReturnKeyword */, + "set": 113 /* SetKeyword */, + "static": 103 /* StaticKeyword */, + "string": 114 /* StringKeyword */, + "super": 85 /* SuperKeyword */, + "switch": 86 /* SwitchKeyword */, + "this": 87 /* ThisKeyword */, + "throw": 88 /* ThrowKeyword */, + "true": 89 /* TrueKeyword */, + "try": 90 /* TryKeyword */, + "typeof": 91 /* TypeOfKeyword */, + "var": 92 /* VarKeyword */, + "void": 93 /* VoidKeyword */, + "while": 94 /* WhileKeyword */, + "with": 95 /* WithKeyword */, + "yield": 104 /* YieldKeyword */, + "{": 9 /* OpenBraceToken */, + "}": 10 /* CloseBraceToken */, + "(": 11 /* OpenParenToken */, + ")": 12 /* CloseParenToken */, + "[": 13 /* OpenBracketToken */, + "]": 14 /* CloseBracketToken */, + ".": 15 /* DotToken */, + "...": 16 /* DotDotDotToken */, + ";": 17 /* SemicolonToken */, + ",": 18 /* CommaToken */, + "<": 19 /* LessThanToken */, + ">": 20 /* GreaterThanToken */, + "<=": 21 /* LessThanEqualsToken */, + ">=": 22 /* GreaterThanEqualsToken */, + "==": 23 /* EqualsEqualsToken */, + "!=": 24 /* ExclamationEqualsToken */, + "===": 25 /* EqualsEqualsEqualsToken */, + "!==": 26 /* ExclamationEqualsEqualsToken */, + "=>": 27 /* EqualsGreaterThanToken */, + "+": 28 /* PlusToken */, + "-": 29 /* MinusToken */, + "*": 30 /* AsteriskToken */, + "/": 31 /* SlashToken */, + "%": 32 /* PercentToken */, + "++": 33 /* PlusPlusToken */, + "--": 34 /* MinusMinusToken */, + "<<": 35 /* LessThanLessThanToken */, + ">>": 36 /* GreaterThanGreaterThanToken */, + ">>>": 37 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 38 /* AmpersandToken */, + "|": 39 /* BarToken */, + "^": 40 /* CaretToken */, + "!": 41 /* ExclamationToken */, + "~": 42 /* TildeToken */, + "&&": 43 /* AmpersandAmpersandToken */, + "||": 44 /* BarBarToken */, + "?": 45 /* QuestionToken */, + ":": 46 /* ColonToken */, + "=": 47 /* EqualsToken */, + "+=": 48 /* PlusEqualsToken */, + "-=": 49 /* MinusEqualsToken */, + "*=": 50 /* AsteriskEqualsToken */, + "/=": 51 /* SlashEqualsToken */, + "%=": 52 /* PercentEqualsToken */, + "<<=": 53 /* LessThanLessThanEqualsToken */, + ">>=": 54 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 56 /* AmpersandEqualsToken */, + "|=": 57 /* BarEqualsToken */, + "^=": 58 /* CaretEqualsToken */ }; var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; @@ -764,7 +774,7 @@ var ts; return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; - function createScanner(languageVersion, text, onError, onComment) { + function createScanner(languageVersion, skipTrivia, text, onError, onComment) { var pos; var len; var startPos; @@ -969,7 +979,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 55 /* Identifier */; + return token = 59 /* Identifier */; } function scan() { startPos = pos; @@ -984,73 +994,94 @@ var ts; case 10 /* lineFeed */: case 13 /* carriageReturn */: precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; + } + else { + if (ch === 13 /* carriageReturn */ && pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos += 2; + } + else { + pos++; + } + return token = 4 /* NewLineTrivia */; + } case 9 /* tab */: case 11 /* verticalTab */: case 12 /* formFeed */: case 32 /* space */: - pos++; - continue; + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { + pos++; + } + return token = 5 /* WhitespaceTrivia */; + } case 33 /* exclamation */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 22 /* ExclamationEqualsEqualsToken */; + return pos += 3, token = 26 /* ExclamationEqualsEqualsToken */; } - return pos += 2, token = 20 /* ExclamationEqualsToken */; + return pos += 2, token = 24 /* ExclamationEqualsToken */; } - return pos++, token = 37 /* ExclamationToken */; + return pos++, token = 41 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); - return token = 3 /* StringLiteral */; + return token = 7 /* StringLiteral */; case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 48 /* PercentEqualsToken */; + return pos += 2, token = 52 /* PercentEqualsToken */; } - return pos++, token = 28 /* PercentToken */; + return pos++, token = 32 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 39 /* AmpersandAmpersandToken */; + return pos += 2, token = 43 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 52 /* AmpersandEqualsToken */; + return pos += 2, token = 56 /* AmpersandEqualsToken */; } - return pos++, token = 34 /* AmpersandToken */; + return pos++, token = 38 /* AmpersandToken */; case 40 /* openParen */: - return pos++, token = 7 /* OpenParenToken */; + return pos++, token = 11 /* OpenParenToken */; case 41 /* closeParen */: - return pos++, token = 8 /* CloseParenToken */; + return pos++, token = 12 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 46 /* AsteriskEqualsToken */; + return pos += 2, token = 50 /* AsteriskEqualsToken */; } - return pos++, token = 26 /* AsteriskToken */; + return pos++, token = 30 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 29 /* PlusPlusToken */; + return pos += 2, token = 33 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 44 /* PlusEqualsToken */; + return pos += 2, token = 48 /* PlusEqualsToken */; } - return pos++, token = 24 /* PlusToken */; + return pos++, token = 28 /* PlusToken */; case 44 /* comma */: - return pos++, token = 14 /* CommaToken */; + return pos++, token = 18 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 30 /* MinusMinusToken */; + return pos += 2, token = 34 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 45 /* MinusEqualsToken */; + return pos += 2, token = 49 /* MinusEqualsToken */; } - return pos++, token = 25 /* MinusToken */; + return pos++, token = 29 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanNumber(); - return token = 2 /* NumericLiteral */; + return token = 6 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 12 /* DotDotDotToken */; + return pos += 3, token = 16 /* DotDotDotToken */; } - return pos++, token = 11 /* DotToken */; + return pos++, token = 15 /* DotToken */; case 47 /* slash */: if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; @@ -1063,7 +1094,12 @@ var ts; if (onComment) { onComment(tokenPos, pos); } - continue; + if (skipTrivia) { + continue; + } + else { + return token = 2 /* SingleLineCommentTrivia */; + } } if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { pos += 2; @@ -1086,12 +1122,17 @@ var ts; if (onComment) { onComment(tokenPos, pos); } - continue; + if (skipTrivia) { + continue; + } + else { + return token = 3 /* MultiLineCommentTrivia */; + } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 47 /* SlashEqualsToken */; + return pos += 2, token = 51 /* SlashEqualsToken */; } - return pos++, token = 27 /* SlashToken */; + return pos++, token = 31 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -1101,11 +1142,11 @@ var ts; value = 0; } tokenValue = "" + value; - return 2 /* NumericLiteral */; + return 6 /* NumericLiteral */; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); - return 2 /* NumericLiteral */; + return 6 /* NumericLiteral */; } case 49 /* _1 */: case 50 /* _2 */: @@ -1117,60 +1158,60 @@ var ts; case 56 /* _8 */: case 57 /* _9 */: tokenValue = "" + scanNumber(); - return token = 2 /* NumericLiteral */; + return token = 6 /* NumericLiteral */; case 58 /* colon */: - return pos++, token = 42 /* ColonToken */; + return pos++, token = 46 /* ColonToken */; case 59 /* semicolon */: - return pos++, token = 13 /* SemicolonToken */; + return pos++, token = 17 /* SemicolonToken */; case 60 /* lessThan */: if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 49 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 53 /* LessThanLessThanEqualsToken */; } - return pos += 2, token = 31 /* LessThanLessThanToken */; + return pos += 2, token = 35 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 17 /* LessThanEqualsToken */; + return pos += 2, token = 21 /* LessThanEqualsToken */; } - return pos++, token = 15 /* LessThanToken */; + return pos++, token = 19 /* LessThanToken */; case 61 /* equals */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 21 /* EqualsEqualsEqualsToken */; + return pos += 3, token = 25 /* EqualsEqualsEqualsToken */; } - return pos += 2, token = 19 /* EqualsEqualsToken */; + return pos += 2, token = 23 /* EqualsEqualsToken */; } if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 23 /* EqualsGreaterThanToken */; + return pos += 2, token = 27 /* EqualsGreaterThanToken */; } - return pos++, token = 43 /* EqualsToken */; + return pos++, token = 47 /* EqualsToken */; case 62 /* greaterThan */: - return pos++, token = 16 /* GreaterThanToken */; + return pos++, token = 20 /* GreaterThanToken */; case 63 /* question */: - return pos++, token = 41 /* QuestionToken */; + return pos++, token = 45 /* QuestionToken */; case 91 /* openBracket */: - return pos++, token = 9 /* OpenBracketToken */; + return pos++, token = 13 /* OpenBracketToken */; case 93 /* closeBracket */: - return pos++, token = 10 /* CloseBracketToken */; + return pos++, token = 14 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 54 /* CaretEqualsToken */; + return pos += 2, token = 58 /* CaretEqualsToken */; } - return pos++, token = 36 /* CaretToken */; + return pos++, token = 40 /* CaretToken */; case 123 /* openBrace */: - return pos++, token = 5 /* OpenBraceToken */; + return pos++, token = 9 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 40 /* BarBarToken */; + return pos += 2, token = 44 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 53 /* BarEqualsToken */; + return pos += 2, token = 57 /* BarEqualsToken */; } - return pos++, token = 35 /* BarToken */; + return pos++, token = 39 /* BarToken */; case 125 /* closeBrace */: - return pos++, token = 6 /* CloseBraceToken */; + return pos++, token = 10 /* CloseBraceToken */; case 126 /* tilde */: - return pos++, token = 38 /* TildeToken */; + return pos++, token = 42 /* TildeToken */; case 92 /* backslash */: var ch = peekUnicodeEscape(); if (ch >= 0 && isIdentifierStart(ch)) { @@ -1206,27 +1247,27 @@ var ts; } } function reScanGreaterToken() { - if (token === 16 /* GreaterThanToken */) { + if (token === 20 /* GreaterThanToken */) { if (text.charCodeAt(pos) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 51 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } - return pos += 2, token = 33 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 37 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 50 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 54 /* GreaterThanGreaterThanEqualsToken */; } - return pos++, token = 32 /* GreaterThanGreaterThanToken */; + return pos++, token = 36 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 18 /* GreaterThanEqualsToken */; + return pos++, token = 22 /* GreaterThanEqualsToken */; } } return token; } function reScanSlashToken() { - if (token === 27 /* SlashToken */ || token === 47 /* SlashEqualsToken */) { + if (token === 31 /* SlashToken */ || token === 51 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -1261,7 +1302,7 @@ var ts; } pos = p; tokenValue = text.substring(tokenPos, pos); - token = 4 /* RegularExpressionLiteral */; + token = 8 /* RegularExpressionLiteral */; } return token; } @@ -1304,7 +1345,7 @@ var ts; getTokenText: function () { return text.substring(tokenPos, pos); }, getTokenValue: function () { return tokenValue; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 55 /* Identifier */ || token > ts.SyntaxKind.LastReservedWord; }, + isIdentifier: function () { return token === 59 /* Identifier */ || token > ts.SyntaxKind.LastReservedWord; }, isReservedWord: function () { return token >= ts.SyntaxKind.FirstReservedWord && token <= ts.SyntaxKind.LastReservedWord; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -1321,185 +1362,190 @@ var ts; (function (SyntaxKind) { SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown"; SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken"; - SyntaxKind[SyntaxKind["NumericLiteral"] = 2] = "NumericLiteral"; - SyntaxKind[SyntaxKind["StringLiteral"] = 3] = "StringLiteral"; - SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 4] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["OpenBraceToken"] = 5] = "OpenBraceToken"; - SyntaxKind[SyntaxKind["CloseBraceToken"] = 6] = "CloseBraceToken"; - SyntaxKind[SyntaxKind["OpenParenToken"] = 7] = "OpenParenToken"; - SyntaxKind[SyntaxKind["CloseParenToken"] = 8] = "CloseParenToken"; - SyntaxKind[SyntaxKind["OpenBracketToken"] = 9] = "OpenBracketToken"; - SyntaxKind[SyntaxKind["CloseBracketToken"] = 10] = "CloseBracketToken"; - SyntaxKind[SyntaxKind["DotToken"] = 11] = "DotToken"; - SyntaxKind[SyntaxKind["DotDotDotToken"] = 12] = "DotDotDotToken"; - SyntaxKind[SyntaxKind["SemicolonToken"] = 13] = "SemicolonToken"; - SyntaxKind[SyntaxKind["CommaToken"] = 14] = "CommaToken"; - SyntaxKind[SyntaxKind["LessThanToken"] = 15] = "LessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 16] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 17] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 18] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 19] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 20] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 21] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 22] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 23] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 24] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 25] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 26] = "AsteriskToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 27] = "SlashToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 28] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 29] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 30] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 31] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 32] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 33] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 34] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 35] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 36] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 37] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 38] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 39] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 40] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 41] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 42] = "ColonToken"; - SyntaxKind[SyntaxKind["EqualsToken"] = 43] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 44] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 45] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 46] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 47] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 48] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 49] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 50] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 51] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 52] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 53] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 54] = "CaretEqualsToken"; - SyntaxKind[SyntaxKind["Identifier"] = 55] = "Identifier"; - SyntaxKind[SyntaxKind["BreakKeyword"] = 56] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 57] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 58] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 59] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 60] = "ConstKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 61] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 62] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 63] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 64] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 65] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 66] = "ElseKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 67] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 68] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 69] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 70] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 71] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 72] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 73] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 74] = "IfKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 75] = "ImportKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 76] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 77] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 78] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 79] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 80] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 81] = "SuperKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 82] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 83] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 84] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 85] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 86] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 87] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 88] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 89] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 90] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 91] = "WithKeyword"; - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 92] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 93] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 94] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 95] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 96] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 97] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 98] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 99] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 100] = "YieldKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 101] = "AnyKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 102] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 103] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 104] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 105] = "GetKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 106] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 107] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 108] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 109] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 110] = "StringKeyword"; - SyntaxKind[SyntaxKind["Missing"] = 111] = "Missing"; - SyntaxKind[SyntaxKind["QualifiedName"] = 112] = "QualifiedName"; - SyntaxKind[SyntaxKind["TypeParameter"] = 113] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 114] = "Parameter"; - SyntaxKind[SyntaxKind["Property"] = 115] = "Property"; - SyntaxKind[SyntaxKind["Method"] = 116] = "Method"; - SyntaxKind[SyntaxKind["Constructor"] = 117] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 118] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 119] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 120] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 121] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 122] = "IndexSignature"; - SyntaxKind[SyntaxKind["TypeReference"] = 123] = "TypeReference"; - SyntaxKind[SyntaxKind["TypeQuery"] = 124] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 125] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 126] = "ArrayType"; - SyntaxKind[SyntaxKind["ArrayLiteral"] = 127] = "ArrayLiteral"; - SyntaxKind[SyntaxKind["ObjectLiteral"] = 128] = "ObjectLiteral"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 129] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["PropertyAccess"] = 130] = "PropertyAccess"; - SyntaxKind[SyntaxKind["IndexedAccess"] = 131] = "IndexedAccess"; - SyntaxKind[SyntaxKind["CallExpression"] = 132] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 133] = "NewExpression"; - SyntaxKind[SyntaxKind["TypeAssertion"] = 134] = "TypeAssertion"; - SyntaxKind[SyntaxKind["ParenExpression"] = 135] = "ParenExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 136] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 137] = "ArrowFunction"; - SyntaxKind[SyntaxKind["PrefixOperator"] = 138] = "PrefixOperator"; - SyntaxKind[SyntaxKind["PostfixOperator"] = 139] = "PostfixOperator"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 140] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 141] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 142] = "OmittedExpression"; - SyntaxKind[SyntaxKind["Block"] = 143] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 144] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 145] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 146] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 147] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 148] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 149] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 150] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 151] = "ForInStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 152] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 153] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 154] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 155] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 156] = "SwitchStatement"; - SyntaxKind[SyntaxKind["CaseClause"] = 157] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 158] = "DefaultClause"; - SyntaxKind[SyntaxKind["LabelledStatement"] = 159] = "LabelledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 160] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 161] = "TryStatement"; - SyntaxKind[SyntaxKind["TryBlock"] = 162] = "TryBlock"; - SyntaxKind[SyntaxKind["CatchBlock"] = 163] = "CatchBlock"; - SyntaxKind[SyntaxKind["FinallyBlock"] = 164] = "FinallyBlock"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 165] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 166] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 167] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["FunctionBlock"] = 168] = "FunctionBlock"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 169] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 170] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 171] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 172] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 173] = "ModuleBlock"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 174] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 175] = "ExportAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 176] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 177] = "SourceFile"; - SyntaxKind[SyntaxKind["Program"] = 178] = "Program"; - SyntaxKind[SyntaxKind["SyntaxList"] = 179] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 180] = "Count"; + SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia"; + SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia"; + SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia"; + SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; + SyntaxKind[SyntaxKind["NumericLiteral"] = 6] = "NumericLiteral"; + SyntaxKind[SyntaxKind["StringLiteral"] = 7] = "StringLiteral"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 8] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 9] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 10] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 11] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 12] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 13] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 14] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 15] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 16] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 17] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 18] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 19] = "LessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 20] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 21] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 22] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 23] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 24] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 25] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 26] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 27] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 28] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 29] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 30] = "AsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 31] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 32] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 33] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 34] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 35] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 36] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 37] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 38] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 39] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 40] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 41] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 42] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 43] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 44] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 45] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 46] = "ColonToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 47] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 48] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 49] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 50] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 51] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 52] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 53] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 54] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 55] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 56] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 57] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 58] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["Identifier"] = 59] = "Identifier"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 60] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 61] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 62] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 63] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 64] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 65] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 66] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 67] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 68] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 69] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 70] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 71] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 72] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 73] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 74] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 75] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 76] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 77] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 78] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 79] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 80] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 81] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 82] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 83] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 84] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 85] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 86] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 87] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 88] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 89] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 90] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 91] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 92] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 93] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 94] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 95] = "WithKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 96] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 97] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 98] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 99] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 100] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 101] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 102] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 103] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 104] = "YieldKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 105] = "AnyKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 106] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 107] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 108] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 109] = "GetKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 110] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 111] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 112] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 113] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 114] = "StringKeyword"; + SyntaxKind[SyntaxKind["Missing"] = 115] = "Missing"; + SyntaxKind[SyntaxKind["QualifiedName"] = 116] = "QualifiedName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 117] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 118] = "Parameter"; + SyntaxKind[SyntaxKind["Property"] = 119] = "Property"; + SyntaxKind[SyntaxKind["Method"] = 120] = "Method"; + SyntaxKind[SyntaxKind["Constructor"] = 121] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 122] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 123] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 124] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 125] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 126] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypeReference"] = 127] = "TypeReference"; + SyntaxKind[SyntaxKind["TypeQuery"] = 128] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 129] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 130] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 131] = "TupleType"; + SyntaxKind[SyntaxKind["ArrayLiteral"] = 132] = "ArrayLiteral"; + SyntaxKind[SyntaxKind["ObjectLiteral"] = 133] = "ObjectLiteral"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 134] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAccess"] = 135] = "PropertyAccess"; + SyntaxKind[SyntaxKind["IndexedAccess"] = 136] = "IndexedAccess"; + SyntaxKind[SyntaxKind["CallExpression"] = 137] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 138] = "NewExpression"; + SyntaxKind[SyntaxKind["TypeAssertion"] = 139] = "TypeAssertion"; + SyntaxKind[SyntaxKind["ParenExpression"] = 140] = "ParenExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 141] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 142] = "ArrowFunction"; + SyntaxKind[SyntaxKind["PrefixOperator"] = 143] = "PrefixOperator"; + SyntaxKind[SyntaxKind["PostfixOperator"] = 144] = "PostfixOperator"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 145] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 146] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 147] = "OmittedExpression"; + SyntaxKind[SyntaxKind["Block"] = 148] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 149] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 150] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 151] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 152] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 153] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 154] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 155] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 156] = "ForInStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 157] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 158] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 159] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 160] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 161] = "SwitchStatement"; + SyntaxKind[SyntaxKind["CaseClause"] = 162] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 163] = "DefaultClause"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 164] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 165] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 166] = "TryStatement"; + SyntaxKind[SyntaxKind["TryBlock"] = 167] = "TryBlock"; + SyntaxKind[SyntaxKind["CatchBlock"] = 168] = "CatchBlock"; + SyntaxKind[SyntaxKind["FinallyBlock"] = 169] = "FinallyBlock"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 170] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 171] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 172] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["FunctionBlock"] = 173] = "FunctionBlock"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 174] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 175] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 176] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 177] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 178] = "ModuleBlock"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 179] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 180] = "ExportAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 181] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 182] = "SourceFile"; + SyntaxKind[SyntaxKind["Program"] = 183] = "Program"; + SyntaxKind[SyntaxKind["SyntaxList"] = 184] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 185] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = SyntaxKind.EqualsToken] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = SyntaxKind.CaretEqualsToken] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = SyntaxKind.BreakKeyword] = "FirstReservedWord"; @@ -1509,9 +1555,11 @@ var ts; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = SyntaxKind.ImplementsKeyword] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = SyntaxKind.YieldKeyword] = "LastFutureReservedWord"; SyntaxKind[SyntaxKind["FirstTypeNode"] = SyntaxKind.TypeReference] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = SyntaxKind.ArrayType] = "LastTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = SyntaxKind.TupleType] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = SyntaxKind.OpenBraceToken] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = SyntaxKind.CaretEqualsToken] = "LastPunctuation"; + SyntaxKind[SyntaxKind["FirstToken"] = SyntaxKind.EndOfFileToken] = "FirstToken"; + SyntaxKind[SyntaxKind["LastToken"] = SyntaxKind.StringKeyword] = "LastToken"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -1521,13 +1569,24 @@ var ts; NodeFlags[NodeFlags["Rest"] = 0x00000008] = "Rest"; NodeFlags[NodeFlags["Public"] = 0x00000010] = "Public"; NodeFlags[NodeFlags["Private"] = 0x00000020] = "Private"; - NodeFlags[NodeFlags["Static"] = 0x00000040] = "Static"; - NodeFlags[NodeFlags["MultiLine"] = 0x00000080] = "MultiLine"; - NodeFlags[NodeFlags["Synthetic"] = 0x00000100] = "Synthetic"; - NodeFlags[NodeFlags["DeclarationFile"] = 0x00000200] = "DeclarationFile"; - NodeFlags[NodeFlags["Modifier"] = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Public | NodeFlags.Private | NodeFlags.Static] = "Modifier"; + NodeFlags[NodeFlags["Protected"] = 0x00000040] = "Protected"; + NodeFlags[NodeFlags["Static"] = 0x00000080] = "Static"; + NodeFlags[NodeFlags["MultiLine"] = 0x00000100] = "MultiLine"; + NodeFlags[NodeFlags["Synthetic"] = 0x00000200] = "Synthetic"; + NodeFlags[NodeFlags["DeclarationFile"] = 0x00000400] = "DeclarationFile"; + NodeFlags[NodeFlags["Modifier"] = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected | NodeFlags.Static] = "Modifier"; + NodeFlags[NodeFlags["AccessibilityModifier"] = NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected] = "AccessibilityModifier"; })(ts.NodeFlags || (ts.NodeFlags = {})); var NodeFlags = ts.NodeFlags; + (function (EmitReturnStatus) { + EmitReturnStatus[EmitReturnStatus["Succeeded"] = 0] = "Succeeded"; + EmitReturnStatus[EmitReturnStatus["AllOutputGenerationSkipped"] = 1] = "AllOutputGenerationSkipped"; + EmitReturnStatus[EmitReturnStatus["JSGeneratedWithSemanticErrors"] = 2] = "JSGeneratedWithSemanticErrors"; + EmitReturnStatus[EmitReturnStatus["DeclarationGenerationSkipped"] = 3] = "DeclarationGenerationSkipped"; + EmitReturnStatus[EmitReturnStatus["EmitErrorsEncountered"] = 4] = "EmitErrorsEncountered"; + EmitReturnStatus[EmitReturnStatus["CompilerOptionsErrors"] = 5] = "CompilerOptionsErrors"; + })(ts.EmitReturnStatus || (ts.EmitReturnStatus = {})); + var EmitReturnStatus = ts.EmitReturnStatus; (function (TypeFormatFlags) { TypeFormatFlags[TypeFormatFlags["None"] = 0x00000000] = "None"; TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 0x00000001] = "WriteArrayAsGenericType"; @@ -1624,12 +1683,13 @@ var ts; TypeFlags[TypeFlags["Class"] = 0x00000400] = "Class"; TypeFlags[TypeFlags["Interface"] = 0x00000800] = "Interface"; TypeFlags[TypeFlags["Reference"] = 0x00001000] = "Reference"; - TypeFlags[TypeFlags["Anonymous"] = 0x00002000] = "Anonymous"; - TypeFlags[TypeFlags["FromSignature"] = 0x00004000] = "FromSignature"; + TypeFlags[TypeFlags["Tuple"] = 0x00002000] = "Tuple"; + TypeFlags[TypeFlags["Anonymous"] = 0x00004000] = "Anonymous"; + TypeFlags[TypeFlags["FromSignature"] = 0x00008000] = "FromSignature"; TypeFlags[TypeFlags["Intrinsic"] = TypeFlags.Any | TypeFlags.String | TypeFlags.Number | TypeFlags.Boolean | TypeFlags.Void | TypeFlags.Undefined | TypeFlags.Null] = "Intrinsic"; TypeFlags[TypeFlags["StringLike"] = TypeFlags.String | TypeFlags.StringLiteral] = "StringLike"; TypeFlags[TypeFlags["NumberLike"] = TypeFlags.Number | TypeFlags.Enum] = "NumberLike"; - TypeFlags[TypeFlags["ObjectType"] = TypeFlags.Class | TypeFlags.Interface | TypeFlags.Reference | TypeFlags.Anonymous] = "ObjectType"; + TypeFlags[TypeFlags["ObjectType"] = TypeFlags.Class | TypeFlags.Interface | TypeFlags.Reference | TypeFlags.Tuple | TypeFlags.Anonymous] = "ObjectType"; })(ts.TypeFlags || (ts.TypeFlags = {})); var TypeFlags = ts.TypeFlags; (function (SignatureKind) { @@ -1800,8 +1860,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - var len = array.length; - for (var i = 0; i < len; i++) { + for (var i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return true; } @@ -1812,8 +1871,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - var len = array.length; - for (var i = 0; i < len; i++) { + for (var i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return i; } @@ -1823,9 +1881,8 @@ var ts; } ts.indexOf = indexOf; function filter(array, f) { - var result; if (array) { - result = []; + var result = []; for (var i = 0, len = array.length; i < len; i++) { var item = array[i]; if (f(item)) { @@ -1837,11 +1894,9 @@ var ts; } ts.filter = filter; function map(array, f) { - var result; if (array) { - result = []; - var len = array.length; - for (var i = 0; i < len; i++) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { result.push(f(array[i])); } } @@ -1856,6 +1911,18 @@ var ts; return array1.concat(array2); } ts.concatenate = concatenate; + function uniqueElements(array) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (!contains(result, item)) + result.push(item); + } + } + return result; + } + ts.uniqueElements = uniqueElements; function sum(array, prop) { var result = 0; for (var i = 0; i < array.length; i++) { @@ -2140,12 +2207,12 @@ var ts; return normalizedPathComponents(path, rootLength); } ts.getNormalizedPathComponents = getNormalizedPathComponents; - function getNormalizedPathFromPathCompoments(pathComponents) { + function getNormalizedPathFromPathComponents(pathComponents) { if (pathComponents && pathComponents.length) { return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator); } } - ts.getNormalizedPathFromPathCompoments = getNormalizedPathFromPathCompoments; + ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; function getNormalizedPathComponentsOfUrl(url) { var urlLength = url.length; var rootLength = url.indexOf("://") + "://".length; @@ -2198,7 +2265,7 @@ var ts; } return relativePath + relativePathComponents.join(ts.directorySeparator); } - var absolutePath = getNormalizedPathFromPathCompoments(pathComponents); + var absolutePath = getNormalizedPathFromPathComponents(pathComponents); if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) { absolutePath = "file:///" + absolutePath; } @@ -2482,7 +2549,7 @@ var sys = (function () { })(); var ts; (function (ts) { - var nodeConstructors = new Array(180 /* Count */); + var nodeConstructors = new Array(185 /* Count */); function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); } @@ -2506,7 +2573,7 @@ var ts; } ts.getModuleNameFromFilename = getModuleNameFromFilename; function getSourceFileOfNode(node) { - while (node && node.kind !== 177 /* SourceFile */) + while (node && node.kind !== 182 /* SourceFile */) node = node.parent; return node; } @@ -2521,8 +2588,8 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; - function getTokenPosOfNode(node) { - return ts.skipTrivia(getSourceFileOfNode(node).text, node.pos); + function getTokenPosOfNode(node, sourceFile) { + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function getSourceTextOfNodeFromSourceText(sourceText, node) { @@ -2543,13 +2610,13 @@ var ts; } ts.unescapeIdentifier = unescapeIdentifier; function identifierToString(identifier) { - return identifier.kind === 111 /* Missing */ ? "(Missing)" : getSourceTextOfNode(identifier); + return identifier.kind === 115 /* Missing */ ? "(Missing)" : getSourceTextOfNode(identifier); } ts.identifierToString = identifierToString; function createDiagnosticForNode(node, message, arg0, arg1, arg2) { node = getErrorSpanForNode(node); var file = getSourceFileOfNode(node); - var start = node.kind === 111 /* Missing */ ? node.pos : ts.skipTrivia(file.text, node.pos); + var start = node.kind === 115 /* Missing */ ? node.pos : ts.skipTrivia(file.text, node.pos); var length = node.end - start; return ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); } @@ -2565,12 +2632,12 @@ var ts; function getErrorSpanForNode(node) { var errorSpan; switch (node.kind) { - case 166 /* VariableDeclaration */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 172 /* ModuleDeclaration */: - case 171 /* EnumDeclaration */: - case 176 /* EnumMember */: + case 171 /* VariableDeclaration */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 177 /* ModuleDeclaration */: + case 176 /* EnumDeclaration */: + case 181 /* EnumMember */: errorSpan = node.name; break; } @@ -2582,18 +2649,18 @@ var ts; } ts.isExternalModule = isExternalModule; function isPrologueDirective(node) { - return node.kind === 146 /* ExpressionStatement */ && node.expression.kind === 3 /* StringLiteral */; + return node.kind === 151 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 55 /* Identifier */ && node.text && (node.text === "eval" || node.text === "arguments"); + return node.kind === 59 /* Identifier */ && node.text && (node.text === "eval" || node.text === "arguments"); } function isUseStrictPrologueDirective(node) { ts.Debug.assert(isPrologueDirective(node)); return node.expression.text === "use strict"; } function getLeadingCommentsOfNode(node, sourceFileOfNode) { - if (node.kind === 114 /* Parameter */ || node.kind === 113 /* TypeParameter */) { + if (node.kind === 118 /* Parameter */ || node.kind === 117 /* TypeParameter */) { return ts.concatenate(ts.getTrailingComments(sourceFileOfNode.text, node.pos), ts.getLeadingComments(sourceFileOfNode.text, node.pos)); } else { @@ -2629,124 +2696,221 @@ var ts; if (!node) return; switch (node.kind) { - case 112 /* QualifiedName */: + case 116 /* QualifiedName */: return child(node.left) || child(node.right); - case 113 /* TypeParameter */: + case 117 /* TypeParameter */: return child(node.name) || child(node.constraint); - case 114 /* Parameter */: + case 118 /* Parameter */: return child(node.name) || child(node.type) || child(node.initializer); - case 115 /* Property */: - case 129 /* PropertyAssignment */: + case 119 /* Property */: + case 134 /* PropertyAssignment */: return child(node.name) || child(node.type) || child(node.initializer); - case 120 /* CallSignature */: - case 121 /* ConstructSignature */: - case 122 /* IndexSignature */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + case 126 /* IndexSignature */: return children(node.typeParameters) || children(node.parameters) || child(node.type); - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 136 /* FunctionExpression */: - case 167 /* FunctionDeclaration */: - case 137 /* ArrowFunction */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 141 /* FunctionExpression */: + case 172 /* FunctionDeclaration */: + case 142 /* ArrowFunction */: return child(node.name) || children(node.typeParameters) || children(node.parameters) || child(node.type) || child(node.body); - case 123 /* TypeReference */: + case 127 /* TypeReference */: return child(node.typeName) || children(node.typeArguments); - case 124 /* TypeQuery */: + case 128 /* TypeQuery */: return child(node.exprName); - case 125 /* TypeLiteral */: + case 129 /* TypeLiteral */: return children(node.members); - case 126 /* ArrayType */: + case 130 /* ArrayType */: return child(node.elementType); - case 127 /* ArrayLiteral */: + case 131 /* TupleType */: + return children(node.elementTypes); + case 132 /* ArrayLiteral */: return children(node.elements); - case 128 /* ObjectLiteral */: + case 133 /* ObjectLiteral */: return children(node.properties); - case 130 /* PropertyAccess */: + case 135 /* PropertyAccess */: return child(node.left) || child(node.right); - case 131 /* IndexedAccess */: + case 136 /* IndexedAccess */: return child(node.object) || child(node.index); - case 132 /* CallExpression */: - case 133 /* NewExpression */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: return child(node.func) || children(node.typeArguments) || children(node.arguments); - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return child(node.type) || child(node.operand); - case 135 /* ParenExpression */: + case 140 /* ParenExpression */: return child(node.expression); - case 138 /* PrefixOperator */: - case 139 /* PostfixOperator */: + case 143 /* PrefixOperator */: + case 144 /* PostfixOperator */: return child(node.operand); - case 140 /* BinaryExpression */: + case 145 /* BinaryExpression */: return child(node.left) || child(node.right); - case 141 /* ConditionalExpression */: + case 146 /* ConditionalExpression */: return child(node.condition) || child(node.whenTrue) || child(node.whenFalse); - case 143 /* Block */: - case 162 /* TryBlock */: - case 164 /* FinallyBlock */: - case 168 /* FunctionBlock */: - case 173 /* ModuleBlock */: - case 177 /* SourceFile */: + case 148 /* Block */: + case 167 /* TryBlock */: + case 169 /* FinallyBlock */: + case 173 /* FunctionBlock */: + case 178 /* ModuleBlock */: + case 182 /* SourceFile */: return children(node.statements); - case 144 /* VariableStatement */: + case 149 /* VariableStatement */: return children(node.declarations); - case 146 /* ExpressionStatement */: + case 151 /* ExpressionStatement */: return child(node.expression); - case 147 /* IfStatement */: + case 152 /* IfStatement */: return child(node.expression) || child(node.thenStatement) || child(node.elseStatement); - case 148 /* DoStatement */: + case 153 /* DoStatement */: return child(node.statement) || child(node.expression); - case 149 /* WhileStatement */: + case 154 /* WhileStatement */: return child(node.expression) || child(node.statement); - case 150 /* ForStatement */: + case 155 /* ForStatement */: return children(node.declarations) || child(node.initializer) || child(node.condition) || child(node.iterator) || child(node.statement); - case 151 /* ForInStatement */: + case 156 /* ForInStatement */: return child(node.declaration) || child(node.variable) || child(node.expression) || child(node.statement); - case 152 /* ContinueStatement */: - case 153 /* BreakStatement */: + case 157 /* ContinueStatement */: + case 158 /* BreakStatement */: return child(node.label); - case 154 /* ReturnStatement */: + case 159 /* ReturnStatement */: return child(node.expression); - case 155 /* WithStatement */: + case 160 /* WithStatement */: return child(node.expression) || child(node.statement); - case 156 /* SwitchStatement */: + case 161 /* SwitchStatement */: return child(node.expression) || children(node.clauses); - case 157 /* CaseClause */: - case 158 /* DefaultClause */: + case 162 /* CaseClause */: + case 163 /* DefaultClause */: return child(node.expression) || children(node.statements); - case 159 /* LabelledStatement */: + case 164 /* LabeledStatement */: return child(node.label) || child(node.statement); - case 160 /* ThrowStatement */: + case 165 /* ThrowStatement */: return child(node.expression); - case 161 /* TryStatement */: + case 166 /* TryStatement */: return child(node.tryBlock) || child(node.catchBlock) || child(node.finallyBlock); - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: return child(node.variable) || children(node.statements); - case 166 /* VariableDeclaration */: + case 171 /* VariableDeclaration */: return child(node.name) || child(node.type) || child(node.initializer); - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: return child(node.name) || children(node.typeParameters) || child(node.baseType) || children(node.implementedTypes) || children(node.members); - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: return child(node.name) || children(node.typeParameters) || children(node.baseTypes) || children(node.members); - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: return child(node.name) || children(node.members); - case 176 /* EnumMember */: + case 181 /* EnumMember */: return child(node.name) || child(node.initializer); - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: return child(node.name) || child(node.body); - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: return child(node.name) || child(node.entityName) || child(node.externalModuleName); - case 175 /* ExportAssignment */: + case 180 /* ExportAssignment */: return child(node.exportName); } } ts.forEachChild = forEachChild; + function forEachReturnStatement(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 159 /* ReturnStatement */: + return visitor(node); + case 148 /* Block */: + case 173 /* FunctionBlock */: + case 152 /* IfStatement */: + case 153 /* DoStatement */: + case 154 /* WhileStatement */: + case 155 /* ForStatement */: + case 156 /* ForInStatement */: + case 160 /* WithStatement */: + case 161 /* SwitchStatement */: + case 162 /* CaseClause */: + case 163 /* DefaultClause */: + case 164 /* LabeledStatement */: + case 166 /* TryStatement */: + case 167 /* TryBlock */: + case 168 /* CatchBlock */: + case 169 /* FinallyBlock */: + return forEachChild(node, traverse); + } + } + } + ts.forEachReturnStatement = forEachReturnStatement; + function isAnyFunction(node) { + if (node) { + switch (node.kind) { + case 141 /* FunctionExpression */: + case 172 /* FunctionDeclaration */: + case 142 /* ArrowFunction */: + case 120 /* Method */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 121 /* Constructor */: + return true; + } + } + return false; + } + ts.isAnyFunction = isAnyFunction; + function getContainingFunction(node) { + while (true) { + node = node.parent; + if (!node || isAnyFunction(node)) { + return node; + } + } + } + ts.getContainingFunction = getContainingFunction; + function getThisContainer(node, includeArrowFunctions) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 142 /* ArrowFunction */: + if (!includeArrowFunctions) { + continue; + } + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 177 /* ModuleDeclaration */: + case 119 /* Property */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 176 /* EnumDeclaration */: + case 182 /* SourceFile */: + return node; + } + } + } + ts.getThisContainer = getThisContainer; + function getSuperContainer(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 119 /* Property */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + return node; + } + } + } + ts.getSuperContainer = getSuperContainer; function hasRestParameters(s) { return s.parameters.length > 0 && (s.parameters[s.parameters.length - 1].flags & 8 /* Rest */) !== 0; } ts.hasRestParameters = hasRestParameters; function isInAmbientContext(node) { while (node) { - if (node.flags & (2 /* Ambient */ | 512 /* DeclarationFile */)) + if (node.flags & (2 /* Ambient */ | 1024 /* DeclarationFile */)) return true; node = node.parent; } @@ -2755,40 +2919,96 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 113 /* TypeParameter */: - case 114 /* Parameter */: - case 166 /* VariableDeclaration */: - case 115 /* Property */: - case 129 /* PropertyAssignment */: - case 176 /* EnumMember */: - case 116 /* Method */: - case 167 /* FunctionDeclaration */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 171 /* EnumDeclaration */: - case 172 /* ModuleDeclaration */: - case 174 /* ImportDeclaration */: + case 117 /* TypeParameter */: + case 118 /* Parameter */: + case 171 /* VariableDeclaration */: + case 119 /* Property */: + case 134 /* PropertyAssignment */: + case 181 /* EnumMember */: + case 120 /* Method */: + case 172 /* FunctionDeclaration */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: + case 177 /* ModuleDeclaration */: + case 179 /* ImportDeclaration */: return true; } return false; } ts.isDeclaration = isDeclaration; + function isStatement(n) { + switch (n.kind) { + case 158 /* BreakStatement */: + case 157 /* ContinueStatement */: + case 170 /* DebuggerStatement */: + case 153 /* DoStatement */: + case 151 /* ExpressionStatement */: + case 150 /* EmptyStatement */: + case 156 /* ForInStatement */: + case 155 /* ForStatement */: + case 152 /* IfStatement */: + case 164 /* LabeledStatement */: + case 159 /* ReturnStatement */: + case 161 /* SwitchStatement */: + case 88 /* ThrowKeyword */: + case 166 /* TryStatement */: + case 149 /* VariableStatement */: + case 154 /* WhileStatement */: + case 160 /* WithStatement */: + case 180 /* ExportAssignment */: + return true; + default: + return false; + } + } + ts.isStatement = isStatement; function isDeclarationOrFunctionExpressionOrCatchVariableName(name) { - if (name.kind !== 55 /* Identifier */ && name.kind !== 3 /* StringLiteral */ && name.kind !== 2 /* NumericLiteral */) { + if (name.kind !== 59 /* Identifier */ && name.kind !== 7 /* StringLiteral */ && name.kind !== 6 /* NumericLiteral */) { return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === 136 /* FunctionExpression */) { + if (isDeclaration(parent) || parent.kind === 141 /* FunctionExpression */) { return parent.name === name; } - if (parent.kind === 163 /* CatchBlock */) { + if (parent.kind === 168 /* CatchBlock */) { return parent.variable === name; } return false; } ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; + function getAncestor(node, kind) { + switch (kind) { + case 174 /* ClassDeclaration */: + while (node) { + switch (node.kind) { + case 174 /* ClassDeclaration */: + return node; + case 176 /* EnumDeclaration */: + case 175 /* InterfaceDeclaration */: + case 177 /* ModuleDeclaration */: + case 179 /* ImportDeclaration */: + return undefined; + default: + node = node.parent; + continue; + } + } + break; + default: + while (node) { + if (node.kind === kind) { + return node; + } + node = node.parent; + } + break; + } + return undefined; + } + ts.getAncestor = getAncestor; var ParsingContext; (function (ParsingContext) { ParsingContext[ParsingContext["SourceElements"] = 0] = "SourceElements"; @@ -2807,7 +3027,8 @@ var ts; ParsingContext[ParsingContext["Parameters"] = 13] = "Parameters"; ParsingContext[ParsingContext["TypeParameters"] = 14] = "TypeParameters"; ParsingContext[ParsingContext["TypeArguments"] = 15] = "TypeArguments"; - ParsingContext[ParsingContext["Count"] = 16] = "Count"; + ParsingContext[ParsingContext["TupleElementTypes"] = 16] = "TupleElementTypes"; + ParsingContext[ParsingContext["Count"] = 17] = "Count"; })(ParsingContext || (ParsingContext = {})); var Tristate; (function (Tristate) { @@ -2849,6 +3070,8 @@ var ts; return ts.Diagnostics.Type_parameter_declaration_expected; case 15 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected; + case 16 /* TupleElementTypes */: + return ts.Diagnostics.Type_expected; } } ; @@ -2883,11 +3106,12 @@ var ts; ts.isKeyword = isKeyword; function isModifier(token) { switch (token) { - case 98 /* PublicKeyword */: - case 96 /* PrivateKeyword */: - case 99 /* StaticKeyword */: - case 68 /* ExportKeyword */: - case 104 /* DeclareKeyword */: + case 102 /* PublicKeyword */: + case 100 /* PrivateKeyword */: + case 101 /* ProtectedKeyword */: + case 103 /* StaticKeyword */: + case 72 /* ExportKeyword */: + case 108 /* DeclareKeyword */: return true; } return false; @@ -3003,7 +3227,7 @@ var ts; } function grammarErrorOnNode(node, message, arg0, arg1, arg2) { var span = getErrorSpanForNode(node); - var start = ts.skipTrivia(file.text, span.pos); + var start = span.end > span.pos ? ts.skipTrivia(file.text, span.pos) : span.pos; var length = span.end - start; file.syntacticErrors.push(ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); } @@ -3078,7 +3302,7 @@ var ts; return scanner.tryScan(function () { return lookAheadHelper(callback, false); }); } function isIdentifier() { - return token === 55 /* Identifier */ || (isInStrictMode ? token > ts.SyntaxKind.LastFutureReservedWord : token > ts.SyntaxKind.LastReservedWord); + return token === 59 /* Identifier */ || (isInStrictMode ? token > ts.SyntaxKind.LastFutureReservedWord : token > ts.SyntaxKind.LastReservedWord); } function parseExpected(t) { if (token === t) { @@ -3096,14 +3320,14 @@ var ts; return false; } function canParseSemicolon() { - if (token === 13 /* SemicolonToken */) { + if (token === 17 /* SemicolonToken */) { return true; } - return token === 6 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); + return token === 10 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); } function parseSemicolon() { if (canParseSemicolon()) { - if (token === 13 /* SemicolonToken */) { + if (token === 17 /* SemicolonToken */) { nextToken(); } } @@ -3125,7 +3349,7 @@ var ts; return node; } function createMissingNode() { - return createNode(111 /* Missing */); + return createNode(115 /* Missing */); } function internIdentifier(text) { return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); @@ -3133,7 +3357,7 @@ var ts; function createIdentifier(isIdentifier) { identifierCount++; if (isIdentifier) { - var node = createNode(55 /* Identifier */); + var node = createNode(59 /* Identifier */); var text = escapeIdentifier(scanner.getTokenValue()); node.text = internIdentifier(text); nextToken(); @@ -3146,13 +3370,13 @@ var ts; return createIdentifier(isIdentifier()); } function parseIdentifierName() { - return createIdentifier(token >= 55 /* Identifier */); + return createIdentifier(token >= 59 /* Identifier */); } function isPropertyName() { - return token >= 55 /* Identifier */ || token === 3 /* StringLiteral */ || token === 2 /* NumericLiteral */; + return token >= 59 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */; } function parsePropertyName() { - if (token === 3 /* StringLiteral */ || token === 2 /* NumericLiteral */) { + if (token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { return parseLiteralNode(true); } return parseIdentifierName(); @@ -3160,13 +3384,13 @@ var ts; function parseContextualModifier(t) { return token === t && tryParse(function () { nextToken(); - return token === 9 /* OpenBracketToken */ || isPropertyName(); + return token === 13 /* OpenBracketToken */ || isPropertyName(); }); } function parseAnyContextualModifier() { return isModifier(token) && tryParse(function () { nextToken(); - return token === 9 /* OpenBracketToken */ || isPropertyName(); + return token === 13 /* OpenBracketToken */ || isPropertyName(); }); } function isListElement(kind, inErrorRecovery) { @@ -3178,7 +3402,7 @@ var ts; case 4 /* SwitchClauseStatements */: return isStatement(inErrorRecovery); case 3 /* SwitchClauses */: - return token === 57 /* CaseKeyword */ || token === 63 /* DefaultKeyword */; + return token === 61 /* CaseKeyword */ || token === 67 /* DefaultKeyword */; case 5 /* TypeMembers */: return isTypeMember(); case 6 /* ClassMembers */: @@ -3187,17 +3411,18 @@ var ts; case 11 /* ObjectLiteralMembers */: return isPropertyName(); case 8 /* BaseTypeReferences */: - return isIdentifier() && ((token !== 69 /* ExtendsKeyword */ && token !== 92 /* ImplementsKeyword */) || !lookAhead(function () { return (nextToken(), isIdentifier()); })); + return isIdentifier() && ((token !== 73 /* ExtendsKeyword */ && token !== 96 /* ImplementsKeyword */) || !lookAhead(function () { return (nextToken(), isIdentifier()); })); case 9 /* VariableDeclarations */: case 14 /* TypeParameters */: return isIdentifier(); case 10 /* ArgumentExpressions */: return isExpression(); case 12 /* ArrayLiteralMembers */: - return token === 14 /* CommaToken */ || isExpression(); + return token === 18 /* CommaToken */ || isExpression(); case 13 /* Parameters */: return isParameter(); case 15 /* TypeArguments */: + case 16 /* TupleElementTypes */: return isType(); } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); @@ -3214,39 +3439,40 @@ var ts; case 6 /* ClassMembers */: case 7 /* EnumMembers */: case 11 /* ObjectLiteralMembers */: - return token === 6 /* CloseBraceToken */; + return token === 10 /* CloseBraceToken */; case 4 /* SwitchClauseStatements */: - return token === 6 /* CloseBraceToken */ || token === 57 /* CaseKeyword */ || token === 63 /* DefaultKeyword */; + return token === 10 /* CloseBraceToken */ || token === 61 /* CaseKeyword */ || token === 67 /* DefaultKeyword */; case 8 /* BaseTypeReferences */: - return token === 5 /* OpenBraceToken */ || token === 69 /* ExtendsKeyword */ || token === 92 /* ImplementsKeyword */; + return token === 9 /* OpenBraceToken */ || token === 73 /* ExtendsKeyword */ || token === 96 /* ImplementsKeyword */; case 9 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); case 14 /* TypeParameters */: - return token === 16 /* GreaterThanToken */ || token === 7 /* OpenParenToken */ || token === 5 /* OpenBraceToken */ || token === 69 /* ExtendsKeyword */ || token === 92 /* ImplementsKeyword */; + return token === 20 /* GreaterThanToken */ || token === 11 /* OpenParenToken */ || token === 9 /* OpenBraceToken */ || token === 73 /* ExtendsKeyword */ || token === 96 /* ImplementsKeyword */; case 10 /* ArgumentExpressions */: - return token === 8 /* CloseParenToken */ || token === 13 /* SemicolonToken */; + return token === 12 /* CloseParenToken */ || token === 17 /* SemicolonToken */; case 12 /* ArrayLiteralMembers */: - return token === 10 /* CloseBracketToken */; + case 16 /* TupleElementTypes */: + return token === 14 /* CloseBracketToken */; case 13 /* Parameters */: - return token === 8 /* CloseParenToken */ || token === 10 /* CloseBracketToken */ || token === 5 /* OpenBraceToken */; + return token === 12 /* CloseParenToken */ || token === 14 /* CloseBracketToken */ || token === 9 /* OpenBraceToken */; case 15 /* TypeArguments */: - return token === 16 /* GreaterThanToken */ || token === 7 /* OpenParenToken */; + return token === 20 /* GreaterThanToken */ || token === 11 /* OpenParenToken */; } } function isVariableDeclaratorListTerminator() { if (canParseSemicolon()) { return true; } - if (token === 76 /* InKeyword */) { + if (token === 80 /* InKeyword */) { return true; } - if (token === 23 /* EqualsGreaterThanToken */) { + if (token === 27 /* EqualsGreaterThanToken */) { return true; } return false; } function isInSomeParsingContext() { - for (var kind = 0; kind < 16 /* Count */; kind++) { + for (var kind = 0; kind < 17 /* Count */; kind++) { if (parsingContext & (1 << kind)) { if (isListElement(kind, true) || isListTerminator(kind)) { return true; @@ -3301,7 +3527,7 @@ var ts; if (isListElement(kind, false)) { result.push(parseElement()); commaStart = scanner.getTokenPos(); - if (parseOptional(14 /* CommaToken */)) { + if (parseOptional(18 /* CommaToken */)) { continue; } commaStart = -1; @@ -3318,7 +3544,7 @@ var ts; } } else if (trailingCommaBehavior === 2 /* Preserve */) { - result.push(createNode(142 /* OmittedExpression */)); + result.push(createNode(147 /* OmittedExpression */)); } } break; @@ -3358,8 +3584,8 @@ var ts; } function parseEntityName(allowReservedWords) { var entity = parseIdentifier(); - while (parseOptional(11 /* DotToken */)) { - var node = createNode(112 /* QualifiedName */, entity.pos); + while (parseOptional(15 /* DotToken */)) { + var node = createNode(116 /* QualifiedName */, entity.pos); node.left = entity; node.right = allowReservedWords ? parseIdentifierName() : parseIdentifier(); entity = finishNode(node); @@ -3378,7 +3604,7 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 2 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 6 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { if (isInStrictMode) { grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); } @@ -3389,29 +3615,29 @@ var ts; return node; } function parseStringLiteral() { - if (token === 3 /* StringLiteral */) + if (token === 7 /* StringLiteral */) return parseLiteralNode(true); error(ts.Diagnostics.String_literal_expected); return createMissingNode(); } function parseTypeReference() { - var node = createNode(123 /* TypeReference */); + var node = createNode(127 /* TypeReference */); node.typeName = parseEntityName(false); - if (!scanner.hasPrecedingLineBreak() && token === 15 /* LessThanToken */) { + if (!scanner.hasPrecedingLineBreak() && token === 19 /* LessThanToken */) { node.typeArguments = parseTypeArguments(); } return finishNode(node); } function parseTypeQuery() { - var node = createNode(124 /* TypeQuery */); - parseExpected(87 /* TypeOfKeyword */); + var node = createNode(128 /* TypeQuery */); + parseExpected(91 /* TypeOfKeyword */); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(113 /* TypeParameter */); + var node = createNode(117 /* TypeParameter */); node.name = parseIdentifier(); - if (parseOptional(69 /* ExtendsKeyword */)) { + if (parseOptional(73 /* ExtendsKeyword */)) { if (isType() || !isExpression()) { node.constraint = parseType(); } @@ -3423,9 +3649,9 @@ var ts; return finishNode(node); } function parseTypeParameters() { - if (token === 15 /* LessThanToken */) { + if (token === 19 /* LessThanToken */) { var pos = getNodePos(); - var result = parseBracketedList(14 /* TypeParameters */, parseTypeParameter, 15 /* LessThanToken */, 16 /* GreaterThanToken */); + var result = parseBracketedList(14 /* TypeParameters */, parseTypeParameter, 19 /* LessThanToken */, 20 /* GreaterThanToken */); if (!result.length) { var start = getTokenPos(pos); var length = getNodePos() - start; @@ -3435,37 +3661,44 @@ var ts; } } function parseParameterType() { - return parseOptional(42 /* ColonToken */) ? token === 3 /* StringLiteral */ ? parseStringLiteral() : parseType() : undefined; + return parseOptional(46 /* ColonToken */) ? token === 7 /* StringLiteral */ ? parseStringLiteral() : parseType() : undefined; } function isParameter() { - return token === 12 /* DotDotDotToken */ || isIdentifier() || isModifier(token); + return token === 16 /* DotDotDotToken */ || isIdentifier() || isModifier(token); } function parseParameter(flags) { if (flags === void 0) { flags = 0; } - var node = createNode(114 /* Parameter */); + var node = createNode(118 /* Parameter */); node.flags |= parseAndCheckModifiers(3 /* Parameters */); - if (parseOptional(12 /* DotDotDotToken */)) { + if (parseOptional(16 /* DotDotDotToken */)) { node.flags |= 8 /* Rest */; } node.name = parseIdentifier(); - if (node.name.kind === 111 /* Missing */ && node.flags === 0 && isModifier(token)) { + if (node.name.kind === 115 /* Missing */ && node.flags === 0 && isModifier(token)) { nextToken(); } - if (parseOptional(41 /* QuestionToken */)) { + if (parseOptional(45 /* QuestionToken */)) { node.flags |= 4 /* QuestionMark */; } node.type = parseParameterType(); node.initializer = parseInitializer(true); return finishNode(node); } - function parseSignature(kind, returnToken) { - if (kind === 121 /* ConstructSignature */) { - parseExpected(78 /* NewKeyword */); + function parseSignature(kind, returnToken, returnTokenRequired) { + if (kind === 125 /* ConstructSignature */) { + parseExpected(82 /* NewKeyword */); } var typeParameters = parseTypeParameters(); - var parameters = parseParameterList(7 /* OpenParenToken */, 8 /* CloseParenToken */); + var parameters = parseParameterList(11 /* OpenParenToken */, 12 /* CloseParenToken */); checkParameterList(parameters); - var type = parseOptional(returnToken) ? parseType() : undefined; + var type; + if (returnTokenRequired) { + parseExpected(returnToken); + type = parseType(); + } + else if (parseOptional(returnToken)) { + type = parseType(); + } return { typeParameters: typeParameters, parameters: parameters, @@ -3515,7 +3748,7 @@ var ts; } function parseSignatureMember(kind, returnToken) { var node = createNode(kind); - var sig = parseSignature(kind, returnToken); + var sig = parseSignature(kind, returnToken, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -3523,10 +3756,10 @@ var ts; return finishNode(node); } function parseIndexSignatureMember() { - var node = createNode(122 /* IndexSignature */); + var node = createNode(126 /* IndexSignature */); var errorCountBeforeIndexSignature = file.syntacticErrors.length; var indexerStart = scanner.getTokenPos(); - node.parameters = parseParameterList(9 /* OpenBracketToken */, 10 /* CloseBracketToken */); + node.parameters = parseParameterList(13 /* OpenBracketToken */, 14 /* CloseBracketToken */); var indexerLength = scanner.getStartPos() - indexerStart; node.type = parseTypeAnnotation(); parseSemicolon(); @@ -3567,7 +3800,7 @@ var ts; grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); return; } - else if (parameter.type.kind !== 110 /* StringKeyword */ && parameter.type.kind !== 108 /* NumberKeyword */) { + else if (parameter.type.kind !== 114 /* StringKeyword */ && parameter.type.kind !== 112 /* NumberKeyword */) { grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); return; } @@ -3579,18 +3812,18 @@ var ts; function parsePropertyOrMethod() { var node = createNode(0 /* Unknown */); node.name = parsePropertyName(); - if (parseOptional(41 /* QuestionToken */)) { + if (parseOptional(45 /* QuestionToken */)) { node.flags |= 4 /* QuestionMark */; } - if (token === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */) { - node.kind = 116 /* Method */; - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { + node.kind = 120 /* Method */; + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; } else { - node.kind = 115 /* Property */; + node.kind = 119 /* Property */; node.type = parseTypeAnnotation(); } parseSemicolon(); @@ -3598,49 +3831,59 @@ var ts; } function isTypeMember() { switch (token) { - case 7 /* OpenParenToken */: - case 15 /* LessThanToken */: - case 9 /* OpenBracketToken */: + case 11 /* OpenParenToken */: + case 19 /* LessThanToken */: + case 13 /* OpenBracketToken */: return true; default: - return isPropertyName() && lookAhead(function () { return nextToken() === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */ || token === 41 /* QuestionToken */ || token === 42 /* ColonToken */ || canParseSemicolon(); }); + return isPropertyName() && lookAhead(function () { return nextToken() === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */ || token === 45 /* QuestionToken */ || token === 46 /* ColonToken */ || canParseSemicolon(); }); } } function parseTypeMember() { switch (token) { - case 7 /* OpenParenToken */: - case 15 /* LessThanToken */: - return parseSignatureMember(120 /* CallSignature */, 42 /* ColonToken */); - case 9 /* OpenBracketToken */: + case 11 /* OpenParenToken */: + case 19 /* LessThanToken */: + return parseSignatureMember(124 /* CallSignature */, 46 /* ColonToken */); + case 13 /* OpenBracketToken */: return parseIndexSignatureMember(); - case 78 /* NewKeyword */: - if (lookAhead(function () { return nextToken() === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */; })) { - return parseSignatureMember(121 /* ConstructSignature */, 42 /* ColonToken */); + case 82 /* NewKeyword */: + if (lookAhead(function () { return nextToken() === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */; })) { + return parseSignatureMember(125 /* ConstructSignature */, 46 /* ColonToken */); } - case 3 /* StringLiteral */: - case 2 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 6 /* NumericLiteral */: return parsePropertyOrMethod(); default: - if (token >= 55 /* Identifier */) { + if (token >= 59 /* Identifier */) { return parsePropertyOrMethod(); } } } function parseTypeLiteral() { - var node = createNode(125 /* TypeLiteral */); - if (parseExpected(5 /* OpenBraceToken */)) { + var node = createNode(129 /* TypeLiteral */); + if (parseExpected(9 /* OpenBraceToken */)) { node.members = parseList(5 /* TypeMembers */, false, parseTypeMember); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); } else { node.members = createMissingList(); } return finishNode(node); } + function parseTupleType() { + var node = createNode(131 /* TupleType */); + var startTokenPos = scanner.getTokenPos(); + var startErrorCount = file.syntacticErrors.length; + node.elementTypes = parseBracketedList(16 /* TupleElementTypes */, parseType, 13 /* OpenBracketToken */, 14 /* CloseBracketToken */); + if (!node.elementTypes.length && file.syntacticErrors.length === startErrorCount) { + grammarErrorAtPos(startTokenPos, scanner.getStartPos() - startTokenPos, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty); + } + return finishNode(node); + } function parseFunctionType(signatureKind) { - var node = createNode(125 /* TypeLiteral */); + var node = createNode(129 /* TypeLiteral */); var member = createNode(signatureKind); - var sig = parseSignature(signatureKind, 23 /* EqualsGreaterThanToken */); + var sig = parseSignature(signatureKind, 27 /* EqualsGreaterThanToken */, true); member.typeParameters = sig.typeParameters; member.parameters = sig.parameters; member.type = sig.type; @@ -3650,26 +3893,28 @@ var ts; } function parseKeywordAndNoDot() { var node = parseTokenNode(); - return token === 11 /* DotToken */ ? undefined : node; + return token === 15 /* DotToken */ ? undefined : node; } function parseNonArrayType() { switch (token) { - case 101 /* AnyKeyword */: - case 110 /* StringKeyword */: - case 108 /* NumberKeyword */: - case 102 /* BooleanKeyword */: - case 89 /* VoidKeyword */: + case 105 /* AnyKeyword */: + case 114 /* StringKeyword */: + case 112 /* NumberKeyword */: + case 106 /* BooleanKeyword */: + case 93 /* VoidKeyword */: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); - case 87 /* TypeOfKeyword */: + case 91 /* TypeOfKeyword */: return parseTypeQuery(); - case 5 /* OpenBraceToken */: + case 9 /* OpenBraceToken */: return parseTypeLiteral(); - case 7 /* OpenParenToken */: - case 15 /* LessThanToken */: - return parseFunctionType(120 /* CallSignature */); - case 78 /* NewKeyword */: - return parseFunctionType(121 /* ConstructSignature */); + case 13 /* OpenBracketToken */: + return parseTupleType(); + case 11 /* OpenParenToken */: + case 19 /* LessThanToken */: + return parseFunctionType(124 /* CallSignature */); + case 82 /* NewKeyword */: + return parseFunctionType(125 /* ConstructSignature */); default: if (isIdentifier()) { return parseTypeReference(); @@ -3680,20 +3925,21 @@ var ts; } function isType() { switch (token) { - case 101 /* AnyKeyword */: - case 110 /* StringKeyword */: - case 108 /* NumberKeyword */: - case 102 /* BooleanKeyword */: - case 89 /* VoidKeyword */: - case 87 /* TypeOfKeyword */: - case 5 /* OpenBraceToken */: - case 15 /* LessThanToken */: - case 78 /* NewKeyword */: + case 105 /* AnyKeyword */: + case 114 /* StringKeyword */: + case 112 /* NumberKeyword */: + case 106 /* BooleanKeyword */: + case 93 /* VoidKeyword */: + case 91 /* TypeOfKeyword */: + case 9 /* OpenBraceToken */: + case 13 /* OpenBracketToken */: + case 19 /* LessThanToken */: + case 82 /* NewKeyword */: return true; - case 7 /* OpenParenToken */: + case 11 /* OpenParenToken */: return lookAhead(function () { nextToken(); - return token === 8 /* CloseParenToken */ || isParameter(); + return token === 12 /* CloseParenToken */ || isParameter(); }); default: return isIdentifier(); @@ -3701,66 +3947,66 @@ var ts; } function parseType() { var type = parseNonArrayType(); - while (type && !scanner.hasPrecedingLineBreak() && parseOptional(9 /* OpenBracketToken */)) { - parseExpected(10 /* CloseBracketToken */); - var node = createNode(126 /* ArrayType */, type.pos); + while (type && !scanner.hasPrecedingLineBreak() && parseOptional(13 /* OpenBracketToken */)) { + parseExpected(14 /* CloseBracketToken */); + var node = createNode(130 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } return type; } function parseTypeAnnotation() { - return parseOptional(42 /* ColonToken */) ? parseType() : undefined; + return parseOptional(46 /* ColonToken */) ? parseType() : undefined; } function isExpression() { switch (token) { - case 83 /* ThisKeyword */: - case 81 /* SuperKeyword */: - case 79 /* NullKeyword */: - case 85 /* TrueKeyword */: - case 70 /* FalseKeyword */: - case 2 /* NumericLiteral */: - case 3 /* StringLiteral */: - case 7 /* OpenParenToken */: - case 9 /* OpenBracketToken */: - case 5 /* OpenBraceToken */: - case 73 /* FunctionKeyword */: - case 78 /* NewKeyword */: - case 27 /* SlashToken */: - case 47 /* SlashEqualsToken */: - case 24 /* PlusToken */: - case 25 /* MinusToken */: - case 38 /* TildeToken */: - case 37 /* ExclamationToken */: - case 64 /* DeleteKeyword */: - case 87 /* TypeOfKeyword */: - case 89 /* VoidKeyword */: - case 29 /* PlusPlusToken */: - case 30 /* MinusMinusToken */: - case 15 /* LessThanToken */: - case 55 /* Identifier */: + case 87 /* ThisKeyword */: + case 85 /* SuperKeyword */: + case 83 /* NullKeyword */: + case 89 /* TrueKeyword */: + case 74 /* FalseKeyword */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 11 /* OpenParenToken */: + case 13 /* OpenBracketToken */: + case 9 /* OpenBraceToken */: + case 77 /* FunctionKeyword */: + case 82 /* NewKeyword */: + case 31 /* SlashToken */: + case 51 /* SlashEqualsToken */: + case 28 /* PlusToken */: + case 29 /* MinusToken */: + case 42 /* TildeToken */: + case 41 /* ExclamationToken */: + case 68 /* DeleteKeyword */: + case 91 /* TypeOfKeyword */: + case 93 /* VoidKeyword */: + case 33 /* PlusPlusToken */: + case 34 /* MinusMinusToken */: + case 19 /* LessThanToken */: + case 59 /* Identifier */: return true; default: return isIdentifier(); } } function isExpressionStatement() { - return token !== 5 /* OpenBraceToken */ && token !== 73 /* FunctionKeyword */ && isExpression(); + return token !== 9 /* OpenBraceToken */ && token !== 77 /* FunctionKeyword */ && isExpression(); } function parseExpression(noIn) { var expr = parseAssignmentExpression(noIn); - while (parseOptional(14 /* CommaToken */)) { - expr = makeBinaryExpression(expr, 14 /* CommaToken */, parseAssignmentExpression(noIn)); + while (parseOptional(18 /* CommaToken */)) { + expr = makeBinaryExpression(expr, 18 /* CommaToken */, parseAssignmentExpression(noIn)); } return expr; } function parseInitializer(inParameter, noIn) { - if (token !== 43 /* EqualsToken */) { - if (scanner.hasPrecedingLineBreak() || (inParameter && token === 5 /* OpenBraceToken */) || !isExpression()) { + if (token !== 47 /* EqualsToken */) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 9 /* OpenBraceToken */) || !isExpression()) { return undefined; } } - parseExpected(43 /* EqualsToken */); + parseExpected(47 /* EqualsToken */); return parseAssignmentExpression(noIn); } function parseAssignmentExpression(noIn) { @@ -3769,7 +4015,7 @@ var ts; return arrowExpression; } var expr = parseConditionalExpression(noIn); - if (expr.kind === 55 /* Identifier */ && token === 23 /* EqualsGreaterThanToken */) { + if (expr.kind === 59 /* Identifier */ && token === 27 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression(expr); } if (isLeftHandSideExpression(expr) && isAssignmentOperator()) { @@ -3785,33 +4031,33 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 130 /* PropertyAccess */: - case 131 /* IndexedAccess */: - case 133 /* NewExpression */: - case 132 /* CallExpression */: - case 127 /* ArrayLiteral */: - case 135 /* ParenExpression */: - case 128 /* ObjectLiteral */: - case 136 /* FunctionExpression */: - case 55 /* Identifier */: - case 111 /* Missing */: - case 4 /* RegularExpressionLiteral */: - case 2 /* NumericLiteral */: - case 3 /* StringLiteral */: - case 70 /* FalseKeyword */: - case 79 /* NullKeyword */: - case 83 /* ThisKeyword */: - case 85 /* TrueKeyword */: - case 81 /* SuperKeyword */: + case 135 /* PropertyAccess */: + case 136 /* IndexedAccess */: + case 138 /* NewExpression */: + case 137 /* CallExpression */: + case 132 /* ArrayLiteral */: + case 140 /* ParenExpression */: + case 133 /* ObjectLiteral */: + case 141 /* FunctionExpression */: + case 59 /* Identifier */: + case 115 /* Missing */: + case 8 /* RegularExpressionLiteral */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 74 /* FalseKeyword */: + case 83 /* NullKeyword */: + case 87 /* ThisKeyword */: + case 89 /* TrueKeyword */: + case 85 /* SuperKeyword */: return true; } } return false; } function parseSimpleArrowFunctionExpression(identifier) { - ts.Debug.assert(token === 23 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - parseExpected(23 /* EqualsGreaterThanToken */); - var parameter = createNode(114 /* Parameter */, identifier.pos); + ts.Debug.assert(token === 27 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + parseExpected(27 /* EqualsGreaterThanToken */); + var parameter = createNode(118 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); var parameters = []; @@ -3828,17 +4074,17 @@ var ts; } var pos = getNodePos(); if (triState === 1 /* True */) { - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); - if (parseExpected(23 /* EqualsGreaterThanToken */) || token === 5 /* OpenBraceToken */) { + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); + if (parseExpected(27 /* EqualsGreaterThanToken */) || token === 9 /* OpenBraceToken */) { return parseArrowExpressionTail(pos, sig, false); } else { - return makeFunctionExpression(137 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); + return makeFunctionExpression(142 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); } } var sig = tryParseSignatureIfArrowOrBraceFollows(); if (sig) { - parseExpected(23 /* EqualsGreaterThanToken */); + parseExpected(27 /* EqualsGreaterThanToken */); return parseArrowExpressionTail(pos, sig, false); } else { @@ -3846,35 +4092,35 @@ var ts; } } function isParenthesizedArrowFunctionExpression() { - if (token === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */) { + if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { return lookAhead(function () { var first = token; var second = nextToken(); - if (first === 7 /* OpenParenToken */) { - if (second === 8 /* CloseParenToken */) { + if (first === 11 /* OpenParenToken */) { + if (second === 12 /* CloseParenToken */) { var third = nextToken(); switch (third) { - case 23 /* EqualsGreaterThanToken */: - case 42 /* ColonToken */: - case 5 /* OpenBraceToken */: + case 27 /* EqualsGreaterThanToken */: + case 46 /* ColonToken */: + case 9 /* OpenBraceToken */: return 1 /* True */; default: return 0 /* False */; } } - if (second === 12 /* DotDotDotToken */) { + if (second === 16 /* DotDotDotToken */) { return 1 /* True */; } if (!isIdentifier()) { return 0 /* False */; } - if (nextToken() === 42 /* ColonToken */) { + if (nextToken() === 46 /* ColonToken */) { return 1 /* True */; } return 2 /* Unknown */; } else { - ts.Debug.assert(first === 15 /* LessThanToken */); + ts.Debug.assert(first === 19 /* LessThanToken */); if (!isIdentifier()) { return 0 /* False */; } @@ -3882,15 +4128,15 @@ var ts; } }); } - if (token === 23 /* EqualsGreaterThanToken */) { + if (token === 27 /* EqualsGreaterThanToken */) { return 1 /* True */; } return 0 /* False */; } function tryParseSignatureIfArrowOrBraceFollows() { return tryParse(function () { - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); - if (token === 23 /* EqualsGreaterThanToken */ || token === 5 /* OpenBraceToken */) { + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); + if (token === 27 /* EqualsGreaterThanToken */ || token === 9 /* OpenBraceToken */) { return sig; } return undefined; @@ -3898,27 +4144,27 @@ var ts; } function parseArrowExpressionTail(pos, sig, noIn) { var body; - if (token === 5 /* OpenBraceToken */) { + if (token === 9 /* OpenBraceToken */) { body = parseBody(false); } - else if (isStatement(true) && !isExpressionStatement() && token !== 73 /* FunctionKeyword */) { + else if (isStatement(true) && !isExpressionStatement() && token !== 77 /* FunctionKeyword */) { body = parseBody(true); } else { body = parseAssignmentExpression(noIn); } - return makeFunctionExpression(137 /* ArrowFunction */, pos, undefined, sig, body); + return makeFunctionExpression(142 /* ArrowFunction */, pos, undefined, sig, body); } function isAssignmentOperator() { return token >= ts.SyntaxKind.FirstAssignment && token <= ts.SyntaxKind.LastAssignment; } function parseConditionalExpression(noIn) { var expr = parseBinaryExpression(noIn); - while (parseOptional(41 /* QuestionToken */)) { - var node = createNode(141 /* ConditionalExpression */, expr.pos); + while (parseOptional(45 /* QuestionToken */)) { + var node = createNode(146 /* ConditionalExpression */, expr.pos); node.condition = expr; node.whenTrue = parseAssignmentExpression(false); - parseExpected(42 /* ColonToken */); + parseExpected(46 /* ColonToken */); node.whenFalse = parseAssignmentExpression(noIn); expr = finishNode(node); } @@ -3931,7 +4177,7 @@ var ts; while (true) { reScanGreaterToken(); var precedence = getOperatorPrecedence(); - if (precedence && precedence > minPrecedence && (!noIn || token !== 76 /* InKeyword */)) { + if (precedence && precedence > minPrecedence && (!noIn || token !== 80 /* InKeyword */)) { var operator = token; nextToken(); expr = makeBinaryExpression(expr, operator, parseBinaryOperators(parseUnaryExpression(), precedence, noIn)); @@ -3942,44 +4188,44 @@ var ts; } function getOperatorPrecedence() { switch (token) { - case 40 /* BarBarToken */: + case 44 /* BarBarToken */: return 1; - case 39 /* AmpersandAmpersandToken */: + case 43 /* AmpersandAmpersandToken */: return 2; - case 35 /* BarToken */: + case 39 /* BarToken */: return 3; - case 36 /* CaretToken */: + case 40 /* CaretToken */: return 4; - case 34 /* AmpersandToken */: + case 38 /* AmpersandToken */: return 5; - case 19 /* EqualsEqualsToken */: - case 20 /* ExclamationEqualsToken */: - case 21 /* EqualsEqualsEqualsToken */: - case 22 /* ExclamationEqualsEqualsToken */: + case 23 /* EqualsEqualsToken */: + case 24 /* ExclamationEqualsToken */: + case 25 /* EqualsEqualsEqualsToken */: + case 26 /* ExclamationEqualsEqualsToken */: return 6; - case 15 /* LessThanToken */: - case 16 /* GreaterThanToken */: - case 17 /* LessThanEqualsToken */: - case 18 /* GreaterThanEqualsToken */: - case 77 /* InstanceOfKeyword */: - case 76 /* InKeyword */: + case 19 /* LessThanToken */: + case 20 /* GreaterThanToken */: + case 21 /* LessThanEqualsToken */: + case 22 /* GreaterThanEqualsToken */: + case 81 /* InstanceOfKeyword */: + case 80 /* InKeyword */: return 7; - case 31 /* LessThanLessThanToken */: - case 32 /* GreaterThanGreaterThanToken */: - case 33 /* GreaterThanGreaterThanGreaterThanToken */: + case 35 /* LessThanLessThanToken */: + case 36 /* GreaterThanGreaterThanToken */: + case 37 /* GreaterThanGreaterThanGreaterThanToken */: return 8; - case 24 /* PlusToken */: - case 25 /* MinusToken */: + case 28 /* PlusToken */: + case 29 /* MinusToken */: return 9; - case 26 /* AsteriskToken */: - case 27 /* SlashToken */: - case 28 /* PercentToken */: + case 30 /* AsteriskToken */: + case 31 /* SlashToken */: + case 32 /* PercentToken */: return 10; } return undefined; } function makeBinaryExpression(left, operator, right) { - var node = createNode(140 /* BinaryExpression */, left.pos); + var node = createNode(145 /* BinaryExpression */, left.pos); node.left = left; node.operator = operator; node.right = right; @@ -3988,52 +4234,52 @@ var ts; function parseUnaryExpression() { var pos = getNodePos(); switch (token) { - case 24 /* PlusToken */: - case 25 /* MinusToken */: - case 38 /* TildeToken */: - case 37 /* ExclamationToken */: - case 64 /* DeleteKeyword */: - case 87 /* TypeOfKeyword */: - case 89 /* VoidKeyword */: - case 29 /* PlusPlusToken */: - case 30 /* MinusMinusToken */: + case 28 /* PlusToken */: + case 29 /* MinusToken */: + case 42 /* TildeToken */: + case 41 /* ExclamationToken */: + case 68 /* DeleteKeyword */: + case 91 /* TypeOfKeyword */: + case 93 /* VoidKeyword */: + case 33 /* PlusPlusToken */: + case 34 /* MinusMinusToken */: var operator = token; nextToken(); var operand = parseUnaryExpression(); if (isInStrictMode) { - if ((token === 29 /* PlusPlusToken */ || token === 30 /* MinusMinusToken */) && isEvalOrArgumentsIdentifier(operand)) { + if ((token === 33 /* PlusPlusToken */ || token === 34 /* MinusMinusToken */) && isEvalOrArgumentsIdentifier(operand)) { reportInvalidUseInStrictMode(operand); } - else if (token === 64 /* DeleteKeyword */ && operand.kind === 55 /* Identifier */) { + else if (token === 68 /* DeleteKeyword */ && operand.kind === 59 /* Identifier */) { grammarErrorOnNode(operand, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); } } - return makeUnaryExpression(138 /* PrefixOperator */, pos, operator, operand); - case 15 /* LessThanToken */: + return makeUnaryExpression(143 /* PrefixOperator */, pos, operator, operand); + case 19 /* LessThanToken */: return parseTypeAssertion(); } var primaryExpression = parsePrimaryExpression(); - var illegalUsageOfSuperKeyword = primaryExpression.kind === 81 /* SuperKeyword */ && token !== 7 /* OpenParenToken */ && token !== 11 /* DotToken */; + var illegalUsageOfSuperKeyword = primaryExpression.kind === 85 /* SuperKeyword */ && token !== 11 /* OpenParenToken */ && token !== 15 /* DotToken */; if (illegalUsageOfSuperKeyword) { error(ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); } var expr = parseCallAndAccess(primaryExpression, false); ts.Debug.assert(isLeftHandSideExpression(expr)); - if ((token === 29 /* PlusPlusToken */ || token === 30 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + if ((token === 33 /* PlusPlusToken */ || token === 34 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { if (isInStrictMode && isEvalOrArgumentsIdentifier(expr)) { reportInvalidUseInStrictMode(expr); } var operator = token; nextToken(); - expr = makeUnaryExpression(139 /* PostfixOperator */, expr.pos, operator, expr); + expr = makeUnaryExpression(144 /* PostfixOperator */, expr.pos, operator, expr); } return expr; } function parseTypeAssertion() { - var node = createNode(134 /* TypeAssertion */); - parseExpected(15 /* LessThanToken */); + var node = createNode(139 /* TypeAssertion */); + parseExpected(19 /* LessThanToken */); node.type = parseType(); - parseExpected(16 /* GreaterThanToken */); + parseExpected(20 /* GreaterThanToken */); node.operand = parseUnaryExpression(); return finishNode(node); } @@ -4045,44 +4291,52 @@ var ts; } function parseCallAndAccess(expr, inNewExpression) { while (true) { - if (parseOptional(11 /* DotToken */)) { - var propertyAccess = createNode(130 /* PropertyAccess */, expr.pos); + var dotStart = scanner.getTokenPos(); + if (parseOptional(15 /* DotToken */)) { + var propertyAccess = createNode(135 /* PropertyAccess */, expr.pos); + if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord() && lookAhead(function () { return scanner.isReservedWord(); })) { + grammarErrorAtPos(dotStart, scanner.getStartPos() - dotStart, ts.Diagnostics.Identifier_expected); + var id = createMissingNode(); + } + else { + var id = parseIdentifierName(); + } propertyAccess.left = expr; - propertyAccess.right = parseIdentifierName(); + propertyAccess.right = id; expr = finishNode(propertyAccess); continue; } var bracketStart = scanner.getTokenPos(); - if (parseOptional(9 /* OpenBracketToken */)) { - var indexedAccess = createNode(131 /* IndexedAccess */, expr.pos); + if (parseOptional(13 /* OpenBracketToken */)) { + var indexedAccess = createNode(136 /* IndexedAccess */, expr.pos); indexedAccess.object = expr; - if (inNewExpression && parseOptional(10 /* CloseBracketToken */)) { + if (inNewExpression && parseOptional(14 /* CloseBracketToken */)) { indexedAccess.index = createMissingNode(); grammarErrorAtPos(bracketStart, scanner.getStartPos() - bracketStart, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { indexedAccess.index = parseExpression(); - if (indexedAccess.index.kind === 3 /* StringLiteral */ || indexedAccess.index.kind === 2 /* NumericLiteral */) { + if (indexedAccess.index.kind === 7 /* StringLiteral */ || indexedAccess.index.kind === 6 /* NumericLiteral */) { var literal = indexedAccess.index; literal.text = internIdentifier(literal.text); } - parseExpected(10 /* CloseBracketToken */); + parseExpected(14 /* CloseBracketToken */); } expr = finishNode(indexedAccess); continue; } - if ((token === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */) && !inNewExpression) { - var callExpr = createNode(132 /* CallExpression */, expr.pos); + if ((token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) && !inNewExpression) { + var callExpr = createNode(137 /* CallExpression */, expr.pos); callExpr.func = expr; - if (token === 15 /* LessThanToken */) { + if (token === 19 /* LessThanToken */) { if (!(callExpr.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) return expr; } else { - parseExpected(7 /* OpenParenToken */); + parseExpected(11 /* OpenParenToken */); } callExpr.arguments = parseDelimitedList(10 /* ArgumentExpressions */, parseAssignmentExpression, 0 /* Disallow */); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); expr = finishNode(callExpr); continue; } @@ -4091,13 +4345,13 @@ var ts; } function parseTypeArgumentsAndOpenParen() { var result = parseTypeArguments(); - parseExpected(7 /* OpenParenToken */); + parseExpected(11 /* OpenParenToken */); return result; } function parseTypeArguments() { var typeArgumentListStart = scanner.getTokenPos(); var errorCountBeforeTypeParameterList = file.syntacticErrors.length; - var result = parseBracketedList(15 /* TypeArguments */, parseType, 15 /* LessThanToken */, 16 /* GreaterThanToken */); + var result = parseBracketedList(15 /* TypeArguments */, parseType, 19 /* LessThanToken */, 20 /* GreaterThanToken */); if (!result.length && file.syntacticErrors.length === errorCountBeforeTypeParameterList) { grammarErrorAtPos(typeArgumentListStart, scanner.getStartPos() - typeArgumentListStart, ts.Diagnostics.Type_argument_list_cannot_be_empty); } @@ -4105,28 +4359,28 @@ var ts; } function parsePrimaryExpression() { switch (token) { - case 83 /* ThisKeyword */: - case 81 /* SuperKeyword */: - case 79 /* NullKeyword */: - case 85 /* TrueKeyword */: - case 70 /* FalseKeyword */: + case 87 /* ThisKeyword */: + case 85 /* SuperKeyword */: + case 83 /* NullKeyword */: + case 89 /* TrueKeyword */: + case 74 /* FalseKeyword */: return parseTokenNode(); - case 2 /* NumericLiteral */: - case 3 /* StringLiteral */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: return parseLiteralNode(); - case 7 /* OpenParenToken */: + case 11 /* OpenParenToken */: return parseParenExpression(); - case 9 /* OpenBracketToken */: + case 13 /* OpenBracketToken */: return parseArrayLiteral(); - case 5 /* OpenBraceToken */: + case 9 /* OpenBraceToken */: return parseObjectLiteral(); - case 73 /* FunctionKeyword */: + case 77 /* FunctionKeyword */: return parseFunctionExpression(); - case 78 /* NewKeyword */: + case 82 /* NewKeyword */: return parseNewExpression(); - case 27 /* SlashToken */: - case 47 /* SlashEqualsToken */: - if (reScanSlashToken() === 4 /* RegularExpressionLiteral */) { + case 31 /* SlashToken */: + case 51 /* SlashEqualsToken */: + if (reScanSlashToken() === 8 /* RegularExpressionLiteral */) { return parseLiteralNode(); } break; @@ -4139,34 +4393,34 @@ var ts; return createMissingNode(); } function parseParenExpression() { - var node = createNode(135 /* ParenExpression */); - parseExpected(7 /* OpenParenToken */); + var node = createNode(140 /* ParenExpression */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); return finishNode(node); } function parseArrayLiteralElement() { - return token === 14 /* CommaToken */ ? createNode(142 /* OmittedExpression */) : parseAssignmentExpression(); + return token === 18 /* CommaToken */ ? createNode(147 /* OmittedExpression */) : parseAssignmentExpression(); } function parseArrayLiteral() { - var node = createNode(127 /* ArrayLiteral */); - parseExpected(9 /* OpenBracketToken */); + var node = createNode(132 /* ArrayLiteral */); + parseExpected(13 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) - node.flags |= 128 /* MultiLine */; + node.flags |= 256 /* MultiLine */; node.elements = parseDelimitedList(12 /* ArrayLiteralMembers */, parseArrayLiteralElement, 2 /* Preserve */); - parseExpected(10 /* CloseBracketToken */); + parseExpected(14 /* CloseBracketToken */); return finishNode(node); } function parsePropertyAssignment() { - var node = createNode(129 /* PropertyAssignment */); + var node = createNode(134 /* PropertyAssignment */); node.name = parsePropertyName(); - if (token === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */) { - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); var body = parseBody(false); - node.initializer = makeFunctionExpression(136 /* FunctionExpression */, node.pos, undefined, sig, body); + node.initializer = makeFunctionExpression(141 /* FunctionExpression */, node.pos, undefined, sig, body); } else { - parseExpected(42 /* ColonToken */); + parseExpected(46 /* ColonToken */); node.initializer = parseAssignmentExpression(false); } return finishNode(node); @@ -4174,38 +4428,38 @@ var ts; function parseObjectLiteralMember() { var initialPos = getNodePos(); var initialToken = token; - if (parseContextualModifier(105 /* GetKeyword */) || parseContextualModifier(109 /* SetKeyword */)) { - var kind = initialToken === 105 /* GetKeyword */ ? 118 /* GetAccessor */ : 119 /* SetAccessor */; + if (parseContextualModifier(109 /* GetKeyword */) || parseContextualModifier(113 /* SetKeyword */)) { + var kind = initialToken === 109 /* GetKeyword */ ? 122 /* GetAccessor */ : 123 /* SetAccessor */; return parseAndCheckMemberAccessorDeclaration(kind, initialPos, 0); } return parsePropertyAssignment(); } function parseObjectLiteral() { - var node = createNode(128 /* ObjectLiteral */); - parseExpected(5 /* OpenBraceToken */); + var node = createNode(133 /* ObjectLiteral */); + parseExpected(9 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 128 /* MultiLine */; + node.flags |= 256 /* MultiLine */; } var trailingCommaBehavior = languageVersion === 0 /* ES3 */ ? 1 /* Allow */ : 2 /* Preserve */; node.properties = parseDelimitedList(11 /* ObjectLiteralMembers */, parseObjectLiteralMember, trailingCommaBehavior); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); var seen = {}; var Property = 1; var GetAccessor = 2; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; ts.forEach(node.properties, function (p) { - if (p.kind === 142 /* OmittedExpression */) { + if (p.kind === 147 /* OmittedExpression */) { return; } var currentKind; - if (p.kind === 129 /* PropertyAssignment */) { + if (p.kind === 134 /* PropertyAssignment */) { currentKind = Property; } - else if (p.kind === 118 /* GetAccessor */) { + else if (p.kind === 122 /* GetAccessor */) { currentKind = GetAccessor; } - else if (p.kind === 119 /* SetAccessor */) { + else if (p.kind === 123 /* SetAccessor */) { currentKind = SetAccesor; } else { @@ -4238,14 +4492,14 @@ var ts; } function parseFunctionExpression() { var pos = getNodePos(); - parseExpected(73 /* FunctionKeyword */); + parseExpected(77 /* FunctionKeyword */); var name = isIdentifier() ? parseIdentifier() : undefined; - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); var body = parseBody(false); if (name && isInStrictMode && isEvalOrArgumentsIdentifier(name)) { reportInvalidUseInStrictMode(name); } - return makeFunctionExpression(136 /* FunctionExpression */, pos, name, sig, body); + return makeFunctionExpression(141 /* FunctionExpression */, pos, name, sig, body); } function makeFunctionExpression(kind, pos, name, sig, body) { var node = createNode(kind, pos); @@ -4257,20 +4511,20 @@ var ts; return finishNode(node); } function parseNewExpression() { - var node = createNode(133 /* NewExpression */); - parseExpected(78 /* NewKeyword */); + var node = createNode(138 /* NewExpression */); + parseExpected(82 /* NewKeyword */); node.func = parseCallAndAccess(parsePrimaryExpression(), true); - if (parseOptional(7 /* OpenParenToken */) || token === 15 /* LessThanToken */ && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { + if (parseOptional(11 /* OpenParenToken */) || token === 19 /* LessThanToken */ && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { node.arguments = parseDelimitedList(10 /* ArgumentExpressions */, parseAssignmentExpression, 0 /* Disallow */); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); } return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode) { - var node = createNode(143 /* Block */); - if (parseExpected(5 /* OpenBraceToken */) || ignoreMissingOpenBrace) { + var node = createNode(148 /* Block */); + if (parseExpected(9 /* OpenBraceToken */) || ignoreMissingOpenBrace) { node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatement); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -4290,7 +4544,7 @@ var ts; } labelledStatementInfo.pushFunctionBoundary(); var block = parseBlock(ignoreMissingOpenBrace, true); - block.kind = 168 /* FunctionBlock */; + block.kind = 173 /* FunctionBlock */; labelledStatementInfo.pop(); inFunctionBody = saveInFunctionBody; inSwitchStatement = saveInSwitchStatement; @@ -4298,40 +4552,40 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(145 /* EmptyStatement */); - parseExpected(13 /* SemicolonToken */); + var node = createNode(150 /* EmptyStatement */); + parseExpected(17 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(147 /* IfStatement */); - parseExpected(74 /* IfKeyword */); - parseExpected(7 /* OpenParenToken */); + var node = createNode(152 /* IfStatement */); + parseExpected(78 /* IfKeyword */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(66 /* ElseKeyword */) ? parseStatement() : undefined; + node.elseStatement = parseOptional(70 /* ElseKeyword */) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(148 /* DoStatement */); - parseExpected(65 /* DoKeyword */); + var node = createNode(153 /* DoStatement */); + parseExpected(69 /* DoKeyword */); var saveInIterationStatement = inIterationStatement; inIterationStatement = 1 /* Nested */; node.statement = parseStatement(); inIterationStatement = saveInIterationStatement; - parseExpected(90 /* WhileKeyword */); - parseExpected(7 /* OpenParenToken */); + parseExpected(94 /* WhileKeyword */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); - parseOptional(13 /* SemicolonToken */); + parseExpected(12 /* CloseParenToken */); + parseOptional(17 /* SemicolonToken */); return finishNode(node); } function parseWhileStatement() { - var node = createNode(149 /* WhileStatement */); - parseExpected(90 /* WhileKeyword */); - parseExpected(7 /* OpenParenToken */); + var node = createNode(154 /* WhileStatement */); + parseExpected(94 /* WhileKeyword */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); var saveInIterationStatement = inIterationStatement; inIterationStatement = 1 /* Nested */; node.statement = parseStatement(); @@ -4340,10 +4594,10 @@ var ts; } function parseForOrForInStatement() { var pos = getNodePos(); - parseExpected(72 /* ForKeyword */); - parseExpected(7 /* OpenParenToken */); - if (token !== 13 /* SemicolonToken */) { - if (parseOptional(88 /* VarKeyword */)) { + parseExpected(76 /* ForKeyword */); + parseExpected(11 /* OpenParenToken */); + if (token !== 17 /* SemicolonToken */) { + if (parseOptional(92 /* VarKeyword */)) { var declarations = parseVariableDeclarationList(0, true); if (!declarations.length) { error(ts.Diagnostics.Variable_declaration_list_cannot_be_empty); @@ -4354,8 +4608,8 @@ var ts; } } var forOrForInStatement; - if (parseOptional(76 /* InKeyword */)) { - var forInStatement = createNode(151 /* ForInStatement */, pos); + if (parseOptional(80 /* InKeyword */)) { + var forInStatement = createNode(156 /* ForInStatement */, pos); if (declarations) { if (declarations.length > 1) { error(ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); @@ -4366,24 +4620,24 @@ var ts; forInStatement.variable = varOrInit; } forInStatement.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); forOrForInStatement = forInStatement; } else { - var forStatement = createNode(150 /* ForStatement */, pos); + var forStatement = createNode(155 /* ForStatement */, pos); if (declarations) forStatement.declarations = declarations; if (varOrInit) forStatement.initializer = varOrInit; - parseExpected(13 /* SemicolonToken */); - if (token !== 13 /* SemicolonToken */ && token !== 8 /* CloseParenToken */) { + parseExpected(17 /* SemicolonToken */); + if (token !== 17 /* SemicolonToken */ && token !== 12 /* CloseParenToken */) { forStatement.condition = parseExpression(); } - parseExpected(13 /* SemicolonToken */); - if (token !== 8 /* CloseParenToken */) { + parseExpected(17 /* SemicolonToken */); + if (token !== 12 /* CloseParenToken */) { forStatement.iterator = parseExpression(); } - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); forOrForInStatement = forStatement; } var saveInIterationStatement = inIterationStatement; @@ -4395,7 +4649,7 @@ var ts; function parseBreakOrContinueStatement(kind) { var node = createNode(kind); var errorCountBeforeStatement = file.syntacticErrors.length; - parseExpected(kind === 153 /* BreakStatement */ ? 56 /* BreakKeyword */ : 61 /* ContinueKeyword */); + parseExpected(kind === 158 /* BreakStatement */ ? 60 /* BreakKeyword */ : 65 /* ContinueKeyword */); if (!canParseSemicolon()) node.label = parseIdentifier(); parseSemicolon(); @@ -4411,7 +4665,7 @@ var ts; return node; } function checkBareBreakOrContinueStatement(node) { - if (node.kind === 153 /* BreakStatement */) { + if (node.kind === 158 /* BreakStatement */) { if (inIterationStatement === 1 /* Nested */ || inSwitchStatement === 1 /* Nested */) { return; } @@ -4420,7 +4674,7 @@ var ts; return; } } - else if (node.kind === 152 /* ContinueStatement */) { + else if (node.kind === 157 /* ContinueStatement */) { if (inIterationStatement === 1 /* Nested */) { return; } @@ -4436,7 +4690,7 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } function checkBreakOrContinueStatementWithLabel(node) { - var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 152 /* ContinueStatement */, false); + var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 157 /* ContinueStatement */, false); if (nodeIsNestedInLabel === 1 /* Nested */) { return; } @@ -4444,10 +4698,10 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); return; } - if (node.kind === 152 /* ContinueStatement */) { + if (node.kind === 157 /* ContinueStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } - else if (node.kind === 153 /* BreakStatement */) { + else if (node.kind === 158 /* BreakStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement); } else { @@ -4455,11 +4709,11 @@ var ts; } } function parseReturnStatement() { - var node = createNode(154 /* ReturnStatement */); + var node = createNode(159 /* ReturnStatement */); var errorCountBeforeReturnStatement = file.syntacticErrors.length; var returnTokenStart = scanner.getTokenPos(); var returnTokenLength = scanner.getTextPos() - returnTokenStart; - parseExpected(80 /* ReturnKeyword */); + parseExpected(84 /* ReturnKeyword */); if (!canParseSemicolon()) node.expression = parseExpression(); parseSemicolon(); @@ -4469,13 +4723,13 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(155 /* WithStatement */); + var node = createNode(160 /* WithStatement */); var startPos = scanner.getTokenPos(); - parseExpected(91 /* WithKeyword */); + parseExpected(95 /* WithKeyword */); var endPos = scanner.getStartPos(); - parseExpected(7 /* OpenParenToken */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); node.statement = parseStatement(); node = finishNode(node); if (isInStrictMode) { @@ -4484,36 +4738,36 @@ var ts; return node; } function parseCaseClause() { - var node = createNode(157 /* CaseClause */); - parseExpected(57 /* CaseKeyword */); + var node = createNode(162 /* CaseClause */); + parseExpected(61 /* CaseKeyword */); node.expression = parseExpression(); - parseExpected(42 /* ColonToken */); + parseExpected(46 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(158 /* DefaultClause */); - parseExpected(63 /* DefaultKeyword */); - parseExpected(42 /* ColonToken */); + var node = createNode(163 /* DefaultClause */); + parseExpected(67 /* DefaultKeyword */); + parseExpected(46 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 57 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token === 61 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(156 /* SwitchStatement */); - parseExpected(82 /* SwitchKeyword */); - parseExpected(7 /* OpenParenToken */); + var node = createNode(161 /* SwitchStatement */); + parseExpected(86 /* SwitchKeyword */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); - parseExpected(5 /* OpenBraceToken */); + parseExpected(12 /* CloseParenToken */); + parseExpected(9 /* OpenBraceToken */); var saveInSwitchStatement = inSwitchStatement; inSwitchStatement = 1 /* Nested */; node.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); inSwitchStatement = saveInSwitchStatement; - parseExpected(6 /* CloseBraceToken */); - var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 158 /* DefaultClause */; }); + parseExpected(10 /* CloseBraceToken */); + var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 163 /* DefaultClause */; }); for (var i = 1, n = defaultClauses.length; i < n; i++) { var clause = defaultClauses[i]; var start = ts.skipTrivia(file.text, clause.pos); @@ -4523,8 +4777,8 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(160 /* ThrowStatement */); - parseExpected(84 /* ThrowKeyword */); + var node = createNode(165 /* ThrowStatement */); + parseExpected(88 /* ThrowKeyword */); if (scanner.hasPrecedingLineBreak()) { error(ts.Diagnostics.Line_break_not_permitted_here); } @@ -4533,13 +4787,13 @@ var ts; return finishNode(node); } function parseTryStatement() { - var node = createNode(161 /* TryStatement */); - node.tryBlock = parseTokenAndBlock(86 /* TryKeyword */, 162 /* TryBlock */); - if (token === 58 /* CatchKeyword */) { + var node = createNode(166 /* TryStatement */); + node.tryBlock = parseTokenAndBlock(90 /* TryKeyword */, 167 /* TryBlock */); + if (token === 62 /* CatchKeyword */) { node.catchBlock = parseCatchBlock(); } - if (token === 71 /* FinallyKeyword */) { - node.finallyBlock = parseTokenAndBlock(71 /* FinallyKeyword */, 164 /* FinallyBlock */); + if (token === 75 /* FinallyKeyword */) { + node.finallyBlock = parseTokenAndBlock(75 /* FinallyKeyword */, 169 /* FinallyBlock */); } if (!(node.catchBlock || node.finallyBlock)) { error(ts.Diagnostics.catch_or_finally_expected); @@ -4556,15 +4810,15 @@ var ts; } function parseCatchBlock() { var pos = getNodePos(); - parseExpected(58 /* CatchKeyword */); - parseExpected(7 /* OpenParenToken */); + parseExpected(62 /* CatchKeyword */); + parseExpected(11 /* OpenParenToken */); var variable = parseIdentifier(); var typeAnnotationColonStart = scanner.getTokenPos(); var typeAnnotationColonLength = scanner.getTextPos() - typeAnnotationColonStart; var typeAnnotation = parseTypeAnnotation(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); var result = parseBlock(false, false); - result.kind = 163 /* CatchBlock */; + result.kind = 168 /* CatchBlock */; result.pos = pos; result.variable = variable; if (typeAnnotation) { @@ -4576,13 +4830,13 @@ var ts; return result; } function parseDebuggerStatement() { - var node = createNode(165 /* DebuggerStatement */); - parseExpected(62 /* DebuggerKeyword */); + var node = createNode(170 /* DebuggerStatement */); + parseExpected(66 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); } function isIterationStatementStart() { - return token === 90 /* WhileKeyword */ || token === 65 /* DoKeyword */ || token === 72 /* ForKeyword */; + return token === 94 /* WhileKeyword */ || token === 69 /* DoKeyword */ || token === 76 /* ForKeyword */; } function parseStatementWithLabelSet() { labelledStatementInfo.pushCurrentLabelSet(isIterationStatementStart()); @@ -4591,12 +4845,12 @@ var ts; return statement; } function isLabel() { - return isIdentifier() && lookAhead(function () { return nextToken() === 42 /* ColonToken */; }); + return isIdentifier() && lookAhead(function () { return nextToken() === 46 /* ColonToken */; }); } function parseLabelledStatement() { - var node = createNode(159 /* LabelledStatement */); + var node = createNode(164 /* LabeledStatement */); node.label = parseIdentifier(); - parseExpected(42 /* ColonToken */); + parseExpected(46 /* ColonToken */); if (labelledStatementInfo.nodeIsNestedInLabel(node.label, false, true)) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, getSourceTextOfNodeFromSourceText(sourceText, node.label)); } @@ -4605,44 +4859,45 @@ var ts; return finishNode(node); } function parseExpressionStatement() { - var node = createNode(146 /* ExpressionStatement */); + var node = createNode(151 /* ExpressionStatement */); node.expression = parseExpression(); parseSemicolon(); return finishNode(node); } function isStatement(inErrorRecovery) { switch (token) { - case 13 /* SemicolonToken */: + case 17 /* SemicolonToken */: return !inErrorRecovery; - case 5 /* OpenBraceToken */: - case 88 /* VarKeyword */: - case 73 /* FunctionKeyword */: - case 74 /* IfKeyword */: - case 65 /* DoKeyword */: - case 90 /* WhileKeyword */: - case 72 /* ForKeyword */: - case 61 /* ContinueKeyword */: - case 56 /* BreakKeyword */: - case 80 /* ReturnKeyword */: - case 91 /* WithKeyword */: - case 82 /* SwitchKeyword */: - case 84 /* ThrowKeyword */: - case 86 /* TryKeyword */: - case 62 /* DebuggerKeyword */: - case 58 /* CatchKeyword */: - case 71 /* FinallyKeyword */: + case 9 /* OpenBraceToken */: + case 92 /* VarKeyword */: + case 77 /* FunctionKeyword */: + case 78 /* IfKeyword */: + case 69 /* DoKeyword */: + case 94 /* WhileKeyword */: + case 76 /* ForKeyword */: + case 65 /* ContinueKeyword */: + case 60 /* BreakKeyword */: + case 84 /* ReturnKeyword */: + case 95 /* WithKeyword */: + case 86 /* SwitchKeyword */: + case 88 /* ThrowKeyword */: + case 90 /* TryKeyword */: + case 66 /* DebuggerKeyword */: + case 62 /* CatchKeyword */: + case 75 /* FinallyKeyword */: return true; - case 93 /* InterfaceKeyword */: - case 59 /* ClassKeyword */: - case 106 /* ModuleKeyword */: - case 67 /* EnumKeyword */: + case 97 /* InterfaceKeyword */: + case 63 /* ClassKeyword */: + case 110 /* ModuleKeyword */: + case 71 /* EnumKeyword */: if (isDeclaration()) { return false; } - case 98 /* PublicKeyword */: - case 96 /* PrivateKeyword */: - case 99 /* StaticKeyword */: - if (lookAhead(function () { return nextToken() >= 55 /* Identifier */; })) { + case 102 /* PublicKeyword */: + case 100 /* PrivateKeyword */: + case 101 /* ProtectedKeyword */: + case 103 /* StaticKeyword */: + if (lookAhead(function () { return nextToken() >= 59 /* Identifier */; })) { return false; } default: @@ -4651,39 +4906,39 @@ var ts; } function parseStatement() { switch (token) { - case 5 /* OpenBraceToken */: + case 9 /* OpenBraceToken */: return parseBlock(false, false); - case 88 /* VarKeyword */: + case 92 /* VarKeyword */: return parseVariableStatement(); - case 73 /* FunctionKeyword */: + case 77 /* FunctionKeyword */: return parseFunctionDeclaration(); - case 13 /* SemicolonToken */: + case 17 /* SemicolonToken */: return parseEmptyStatement(); - case 74 /* IfKeyword */: + case 78 /* IfKeyword */: return parseIfStatement(); - case 65 /* DoKeyword */: + case 69 /* DoKeyword */: return parseDoStatement(); - case 90 /* WhileKeyword */: + case 94 /* WhileKeyword */: return parseWhileStatement(); - case 72 /* ForKeyword */: + case 76 /* ForKeyword */: return parseForOrForInStatement(); - case 61 /* ContinueKeyword */: - return parseBreakOrContinueStatement(152 /* ContinueStatement */); - case 56 /* BreakKeyword */: - return parseBreakOrContinueStatement(153 /* BreakStatement */); - case 80 /* ReturnKeyword */: + case 65 /* ContinueKeyword */: + return parseBreakOrContinueStatement(157 /* ContinueStatement */); + case 60 /* BreakKeyword */: + return parseBreakOrContinueStatement(158 /* BreakStatement */); + case 84 /* ReturnKeyword */: return parseReturnStatement(); - case 91 /* WithKeyword */: + case 95 /* WithKeyword */: return parseWithStatement(); - case 82 /* SwitchKeyword */: + case 86 /* SwitchKeyword */: return parseSwitchStatement(); - case 84 /* ThrowKeyword */: + case 88 /* ThrowKeyword */: return parseThrowStatement(); - case 86 /* TryKeyword */: - case 58 /* CatchKeyword */: - case 71 /* FinallyKeyword */: + case 90 /* TryKeyword */: + case 62 /* CatchKeyword */: + case 75 /* FinallyKeyword */: return parseTryStatement(); - case 62 /* DebuggerKeyword */: + case 66 /* DebuggerKeyword */: return parseDebuggerStatement(); default: if (isLabel()) { @@ -4693,12 +4948,12 @@ var ts; } } function parseStatementOrFunction() { - return token === 73 /* FunctionKeyword */ ? parseFunctionDeclaration() : parseStatement(); + return token === 77 /* FunctionKeyword */ ? parseFunctionDeclaration() : parseStatement(); } function parseAndCheckFunctionBody(isConstructor) { var initialPosition = scanner.getTokenPos(); var errorCountBeforeBody = file.syntacticErrors.length; - if (token === 5 /* OpenBraceToken */) { + if (token === 9 /* OpenBraceToken */) { var body = parseBody(false); if (body && inAmbientContext && file.syntacticErrors.length === errorCountBeforeBody) { var diagnostic = isConstructor ? ts.Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context : ts.Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context; @@ -4713,7 +4968,7 @@ var ts; error(ts.Diagnostics.Block_or_expected); } function parseVariableDeclaration(flags, noIn) { - var node = createNode(166 /* VariableDeclaration */); + var node = createNode(171 /* VariableDeclaration */); node.flags = flags; var errorCountBeforeVariableDeclaration = file.syntacticErrors.length; node.name = parseIdentifier(); @@ -4733,11 +4988,11 @@ var ts; return parseDelimitedList(9 /* VariableDeclarations */, function () { return parseVariableDeclaration(flags, noIn); }, 0 /* Disallow */); } function parseVariableStatement(pos, flags) { - var node = createNode(144 /* VariableStatement */, pos); + var node = createNode(149 /* VariableStatement */, pos); if (flags) node.flags = flags; var errorCountBeforeVarStatement = file.syntacticErrors.length; - parseExpected(88 /* VarKeyword */); + parseExpected(92 /* VarKeyword */); node.declarations = parseVariableDeclarationList(flags, false); parseSemicolon(); finishNode(node); @@ -4747,12 +5002,12 @@ var ts; return node; } function parseFunctionDeclaration(pos, flags) { - var node = createNode(167 /* FunctionDeclaration */, pos); + var node = createNode(172 /* FunctionDeclaration */, pos); if (flags) node.flags = flags; - parseExpected(73 /* FunctionKeyword */); + parseExpected(77 /* FunctionKeyword */); node.name = parseIdentifier(); - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -4763,10 +5018,10 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, flags) { - var node = createNode(117 /* Constructor */, pos); + var node = createNode(121 /* Constructor */, pos); node.flags = flags; - parseExpected(103 /* ConstructorKeyword */); - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + parseExpected(107 /* ConstructorKeyword */); + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -4783,14 +5038,14 @@ var ts; var errorCountBeforePropertyDeclaration = file.syntacticErrors.length; var name = parsePropertyName(); var questionStart = scanner.getTokenPos(); - if (parseOptional(41 /* QuestionToken */)) { + if (parseOptional(45 /* QuestionToken */)) { errorAtPos(questionStart, scanner.getStartPos() - questionStart, ts.Diagnostics.A_class_member_cannot_be_declared_optional); } - if (token === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */) { - var method = createNode(116 /* Method */, pos); + if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { + var method = createNode(120 /* Method */, pos); method.flags = flags; method.name = name; - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); method.typeParameters = sig.typeParameters; method.parameters = sig.parameters; method.type = sig.type; @@ -4798,7 +5053,7 @@ var ts; return finishNode(method); } else { - var property = createNode(115 /* Property */, pos); + var property = createNode(119 /* Property */, pos); property.flags = flags; property.name = name; property.type = parseTypeAnnotation(); @@ -4825,10 +5080,10 @@ var ts; else if (accessor.typeParameters) { grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 118 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 122 /* GetAccessor */ && accessor.parameters.length) { grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 119 /* SetAccessor */) { + else if (kind === 123 /* SetAccessor */) { if (accessor.type) { grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -4858,7 +5113,7 @@ var ts; var node = createNode(kind, pos); node.flags = flags; node.name = parsePropertyName(); - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -4881,19 +5136,19 @@ var ts; idToken = token; nextToken(); } - if (token === 9 /* OpenBracketToken */) { + if (token === 13 /* OpenBracketToken */) { return true; } if (idToken !== undefined) { - if (!isKeyword(idToken) || idToken === 109 /* SetKeyword */ || idToken === 105 /* GetKeyword */) { + if (!isKeyword(idToken) || idToken === 113 /* SetKeyword */ || idToken === 109 /* GetKeyword */) { return true; } switch (token) { - case 7 /* OpenParenToken */: - case 15 /* LessThanToken */: - case 42 /* ColonToken */: - case 43 /* EqualsToken */: - case 41 /* QuestionToken */: + case 11 /* OpenParenToken */: + case 19 /* LessThanToken */: + case 46 /* ColonToken */: + case 47 /* EqualsToken */: + case 45 /* QuestionToken */: return true; default: return canParseSemicolon(); @@ -4909,6 +5164,8 @@ var ts; var lastDeclareModifierLength; var lastPrivateModifierStart; var lastPrivateModifierLength; + var lastProtectedModifierStart; + var lastProtectedModifierLength; while (true) { var modifierStart = scanner.getTokenPos(); var modifierToken = token; @@ -4916,11 +5173,11 @@ var ts; break; var modifierLength = scanner.getStartPos() - modifierStart; switch (modifierToken) { - case 98 /* PublicKeyword */: - if (flags & 32 /* Private */ || flags & 16 /* Public */) { + case 102 /* PublicKeyword */: + if (flags & ts.NodeFlags.AccessibilityModifier) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 64 /* Static */) { + else if (flags & 128 /* Static */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_must_precede_1_modifier, "public", "static"); } else if (context === 1 /* ModuleElements */ || context === 0 /* SourceElements */) { @@ -4928,11 +5185,11 @@ var ts; } flags |= 16 /* Public */; break; - case 96 /* PrivateKeyword */: - if (flags & 32 /* Private */ || flags & 16 /* Public */) { + case 100 /* PrivateKeyword */: + if (flags & ts.NodeFlags.AccessibilityModifier) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 64 /* Static */) { + else if (flags & 128 /* Static */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_must_precede_1_modifier, "private", "static"); } else if (context === 1 /* ModuleElements */ || context === 0 /* SourceElements */) { @@ -4942,8 +5199,22 @@ var ts; lastPrivateModifierLength = modifierLength; flags |= 32 /* Private */; break; - case 99 /* StaticKeyword */: - if (flags & 64 /* Static */) { + case 101 /* ProtectedKeyword */: + if (flags & 16 /* Public */ || flags & 32 /* Private */ || flags & 64 /* Protected */) { + grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); + } + else if (flags & 128 /* Static */) { + grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_must_precede_1_modifier, "protected", "static"); + } + else if (context === 1 /* ModuleElements */ || context === 0 /* SourceElements */) { + grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "protected"); + } + lastProtectedModifierStart = modifierStart; + lastProtectedModifierLength = modifierLength; + flags |= 64 /* Protected */; + break; + case 103 /* StaticKeyword */: + if (flags & 128 /* Static */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (context === 1 /* ModuleElements */ || context === 0 /* SourceElements */) { @@ -4954,9 +5225,9 @@ var ts; } lastStaticModifierStart = modifierStart; lastStaticModifierLength = modifierLength; - flags |= 64 /* Static */; + flags |= 128 /* Static */; break; - case 68 /* ExportKeyword */: + case 72 /* ExportKeyword */: if (flags & 1 /* Export */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -4971,7 +5242,7 @@ var ts; } flags |= 1 /* Export */; break; - case 104 /* DeclareKeyword */: + case 108 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "declare"); } @@ -4990,23 +5261,26 @@ var ts; break; } } - if (token === 103 /* ConstructorKeyword */ && flags & 64 /* Static */) { + if (token === 107 /* ConstructorKeyword */ && flags & 128 /* Static */) { grammarErrorAtPos(lastStaticModifierStart, lastStaticModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } - else if (token === 103 /* ConstructorKeyword */ && flags & 32 /* Private */) { + else if (token === 107 /* ConstructorKeyword */ && flags & 32 /* Private */) { grammarErrorAtPos(lastPrivateModifierStart, lastPrivateModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } - else if (token === 75 /* ImportKeyword */) { + else if (token === 107 /* ConstructorKeyword */ && flags & 64 /* Protected */) { + grammarErrorAtPos(lastProtectedModifierStart, lastProtectedModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); + } + else if (token === 79 /* ImportKeyword */) { if (flags & 2 /* Ambient */) { grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } } - else if (token === 93 /* InterfaceKeyword */) { + else if (token === 97 /* InterfaceKeyword */) { if (flags & 2 /* Ambient */) { grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } } - else if (token !== 68 /* ExportKeyword */ && !(flags & 2 /* Ambient */) && inAmbientContext && context === 0 /* SourceElements */) { + else if (token !== 72 /* ExportKeyword */ && !(flags & 2 /* Ambient */) && inAmbientContext && context === 0 /* SourceElements */) { var declarationStart = scanner.getTokenPos(); var declarationFirstTokenLength = scanner.getTextPos() - declarationStart; grammarErrorAtPos(declarationStart, declarationFirstTokenLength, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -5016,19 +5290,19 @@ var ts; function parseClassMemberDeclaration() { var pos = getNodePos(); var flags = parseAndCheckModifiers(2 /* ClassMembers */); - if (parseContextualModifier(105 /* GetKeyword */)) { - return parseAndCheckMemberAccessorDeclaration(118 /* GetAccessor */, pos, flags); + if (parseContextualModifier(109 /* GetKeyword */)) { + return parseAndCheckMemberAccessorDeclaration(122 /* GetAccessor */, pos, flags); } - if (parseContextualModifier(109 /* SetKeyword */)) { - return parseAndCheckMemberAccessorDeclaration(119 /* SetAccessor */, pos, flags); + if (parseContextualModifier(113 /* SetKeyword */)) { + return parseAndCheckMemberAccessorDeclaration(123 /* SetAccessor */, pos, flags); } - if (token === 103 /* ConstructorKeyword */) { + if (token === 107 /* ConstructorKeyword */) { return parseConstructorDeclaration(pos, flags); } - if (token >= 55 /* Identifier */ || token === 3 /* StringLiteral */ || token === 2 /* NumericLiteral */) { + if (token >= 59 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { return parsePropertyMemberDeclaration(pos, flags); } - if (token === 9 /* OpenBracketToken */) { + if (token === 13 /* OpenBracketToken */) { if (flags) { var start = getTokenPos(pos); var length = getNodePos() - start; @@ -5039,23 +5313,23 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassDeclaration(pos, flags) { - var node = createNode(169 /* ClassDeclaration */, pos); + var node = createNode(174 /* ClassDeclaration */, pos); node.flags = flags; var errorCountBeforeClassDeclaration = file.syntacticErrors.length; - parseExpected(59 /* ClassKeyword */); + parseExpected(63 /* ClassKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - node.baseType = parseOptional(69 /* ExtendsKeyword */) ? parseTypeReference() : undefined; + node.baseType = parseOptional(73 /* ExtendsKeyword */) ? parseTypeReference() : undefined; var implementsKeywordStart = scanner.getTokenPos(); var implementsKeywordLength; - if (parseOptional(92 /* ImplementsKeyword */)) { + if (parseOptional(96 /* ImplementsKeyword */)) { implementsKeywordLength = scanner.getStartPos() - implementsKeywordStart; node.implementedTypes = parseDelimitedList(8 /* BaseTypeReferences */, parseTypeReference, 0 /* Disallow */); } var errorCountBeforeClassBody = file.syntacticErrors.length; - if (parseExpected(5 /* OpenBraceToken */)) { + if (parseExpected(9 /* OpenBraceToken */)) { node.members = parseList(6 /* ClassMembers */, false, parseClassMemberDeclaration); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -5066,15 +5340,15 @@ var ts; return finishNode(node); } function parseInterfaceDeclaration(pos, flags) { - var node = createNode(170 /* InterfaceDeclaration */, pos); + var node = createNode(175 /* InterfaceDeclaration */, pos); node.flags = flags; var errorCountBeforeInterfaceDeclaration = file.syntacticErrors.length; - parseExpected(93 /* InterfaceKeyword */); + parseExpected(97 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); var extendsKeywordStart = scanner.getTokenPos(); var extendsKeywordLength; - if (parseOptional(69 /* ExtendsKeyword */)) { + if (parseOptional(73 /* ExtendsKeyword */)) { extendsKeywordLength = scanner.getStartPos() - extendsKeywordStart; node.baseTypes = parseDelimitedList(8 /* BaseTypeReferences */, parseTypeReference, 0 /* Disallow */); } @@ -5090,20 +5364,20 @@ var ts; function isInteger(literalExpression) { return /^[0-9]+([eE]\+?[0-9]+)?$/.test(literalExpression.text); } - if (expression.kind === 138 /* PrefixOperator */) { + if (expression.kind === 143 /* PrefixOperator */) { var unaryExpression = expression; - if (unaryExpression.operator === 24 /* PlusToken */ || unaryExpression.operator === 25 /* MinusToken */) { + if (unaryExpression.operator === 28 /* PlusToken */ || unaryExpression.operator === 29 /* MinusToken */) { expression = unaryExpression.operand; } } - if (expression.kind === 2 /* NumericLiteral */) { + if (expression.kind === 6 /* NumericLiteral */) { return isInteger(expression); } return false; } var inConstantEnumMemberSection = true; function parseAndCheckEnumMember() { - var node = createNode(176 /* EnumMember */); + var node = createNode(181 /* EnumMember */); var errorCountBeforeEnumMember = file.syntacticErrors.length; node.name = parsePropertyName(); node.initializer = parseInitializer(false); @@ -5120,13 +5394,13 @@ var ts; } return finishNode(node); } - var node = createNode(171 /* EnumDeclaration */, pos); + var node = createNode(176 /* EnumDeclaration */, pos); node.flags = flags; - parseExpected(67 /* EnumKeyword */); + parseExpected(71 /* EnumKeyword */); node.name = parseIdentifier(); - if (parseExpected(5 /* OpenBraceToken */)) { + if (parseExpected(9 /* OpenBraceToken */)) { node.members = parseDelimitedList(7 /* EnumMembers */, parseAndCheckEnumMember, 1 /* Allow */); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -5134,10 +5408,10 @@ var ts; return finishNode(node); } function parseModuleBody() { - var node = createNode(173 /* ModuleBlock */); - if (parseExpected(5 /* OpenBraceToken */)) { + var node = createNode(178 /* ModuleBlock */); + if (parseExpected(9 /* OpenBraceToken */)) { node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -5145,19 +5419,19 @@ var ts; return finishNode(node); } function parseInternalModuleTail(pos, flags) { - var node = createNode(172 /* ModuleDeclaration */, pos); + var node = createNode(177 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseIdentifier(); - if (parseOptional(11 /* DotToken */)) { + if (parseOptional(15 /* DotToken */)) { node.body = parseInternalModuleTail(getNodePos(), 1 /* Export */); } else { node.body = parseModuleBody(); ts.forEach(node.body.statements, function (s) { - if (s.kind === 175 /* ExportAssignment */) { + if (s.kind === 180 /* ExportAssignment */) { grammarErrorOnNode(s, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } - else if (s.kind === 174 /* ImportDeclaration */ && s.externalModuleName) { + else if (s.kind === 179 /* ImportDeclaration */ && s.externalModuleName) { grammarErrorOnNode(s, ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); } }); @@ -5165,7 +5439,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(pos, flags) { - var node = createNode(172 /* ModuleDeclaration */, pos); + var node = createNode(177 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseStringLiteral(); if (!inAmbientContext) { @@ -5181,19 +5455,19 @@ var ts; return finishNode(node); } function parseModuleDeclaration(pos, flags) { - parseExpected(106 /* ModuleKeyword */); - return token === 3 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(pos, flags) : parseInternalModuleTail(pos, flags); + parseExpected(110 /* ModuleKeyword */); + return token === 7 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(pos, flags) : parseInternalModuleTail(pos, flags); } function parseImportDeclaration(pos, flags) { - var node = createNode(174 /* ImportDeclaration */, pos); + var node = createNode(179 /* ImportDeclaration */, pos); node.flags = flags; - parseExpected(75 /* ImportKeyword */); + parseExpected(79 /* ImportKeyword */); node.name = parseIdentifier(); - parseExpected(43 /* EqualsToken */); + parseExpected(47 /* EqualsToken */); var entityName = parseEntityName(false); - if (entityName.kind === 55 /* Identifier */ && entityName.text === "require" && parseOptional(7 /* OpenParenToken */)) { + if (entityName.kind === 59 /* Identifier */ && entityName.text === "require" && parseOptional(11 /* OpenParenToken */)) { node.externalModuleName = parseStringLiteral(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); } else { node.entityName = entityName; @@ -5202,29 +5476,30 @@ var ts; return finishNode(node); } function parseExportAssignmentTail(pos) { - var node = createNode(175 /* ExportAssignment */, pos); + var node = createNode(180 /* ExportAssignment */, pos); node.exportName = parseIdentifier(); parseSemicolon(); return finishNode(node); } function isDeclaration() { switch (token) { - case 88 /* VarKeyword */: - case 73 /* FunctionKeyword */: + case 92 /* VarKeyword */: + case 77 /* FunctionKeyword */: return true; - case 59 /* ClassKeyword */: - case 93 /* InterfaceKeyword */: - case 67 /* EnumKeyword */: - case 75 /* ImportKeyword */: - return lookAhead(function () { return nextToken() >= 55 /* Identifier */; }); - case 106 /* ModuleKeyword */: - return lookAhead(function () { return nextToken() >= 55 /* Identifier */ || token === 3 /* StringLiteral */; }); - case 68 /* ExportKeyword */: - return lookAhead(function () { return nextToken() === 43 /* EqualsToken */ || isDeclaration(); }); - case 104 /* DeclareKeyword */: - case 98 /* PublicKeyword */: - case 96 /* PrivateKeyword */: - case 99 /* StaticKeyword */: + case 63 /* ClassKeyword */: + case 97 /* InterfaceKeyword */: + case 71 /* EnumKeyword */: + case 79 /* ImportKeyword */: + return lookAhead(function () { return nextToken() >= 59 /* Identifier */; }); + case 110 /* ModuleKeyword */: + return lookAhead(function () { return nextToken() >= 59 /* Identifier */ || token === 7 /* StringLiteral */; }); + case 72 /* ExportKeyword */: + return lookAhead(function () { return nextToken() === 47 /* EqualsToken */ || isDeclaration(); }); + case 108 /* DeclareKeyword */: + case 102 /* PublicKeyword */: + case 100 /* PrivateKeyword */: + case 101 /* ProtectedKeyword */: + case 103 /* StaticKeyword */: return lookAhead(function () { nextToken(); return isDeclaration(); @@ -5235,10 +5510,10 @@ var ts; var pos = getNodePos(); var errorCountBeforeModifiers = file.syntacticErrors.length; var flags = parseAndCheckModifiers(modifierContext); - if (token === 68 /* ExportKeyword */) { + if (token === 72 /* ExportKeyword */) { var modifiersEnd = scanner.getStartPos(); nextToken(); - if (parseOptional(43 /* EqualsToken */)) { + if (parseOptional(47 /* EqualsToken */)) { var exportAssignmentTail = parseExportAssignmentTail(pos); if (flags !== 0 && errorCountBeforeModifiers === file.syntacticErrors.length) { var modifiersStart = ts.skipTrivia(sourceText, pos); @@ -5253,25 +5528,25 @@ var ts; } var result; switch (token) { - case 88 /* VarKeyword */: + case 92 /* VarKeyword */: result = parseVariableStatement(pos, flags); break; - case 73 /* FunctionKeyword */: + case 77 /* FunctionKeyword */: result = parseFunctionDeclaration(pos, flags); break; - case 59 /* ClassKeyword */: + case 63 /* ClassKeyword */: result = parseClassDeclaration(pos, flags); break; - case 93 /* InterfaceKeyword */: + case 97 /* InterfaceKeyword */: result = parseInterfaceDeclaration(pos, flags); break; - case 67 /* EnumKeyword */: + case 71 /* EnumKeyword */: result = parseAndCheckEnumDeclaration(pos, flags); break; - case 106 /* ModuleKeyword */: + case 110 /* ModuleKeyword */: result = parseModuleDeclaration(pos, flags); break; - case 75 /* ImportKeyword */: + case 79 /* ImportKeyword */: result = parseImportDeclaration(pos, flags); break; default: @@ -5347,15 +5622,15 @@ var ts; }; } function getExternalModuleIndicator() { - return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 174 /* ImportDeclaration */ && node.externalModuleName || node.kind === 175 /* ExportAssignment */ ? node : undefined; }); + return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 179 /* ImportDeclaration */ && node.externalModuleName || node.kind === 180 /* ExportAssignment */ ? node : undefined; }); } - scanner = ts.createScanner(languageVersion, sourceText, scanError, onComment); + scanner = ts.createScanner(languageVersion, true, sourceText, scanError, onComment); var rootNodeFlags = 0; if (ts.fileExtensionIs(filename, ".d.ts")) { - rootNodeFlags = 512 /* DeclarationFile */; + rootNodeFlags = 1024 /* DeclarationFile */; inAmbientContext = true; } - file = createRootNode(177 /* SourceFile */, 0, sourceText.length, rootNodeFlags); + file = createRootNode(182 /* SourceFile */, 0, sourceText.length, rootNodeFlags); file.filename = ts.normalizePath(filename); file.text = sourceText; file.getLineAndCharacterFromPosition = getLineAndCharacterlFromSourcePosition; @@ -5421,17 +5696,27 @@ var ts; var start = refPos; var length = refEnd - refPos; } + var diagnostic; if (hasExtension(filename)) { if (!ts.fileExtensionIs(filename, ".ts")) { - errors.push(ts.createFileDiagnostic(refFile, start, length, ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts, filename)); + diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; } else if (!findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { - errors.push(ts.createFileDiagnostic(refFile, start, length, ts.Diagnostics.File_0_not_found, filename)); + diagnostic = ts.Diagnostics.File_0_not_found; } } else { if (!(findSourceFile(filename + ".ts", isDefaultLib, refFile, refPos, refEnd) || findSourceFile(filename + ".d.ts", isDefaultLib, refFile, refPos, refEnd))) { - errors.push(ts.createFileDiagnostic(refFile, start, length, ts.Diagnostics.File_0_not_found, filename + ".ts")); + diagnostic = ts.Diagnostics.File_0_not_found; + filename += ".ts"; + } + } + if (diagnostic) { + if (refFile) { + errors.push(ts.createFileDiagnostic(refFile, start, length, diagnostic, filename)); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnostic, filename)); } } } @@ -5474,7 +5759,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 174 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 179 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -5492,9 +5777,9 @@ var ts; } } } - else if (node.kind === 172 /* ModuleDeclaration */ && node.name.kind === 3 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || file.flags & 512 /* DeclarationFile */)) { + else if (node.kind === 177 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || file.flags & 1024 /* DeclarationFile */)) { forEachChild(node.body, function (node) { - if (node.kind === 174 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 179 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -5532,12 +5817,12 @@ var ts; if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModule !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 512 /* DeclarationFile */) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { - var sourcePathCompoments = ts.getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory()); - sourcePathCompoments.pop(); + if (!(sourceFile.flags & 1024 /* DeclarationFile */) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory()); + sourcePathComponents.pop(); if (commonPathComponents) { - for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathCompoments.length); i++) { - if (commonPathComponents[i] !== sourcePathCompoments[i]) { + for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); return; @@ -5546,16 +5831,16 @@ var ts; break; } } - if (sourcePathCompoments.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathCompoments.length; + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; } } else { - commonPathComponents = sourcePathCompoments; + commonPathComponents = sourcePathComponents; } } }); - commonSourceDirectory = ts.getNormalizedPathFromPathCompoments(commonPathComponents); + commonSourceDirectory = ts.getNormalizedPathFromPathComponents(commonPathComponents); if (commonSourceDirectory) { commonSourceDirectory += ts.directorySeparator; } @@ -5567,16 +5852,16 @@ var ts; var ts; (function (ts) { function isInstantiated(node) { - if (node.kind === 170 /* InterfaceDeclaration */) { + if (node.kind === 175 /* InterfaceDeclaration */) { return false; } - else if (node.kind === 174 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { + else if (node.kind === 179 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { return false; } - else if (node.kind === 173 /* ModuleBlock */ && !ts.forEachChild(node, isInstantiated)) { + else if (node.kind === 178 /* ModuleBlock */ && !ts.forEachChild(node, isInstantiated)) { return false; } - else if (node.kind === 172 /* ModuleDeclaration */ && !isInstantiated(node.body)) { + else if (node.kind === 177 /* ModuleDeclaration */ && !isInstantiated(node.body)) { return false; } else { @@ -5615,19 +5900,19 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 172 /* ModuleDeclaration */ && node.name.kind === 3 /* StringLiteral */) { + if (node.kind === 177 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { return '"' + node.name.text + '"'; } return node.name.text; } switch (node.kind) { - case 117 /* Constructor */: + case 121 /* Constructor */: return "__constructor"; - case 120 /* CallSignature */: + case 124 /* CallSignature */: return "__call"; - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: return "__new"; - case 122 /* IndexSignature */: + case 126 /* IndexSignature */: return "__index"; } } @@ -5651,7 +5936,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 169 /* ClassDeclaration */ && symbol.exports) { + if (node.kind === 174 /* ClassDeclaration */ && symbol.exports) { var prototypeSymbol = createSymbol(2 /* Property */ | 67108864 /* Prototype */, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -5683,7 +5968,7 @@ var ts; if (symbolKind & ts.SymbolFlags.Namespace) { exportKind |= 2097152 /* ExportNamespace */; } - if (node.flags & 1 /* Export */ || (node.kind !== 174 /* ImportDeclaration */ && isAmbientContext(container))) { + if (node.flags & 1 /* Export */ || (node.kind !== 179 /* ImportDeclaration */ && isAmbientContext(container))) { if (exportKind) { var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -5719,37 +6004,37 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes) { switch (container.kind) { - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 177 /* SourceFile */: + case 182 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } - case 120 /* CallSignature */: - case 121 /* ConstructSignature */: - case 122 /* IndexSignature */: - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + case 126 /* IndexSignature */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 169 /* ClassDeclaration */: - if (node.flags & 64 /* Static */) { + case 174 /* ClassDeclaration */: + if (node.flags & 128 /* Static */) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 125 /* TypeLiteral */: - case 128 /* ObjectLiteral */: - case 170 /* InterfaceDeclaration */: + case 129 /* TypeLiteral */: + case 133 /* ObjectLiteral */: + case 175 /* InterfaceDeclaration */: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -5758,13 +6043,13 @@ var ts; function bindConstructorDeclaration(node) { bindDeclaration(node, 4096 /* Constructor */, 0); ts.forEach(node.parameters, function (p) { - if (p.flags & (16 /* Public */ | 32 /* Private */)) { + if (p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */)) { bindDeclaration(p, 2 /* Property */, ts.SymbolFlags.PropertyExcludes); } }); } function bindModuleDeclaration(node) { - if (node.name.kind === 3 /* StringLiteral */) { + if (node.name.kind === 7 /* StringLiteral */) { bindDeclaration(node, 128 /* ValueModule */, ts.SymbolFlags.ValueModuleExcludes); } else if (isInstantiated(node)) { @@ -5790,75 +6075,75 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 113 /* TypeParameter */: + case 117 /* TypeParameter */: bindDeclaration(node, 262144 /* TypeParameter */, ts.SymbolFlags.TypeParameterExcludes); break; - case 114 /* Parameter */: + case 118 /* Parameter */: bindDeclaration(node, 1 /* Variable */, ts.SymbolFlags.ParameterExcludes); break; - case 166 /* VariableDeclaration */: + case 171 /* VariableDeclaration */: bindDeclaration(node, 1 /* Variable */, ts.SymbolFlags.VariableExcludes); break; - case 115 /* Property */: - case 129 /* PropertyAssignment */: + case 119 /* Property */: + case 134 /* PropertyAssignment */: bindDeclaration(node, 2 /* Property */, ts.SymbolFlags.PropertyExcludes); break; - case 176 /* EnumMember */: + case 181 /* EnumMember */: bindDeclaration(node, 4 /* EnumMember */, ts.SymbolFlags.EnumMemberExcludes); break; - case 120 /* CallSignature */: + case 124 /* CallSignature */: bindDeclaration(node, 32768 /* CallSignature */, 0); break; - case 116 /* Method */: + case 120 /* Method */: bindDeclaration(node, 2048 /* Method */, ts.SymbolFlags.MethodExcludes); break; - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: bindDeclaration(node, 65536 /* ConstructSignature */, 0); break; - case 122 /* IndexSignature */: + case 126 /* IndexSignature */: bindDeclaration(node, 131072 /* IndexSignature */, 0); break; - case 167 /* FunctionDeclaration */: + case 172 /* FunctionDeclaration */: bindDeclaration(node, 8 /* Function */, ts.SymbolFlags.FunctionExcludes); break; - case 117 /* Constructor */: + case 121 /* Constructor */: bindConstructorDeclaration(node); break; - case 118 /* GetAccessor */: + case 122 /* GetAccessor */: bindDeclaration(node, 8192 /* GetAccessor */, ts.SymbolFlags.GetAccessorExcludes); break; - case 119 /* SetAccessor */: + case 123 /* SetAccessor */: bindDeclaration(node, 16384 /* SetAccessor */, ts.SymbolFlags.SetAccessorExcludes); break; - case 125 /* TypeLiteral */: + case 129 /* TypeLiteral */: bindAnonymousDeclaration(node, 512 /* TypeLiteral */, "__type"); break; - case 128 /* ObjectLiteral */: + case 133 /* ObjectLiteral */: bindAnonymousDeclaration(node, 1024 /* ObjectLiteral */, "__object"); break; - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: bindAnonymousDeclaration(node, 8 /* Function */, "__function"); break; - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: bindCatchVariableDeclaration(node); break; - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: bindDeclaration(node, 16 /* Class */, ts.SymbolFlags.ClassExcludes); break; - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: bindDeclaration(node, 32 /* Interface */, ts.SymbolFlags.InterfaceExcludes); break; - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: bindDeclaration(node, 64 /* Enum */, ts.SymbolFlags.EnumExcludes); break; - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: bindModuleDeclaration(node); break; - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: bindDeclaration(node, 4194304 /* Import */, ts.SymbolFlags.ImportExcludes); break; - case 177 /* SourceFile */: + case 182 /* SourceFile */: if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 128 /* ValueModule */, '"' + ts.getModuleNameFromFilename(node.filename) + '"'); break; @@ -5885,7 +6170,21 @@ var ts; function getIndentSize() { return indentStrings[1].length; } - function emitFiles(resolver) { + function shouldEmitToOwnFile(sourceFile, compilerOptions) { + if (!(sourceFile.flags & 1024 /* DeclarationFile */)) { + if ((ts.isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { + return true; + } + return false; + } + return false; + } + ts.shouldEmitToOwnFile = shouldEmitToOwnFile; + function isExternalModuleOrDeclarationFile(sourceFile) { + return ts.isExternalModule(sourceFile) || (sourceFile.flags & 1024 /* DeclarationFile */) !== 0; + } + ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + function emitFiles(resolver, targetSourceFile) { var program = resolver.getProgram(); var compilerHost = program.getCompilerHost(); var compilerOptions = program.getCompilerOptions(); @@ -5893,32 +6192,22 @@ var ts; var diagnostics = []; var newLine = program.getCompilerHost().getNewLine(); function getSourceFilePathInNewDir(newDirPath, sourceFile) { - var sourceFilePath = ts.getNormalizedPathFromPathCompoments(ts.getNormalizedPathComponents(sourceFile.filename, compilerHost.getCurrentDirectory())); + var sourceFilePath = ts.getNormalizedPathFromPathComponents(ts.getNormalizedPathComponents(sourceFile.filename, compilerHost.getCurrentDirectory())); sourceFilePath = sourceFilePath.replace(program.getCommonSourceDirectory(), ""); return ts.combinePaths(newDirPath, sourceFilePath); } - function shouldEmitToOwnFile(sourceFile) { - if (!(sourceFile.flags & 512 /* DeclarationFile */)) { - if ((ts.isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { - return true; - } - } - } function getOwnEmitOutputFilePath(sourceFile, extension) { - if (program.getCompilerOptions().outDir) { - var emitOutputFilePathWithoutExtension = ts.getModuleNameFromFilename(getSourceFilePathInNewDir(program.getCompilerOptions().outDir, sourceFile)); + if (compilerOptions.outDir) { + var emitOutputFilePathWithoutExtension = ts.getModuleNameFromFilename(getSourceFilePathInNewDir(compilerOptions.outDir, sourceFile)); } else { var emitOutputFilePathWithoutExtension = ts.getModuleNameFromFilename(sourceFile.filename); } return emitOutputFilePathWithoutExtension + extension; } - function isExternalModuleOrDeclarationFile(sourceFile) { - return ts.isExternalModule(sourceFile) || (sourceFile.flags & 512 /* DeclarationFile */) !== 0; - } function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 117 /* Constructor */ && member.body) { + if (member.kind === 121 /* Constructor */ && member.body) { return member; } }); @@ -5928,14 +6217,14 @@ var ts; var getAccessor; var setAccessor; ts.forEach(node.members, function (member) { - if ((member.kind === 118 /* GetAccessor */ || member.kind === 119 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 64 /* Static */) === (accessor.flags & 64 /* Static */)) { + if ((member.kind === 122 /* GetAccessor */ || member.kind === 123 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { if (!firstAccessor) { firstAccessor = member; } - if (member.kind === 118 /* GetAccessor */ && !getAccessor) { + if (member.kind === 122 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 119 /* SetAccessor */ && !setAccessor) { + if (member.kind === 123 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6261,7 +6550,7 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 167 /* FunctionDeclaration */ || node.kind === 136 /* FunctionExpression */ || node.kind === 116 /* Method */ || node.kind === 118 /* GetAccessor */ || node.kind === 119 /* SetAccessor */ || node.kind === 172 /* ModuleDeclaration */ || node.kind === 169 /* ClassDeclaration */ || node.kind === 171 /* EnumDeclaration */) { + else if (node.kind === 172 /* FunctionDeclaration */ || node.kind === 141 /* FunctionExpression */ || node.kind === 120 /* Method */ || node.kind === 122 /* GetAccessor */ || node.kind === 123 /* SetAccessor */ || node.kind === 177 /* ModuleDeclaration */ || node.kind === 174 /* ClassDeclaration */ || node.kind === 176 /* EnumDeclaration */) { if (node.name) { scopeName = node.name.text; } @@ -6280,16 +6569,51 @@ var ts; writeCommentRange(comment, writer); recordSourceMapSpan(comment.end); } + var escapedCharsRegExp = /[\t\v\f\b\0\r\n\"\u2028\u2029\u0085]/g; + var escapedCharsMap = { + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\0": "\\0", + "\r": "\\r", + "\n": "\\n", + "\"": "\\\"", + "\u2028": "\\u2028", + "\u2029": "\\u2029", + "\u0085": "\\u0085" + }; + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings) { + if (typeof JSON !== "undefined") { + return JSON.stringify({ + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }); + } + return "{\"version\":" + version + ",\"file\":\"" + escapeString(file) + "\",\"sourceRoot\":\"" + escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + escapeString(mappings) + "\"}"; + function escapeString(s) { + return escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, function (c) { + return escapedCharsMap[c] || c; + }) : s; + } + function serializeStringArray(list) { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + escapeString(list[i]) + "\""; + } + return output; + } + } function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { encodeLastRecordedSourceMapSpan(); - writeFile(sourceMapData.sourceMapFilePath, JSON.stringify({ - version: 3, - file: sourceMapData.sourceMapFile, - sourceRoot: sourceMapData.sourceMapSourceRoot, - sources: sourceMapData.sourceMapSources, - names: sourceMapData.sourceMapNames, - mappings: sourceMapData.sourceMapMappings - }), false); + writeFile(sourceMapData.sourceMapFilePath, serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings), false); sourceMapDataList.push(sourceMapData); writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); } @@ -6327,7 +6651,7 @@ var ts; } function emitNodeWithMap(node) { if (node) { - if (node.kind != 177 /* SourceFile */) { + if (node.kind != 182 /* SourceFile */) { recordEmitNodeStartSpan(node); emitNode(node); recordEmitNodeEndSpan(node); @@ -6398,7 +6722,7 @@ var ts; } function emitLiteral(node) { var text = getSourceTextOfLocalNode(node); - if (node.kind === 3 /* StringLiteral */ && compilerOptions.sourceMap) { + if (node.kind === 7 /* StringLiteral */ && compilerOptions.sourceMap) { writer.writeLiteral(text); } else { @@ -6406,12 +6730,12 @@ var ts; } } function emitQuotedIdentifier(node) { - if (node.kind === 3 /* StringLiteral */) { + if (node.kind === 7 /* StringLiteral */) { emitLiteral(node); } else { write("\""); - if (node.kind === 2 /* NumericLiteral */) { + if (node.kind === 6 /* NumericLiteral */) { write(node.text); } else { @@ -6423,29 +6747,29 @@ var ts; function isNonExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 114 /* Parameter */: - case 166 /* VariableDeclaration */: - case 115 /* Property */: - case 129 /* PropertyAssignment */: - case 176 /* EnumMember */: - case 116 /* Method */: - case 167 /* FunctionDeclaration */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 136 /* FunctionExpression */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 171 /* EnumDeclaration */: - case 172 /* ModuleDeclaration */: - case 174 /* ImportDeclaration */: + case 118 /* Parameter */: + case 171 /* VariableDeclaration */: + case 119 /* Property */: + case 134 /* PropertyAssignment */: + case 181 /* EnumMember */: + case 120 /* Method */: + case 172 /* FunctionDeclaration */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 141 /* FunctionExpression */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: + case 177 /* ModuleDeclaration */: + case 179 /* ImportDeclaration */: return parent.name === node; - case 153 /* BreakStatement */: - case 152 /* ContinueStatement */: - case 175 /* ExportAssignment */: + case 158 /* BreakStatement */: + case 157 /* ContinueStatement */: + case 180 /* ExportAssignment */: return false; - case 159 /* LabelledStatement */: + case 164 /* LabeledStatement */: return node.parent.label === node; - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: return node.parent.variable === node; } } @@ -6480,7 +6804,7 @@ var ts; } } function emitArrayLiteral(node) { - if (node.flags & 128 /* MultiLine */) { + if (node.flags & 256 /* MultiLine */) { write("["); increaseIndent(); emitMultiLineList(node.elements); @@ -6498,7 +6822,7 @@ var ts; if (!node.properties.length) { write("{}"); } - else if (node.flags & 128 /* MultiLine */) { + else if (node.flags & 256 /* MultiLine */) { write("{"); increaseIndent(); emitMultiLineList(node.properties); @@ -6537,13 +6861,13 @@ var ts; } function emitCallExpression(node) { var superCall = false; - if (node.func.kind === 81 /* SuperKeyword */) { + if (node.func.kind === 85 /* SuperKeyword */) { write("_super"); superCall = true; } else { emit(node.func); - superCall = node.func.kind === 130 /* PropertyAccess */ && node.func.left.kind === 81 /* SuperKeyword */; + superCall = node.func.kind === 135 /* PropertyAccess */ && node.func.left.kind === 85 /* SuperKeyword */; } if (superCall) { write(".call("); @@ -6570,12 +6894,12 @@ var ts; } } function emitParenExpression(node) { - if (node.expression.kind === 134 /* TypeAssertion */) { + if (node.expression.kind === 139 /* TypeAssertion */) { var operand = node.expression.operand; - while (operand.kind == 134 /* TypeAssertion */) { + while (operand.kind == 139 /* TypeAssertion */) { operand = operand.operand; } - if (operand.kind !== 138 /* PrefixOperator */ && operand.kind !== 139 /* PostfixOperator */ && operand.kind !== 133 /* NewExpression */ && !(operand.kind === 132 /* CallExpression */ && node.parent.kind === 133 /* NewExpression */) && !(operand.kind === 136 /* FunctionExpression */ && node.parent.kind === 132 /* CallExpression */)) { + if (operand.kind !== 143 /* PrefixOperator */ && operand.kind !== 144 /* PostfixOperator */ && operand.kind !== 138 /* NewExpression */ && !(operand.kind === 137 /* CallExpression */ && node.parent.kind === 138 /* NewExpression */) && !(operand.kind === 141 /* FunctionExpression */ && node.parent.kind === 137 /* CallExpression */)) { emit(operand); return; } @@ -6585,29 +6909,29 @@ var ts; write(")"); } function emitUnaryExpression(node) { - if (node.kind === 138 /* PrefixOperator */) { + if (node.kind === 143 /* PrefixOperator */) { write(ts.tokenToString(node.operator)); } - if (node.operator >= 55 /* Identifier */) { + if (node.operator >= 59 /* Identifier */) { write(" "); } - else if (node.kind === 138 /* PrefixOperator */ && node.operand.kind === 138 /* PrefixOperator */) { + else if (node.kind === 143 /* PrefixOperator */ && node.operand.kind === 143 /* PrefixOperator */) { var operand = node.operand; - if (node.operator === 24 /* PlusToken */ && (operand.operator === 24 /* PlusToken */ || operand.operator === 29 /* PlusPlusToken */)) { + if (node.operator === 28 /* PlusToken */ && (operand.operator === 28 /* PlusToken */ || operand.operator === 33 /* PlusPlusToken */)) { write(" "); } - else if (node.operator === 25 /* MinusToken */ && (operand.operator === 25 /* MinusToken */ || operand.operator === 30 /* MinusMinusToken */)) { + else if (node.operator === 29 /* MinusToken */ && (operand.operator === 29 /* MinusToken */ || operand.operator === 34 /* MinusMinusToken */)) { write(" "); } } emit(node.operand); - if (node.kind === 139 /* PostfixOperator */) { + if (node.kind === 144 /* PostfixOperator */) { write(ts.tokenToString(node.operator)); } } function emitBinaryExpression(node) { emit(node.left); - if (node.operator !== 14 /* CommaToken */) + if (node.operator !== 18 /* CommaToken */) write(" "); write(ts.tokenToString(node.operator)); write(" "); @@ -6621,21 +6945,21 @@ var ts; emit(node.whenFalse); } function emitBlock(node) { - emitToken(5 /* OpenBraceToken */, node.pos); + emitToken(9 /* OpenBraceToken */, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 173 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 172 /* ModuleDeclaration */); + if (node.kind === 178 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 177 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); decreaseIndent(); writeLine(); - emitToken(6 /* CloseBraceToken */, node.statements.end); + emitToken(10 /* CloseBraceToken */, node.statements.end); scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 143 /* Block */) { + if (node.kind === 148 /* Block */) { write(" "); emit(node); } @@ -6647,7 +6971,7 @@ var ts; } } function emitExpressionStatement(node) { - var isArrowExpression = node.expression.kind === 137 /* ArrowFunction */; + var isArrowExpression = node.expression.kind === 142 /* ArrowFunction */; emitLeadingComments(node); if (isArrowExpression) write("("); @@ -6659,16 +6983,16 @@ var ts; } function emitIfStatement(node) { emitLeadingComments(node); - var endPos = emitToken(74 /* IfKeyword */, node.pos); + var endPos = emitToken(78 /* IfKeyword */, node.pos); write(" "); - endPos = emitToken(7 /* OpenParenToken */, endPos); + endPos = emitToken(11 /* OpenParenToken */, endPos); emit(node.expression); - emitToken(8 /* CloseParenToken */, node.expression.end); + emitToken(12 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { writeLine(); - emitToken(66 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 147 /* IfStatement */) { + emitToken(70 /* ElseKeyword */, node.thenStatement.end); + if (node.elseStatement.kind === 152 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -6681,7 +7005,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 143 /* Block */) { + if (node.statement.kind === 148 /* Block */) { write(" "); } else { @@ -6698,11 +7022,11 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForStatement(node) { - var endPos = emitToken(72 /* ForKeyword */, node.pos); + var endPos = emitToken(76 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(7 /* OpenParenToken */, endPos); + endPos = emitToken(11 /* OpenParenToken */, endPos); if (node.declarations) { - emitToken(88 /* VarKeyword */, endPos); + emitToken(92 /* VarKeyword */, endPos); write(" "); emitCommaList(node.declarations); } @@ -6717,11 +7041,11 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInStatement(node) { - var endPos = emitToken(72 /* ForKeyword */, node.pos); + var endPos = emitToken(76 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(7 /* OpenParenToken */, endPos); + endPos = emitToken(11 /* OpenParenToken */, endPos); if (node.declaration) { - emitToken(88 /* VarKeyword */, endPos); + emitToken(92 /* VarKeyword */, endPos); write(" "); emit(node.declaration); } @@ -6730,17 +7054,17 @@ var ts; } write(" in "); emit(node.expression); - emitToken(8 /* CloseParenToken */, node.expression.end); + emitToken(12 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.statement); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 153 /* BreakStatement */ ? 56 /* BreakKeyword */ : 61 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 158 /* BreakStatement */ ? 60 /* BreakKeyword */ : 65 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } function emitReturnStatement(node) { emitLeadingComments(node); - emitToken(80 /* ReturnKeyword */, node.pos); + emitToken(84 /* ReturnKeyword */, node.pos); emitOptional(" ", node.expression); write(";"); emitTrailingComments(node); @@ -6752,21 +7076,21 @@ var ts; emitEmbeddedStatement(node.statement); } function emitSwitchStatement(node) { - var endPos = emitToken(82 /* SwitchKeyword */, node.pos); + var endPos = emitToken(86 /* SwitchKeyword */, node.pos); write(" "); - emitToken(7 /* OpenParenToken */, endPos); + emitToken(11 /* OpenParenToken */, endPos); emit(node.expression); - endPos = emitToken(8 /* CloseParenToken */, node.expression.end); + endPos = emitToken(12 /* CloseParenToken */, node.expression.end); write(" "); - emitToken(5 /* OpenBraceToken */, endPos); + emitToken(9 /* OpenBraceToken */, endPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); writeLine(); - emitToken(6 /* CloseBraceToken */, node.clauses.end); + emitToken(10 /* CloseBraceToken */, node.clauses.end); } function emitCaseOrDefaultClause(node) { - if (node.kind === 157 /* CaseClause */) { + if (node.kind === 162 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -6795,16 +7119,16 @@ var ts; } function emitCatchBlock(node) { writeLine(); - var endPos = emitToken(58 /* CatchKeyword */, node.pos); + var endPos = emitToken(62 /* CatchKeyword */, node.pos); write(" "); - emitToken(7 /* OpenParenToken */, endPos); + emitToken(11 /* OpenParenToken */, endPos); emit(node.variable); - emitToken(8 /* CloseParenToken */, node.variable.end); + emitToken(12 /* CloseParenToken */, node.variable.end); write(" "); emitBlock(node); } function emitDebuggerStatement(node) { - emitToken(62 /* DebuggerKeyword */, node.pos); + emitToken(66 /* DebuggerKeyword */, node.pos); write(";"); } function emitLabelledStatement(node) { @@ -6815,7 +7139,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 172 /* ModuleDeclaration */); + } while (node && node.kind !== 177 /* ModuleDeclaration */); return node; } function emitModuleMemberName(node) { @@ -6905,7 +7229,7 @@ var ts; } function emitAccessor(node) { emitLeadingComments(node); - write(node.kind === 118 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 122 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); emitTrailingComments(node); @@ -6914,15 +7238,15 @@ var ts; if (!node.body) { return emitPinnedOrTripleSlashComments(node); } - if (node.kind !== 116 /* Method */) { + if (node.kind !== 120 /* Method */) { emitLeadingComments(node); } write("function "); - if (node.kind === 167 /* FunctionDeclaration */ || (node.kind === 136 /* FunctionExpression */ && node.name)) { + if (node.kind === 172 /* FunctionDeclaration */ || (node.kind === 141 /* FunctionExpression */ && node.name)) { emit(node.name); } emitSignatureAndBody(node); - if (node.kind !== 116 /* Method */) { + if (node.kind !== 120 /* Method */) { emitTrailingComments(node); } } @@ -6948,16 +7272,16 @@ var ts; write(" {"); scopeEmitStart(node); increaseIndent(); - emitDetachedComments(node.body.kind === 168 /* FunctionBlock */ ? node.body.statements : node.body); + emitDetachedComments(node.body.kind === 173 /* FunctionBlock */ ? node.body.statements : node.body); var startIndex = 0; - if (node.body.kind === 168 /* FunctionBlock */) { + if (node.body.kind === 173 /* FunctionBlock */) { startIndex = emitDirectivePrologues(node.body.statements, true); } var outPos = writer.getTextPos(); emitCaptureThisForNodeIfNecessary(node); emitDefaultValueAssignments(node); emitRestParameter(node); - if (node.body.kind !== 168 /* FunctionBlock */ && outPos === writer.getTextPos()) { + if (node.body.kind !== 173 /* FunctionBlock */ && outPos === writer.getTextPos()) { decreaseIndent(); write(" "); emitStart(node.body); @@ -6970,7 +7294,7 @@ var ts; emitEnd(node.body); } else { - if (node.body.kind === 168 /* FunctionBlock */) { + if (node.body.kind === 173 /* FunctionBlock */) { emitLinesStartingAt(node.body.statements, startIndex); } else { @@ -6982,10 +7306,10 @@ var ts; emitTrailingComments(node.body); } writeLine(); - if (node.body.kind === 168 /* FunctionBlock */) { + if (node.body.kind === 173 /* FunctionBlock */) { emitLeadingCommentsOfPosition(node.body.statements.end); decreaseIndent(); - emitToken(6 /* CloseBraceToken */, node.body.statements.end); + emitToken(10 /* CloseBraceToken */, node.body.statements.end); } else { decreaseIndent(); @@ -7008,11 +7332,11 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 146 /* ExpressionStatement */) { + if (statement && statement.kind === 151 /* ExpressionStatement */) { var expr = statement.expression; - if (expr && expr.kind === 132 /* CallExpression */) { + if (expr && expr.kind === 137 /* CallExpression */) { var func = expr.func; - if (func && func.kind === 81 /* SuperKeyword */) { + if (func && func.kind === 85 /* SuperKeyword */) { return statement; } } @@ -7021,7 +7345,7 @@ var ts; } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & (16 /* Public */ | 32 /* Private */)) { + if (param.flags & ts.NodeFlags.AccessibilityModifier) { writeLine(); emitStart(param); emitStart(param.name); @@ -7036,7 +7360,7 @@ var ts; }); } function emitMemberAccess(memberName) { - if (memberName.kind === 3 /* StringLiteral */ || memberName.kind === 2 /* NumericLiteral */) { + if (memberName.kind === 7 /* StringLiteral */ || memberName.kind === 6 /* NumericLiteral */) { write("["); emitNode(memberName); write("]"); @@ -7048,7 +7372,7 @@ var ts; } function emitMemberAssignments(node, staticFlag) { ts.forEach(node.members, function (member) { - if (member.kind === 115 /* Property */ && (member.flags & 64 /* Static */) === staticFlag && member.initializer) { + if (member.kind === 119 /* Property */ && (member.flags & 128 /* Static */) === staticFlag && member.initializer) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -7071,7 +7395,7 @@ var ts; } function emitMemberFunctions(node) { ts.forEach(node.members, function (member) { - if (member.kind === 116 /* Method */) { + if (member.kind === 120 /* Method */) { if (!member.body) { return emitPinnedOrTripleSlashComments(member); } @@ -7080,7 +7404,7 @@ var ts; emitStart(member); emitStart(member.name); emitNode(node.name); - if (!(member.flags & 64 /* Static */)) { + if (!(member.flags & 128 /* Static */)) { write(".prototype"); } emitMemberAccess(member.name); @@ -7093,7 +7417,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 118 /* GetAccessor */ || member.kind === 119 /* SetAccessor */) { + else if (member.kind === 122 /* GetAccessor */ || member.kind === 123 /* SetAccessor */) { var accessors = getAllAccessorDeclarations(node, member); if (member === accessors.firstAccessor) { writeLine(); @@ -7101,7 +7425,7 @@ var ts; write("Object.defineProperty("); emitStart(member.name); emitNode(node.name); - if (!(member.flags & 64 /* Static */)) { + if (!(member.flags & 128 /* Static */)) { write(".prototype"); } write(", "); @@ -7165,17 +7489,17 @@ var ts; writeLine(); emitConstructorOfClass(); emitMemberFunctions(node); - emitMemberAssignments(node, 64 /* Static */); + emitMemberAssignments(node, 128 /* Static */); writeLine(); function emitClassReturnStatement() { write("return "); emitNode(node.name); } - emitToken(6 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); + emitToken(10 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); write(";"); decreaseIndent(); writeLine(); - emitToken(6 /* CloseBraceToken */, node.members.end); + emitToken(10 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); emitStart(node); write(")("); @@ -7196,7 +7520,7 @@ var ts; emitTrailingComments(node); function emitConstructorOfClass() { ts.forEach(node.members, function (member) { - if (member.kind === 117 /* Constructor */ && !member.body) { + if (member.kind === 121 /* Constructor */ && !member.body) { emitPinnedOrTripleSlashComments(member); } }); @@ -7247,7 +7571,7 @@ var ts; emitLeadingCommentsOfPosition(ctor.body.statements.end); } decreaseIndent(); - emitToken(6 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + emitToken(10 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { @@ -7279,7 +7603,7 @@ var ts; emitEnumMemberDeclarations(); decreaseIndent(); writeLine(); - emitToken(6 /* CloseBraceToken */, node.members.end); + emitToken(10 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); write(")("); emitModuleMemberName(node); @@ -7324,7 +7648,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 172 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 177 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -7346,7 +7670,7 @@ var ts; write(resolver.getLocalNameOfContainer(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 173 /* ModuleBlock */) { + if (node.body.kind === 178 /* ModuleBlock */) { emit(node.body); } else { @@ -7359,7 +7683,7 @@ var ts; decreaseIndent(); writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(6 /* CloseBraceToken */, moduleBlock.statements.end); + emitToken(10 /* CloseBraceToken */, moduleBlock.statements.end); scopeEmitEnd(); } write(")("); @@ -7380,7 +7704,7 @@ var ts; emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportedViaEntityName(node); } if (emitImportDeclaration) { - if (node.externalModuleName && node.parent.kind === 177 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { + if (node.externalModuleName && node.parent.kind === 182 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { if (node.flags & 1 /* Export */) { writeLine(); emitLeadingComments(node); @@ -7409,7 +7733,7 @@ var ts; emitStart(node.externalModuleName); emitLiteral(node.externalModuleName); emitEnd(node.externalModuleName); - emitToken(8 /* CloseParenToken */, node.externalModuleName.end); + emitToken(12 /* CloseParenToken */, node.externalModuleName.end); } write(";"); emitEnd(node); @@ -7420,7 +7744,7 @@ var ts; function getExternalImportDeclarations(node) { var result = []; ts.forEach(node.statements, function (stat) { - if (stat.kind === 174 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { + if (stat.kind === 179 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { result.push(stat); } }); @@ -7428,7 +7752,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 175 /* ExportAssignment */) { + if (node.kind === 180 /* ExportAssignment */) { return node; } }); @@ -7544,117 +7868,117 @@ var ts; return emitPinnedOrTripleSlashComments(node); } switch (node.kind) { - case 55 /* Identifier */: + case 59 /* Identifier */: return emitIdentifier(node); - case 114 /* Parameter */: + case 118 /* Parameter */: return emitParameter(node); - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: return emitAccessor(node); - case 83 /* ThisKeyword */: + case 87 /* ThisKeyword */: return emitThis(node); - case 81 /* SuperKeyword */: + case 85 /* SuperKeyword */: return emitSuper(node); - case 79 /* NullKeyword */: + case 83 /* NullKeyword */: return write("null"); - case 85 /* TrueKeyword */: + case 89 /* TrueKeyword */: return write("true"); - case 70 /* FalseKeyword */: + case 74 /* FalseKeyword */: return write("false"); - case 2 /* NumericLiteral */: - case 3 /* StringLiteral */: - case 4 /* RegularExpressionLiteral */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 8 /* RegularExpressionLiteral */: return emitLiteral(node); - case 112 /* QualifiedName */: + case 116 /* QualifiedName */: return emitPropertyAccess(node); - case 127 /* ArrayLiteral */: + case 132 /* ArrayLiteral */: return emitArrayLiteral(node); - case 128 /* ObjectLiteral */: + case 133 /* ObjectLiteral */: return emitObjectLiteral(node); - case 129 /* PropertyAssignment */: + case 134 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 130 /* PropertyAccess */: + case 135 /* PropertyAccess */: return emitPropertyAccess(node); - case 131 /* IndexedAccess */: + case 136 /* IndexedAccess */: return emitIndexedAccess(node); - case 132 /* CallExpression */: + case 137 /* CallExpression */: return emitCallExpression(node); - case 133 /* NewExpression */: + case 138 /* NewExpression */: return emitNewExpression(node); - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return emit(node.operand); - case 135 /* ParenExpression */: + case 140 /* ParenExpression */: return emitParenExpression(node); - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 138 /* PrefixOperator */: - case 139 /* PostfixOperator */: + case 143 /* PrefixOperator */: + case 144 /* PostfixOperator */: return emitUnaryExpression(node); - case 140 /* BinaryExpression */: + case 145 /* BinaryExpression */: return emitBinaryExpression(node); - case 141 /* ConditionalExpression */: + case 146 /* ConditionalExpression */: return emitConditionalExpression(node); - case 142 /* OmittedExpression */: + case 147 /* OmittedExpression */: return; - case 143 /* Block */: - case 162 /* TryBlock */: - case 164 /* FinallyBlock */: - case 168 /* FunctionBlock */: - case 173 /* ModuleBlock */: + case 148 /* Block */: + case 167 /* TryBlock */: + case 169 /* FinallyBlock */: + case 173 /* FunctionBlock */: + case 178 /* ModuleBlock */: return emitBlock(node); - case 144 /* VariableStatement */: + case 149 /* VariableStatement */: return emitVariableStatement(node); - case 145 /* EmptyStatement */: + case 150 /* EmptyStatement */: return write(";"); - case 146 /* ExpressionStatement */: + case 151 /* ExpressionStatement */: return emitExpressionStatement(node); - case 147 /* IfStatement */: + case 152 /* IfStatement */: return emitIfStatement(node); - case 148 /* DoStatement */: + case 153 /* DoStatement */: return emitDoStatement(node); - case 149 /* WhileStatement */: + case 154 /* WhileStatement */: return emitWhileStatement(node); - case 150 /* ForStatement */: + case 155 /* ForStatement */: return emitForStatement(node); - case 151 /* ForInStatement */: + case 156 /* ForInStatement */: return emitForInStatement(node); - case 152 /* ContinueStatement */: - case 153 /* BreakStatement */: + case 157 /* ContinueStatement */: + case 158 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 154 /* ReturnStatement */: + case 159 /* ReturnStatement */: return emitReturnStatement(node); - case 155 /* WithStatement */: + case 160 /* WithStatement */: return emitWithStatement(node); - case 156 /* SwitchStatement */: + case 161 /* SwitchStatement */: return emitSwitchStatement(node); - case 157 /* CaseClause */: - case 158 /* DefaultClause */: + case 162 /* CaseClause */: + case 163 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 159 /* LabelledStatement */: + case 164 /* LabeledStatement */: return emitLabelledStatement(node); - case 160 /* ThrowStatement */: + case 165 /* ThrowStatement */: return emitThrowStatement(node); - case 161 /* TryStatement */: + case 166 /* TryStatement */: return emitTryStatement(node); - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: return emitCatchBlock(node); - case 165 /* DebuggerStatement */: + case 170 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 166 /* VariableDeclaration */: + case 171 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: return emitClassDeclaration(node); - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: return emitImportDeclaration(node); - case 177 /* SourceFile */: + case 182 /* SourceFile */: return emitSourceFile(node); } } @@ -7672,7 +7996,7 @@ var ts; return leadingComments; } function getLeadingCommentsToEmit(node) { - if (node.parent.kind === 177 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 182 /* SourceFile */ || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -7689,7 +8013,7 @@ var ts; emitComments(leadingComments, true, writer, writeComment); } function emitTrailingDeclarationComments(node) { - if (node.parent.kind === 177 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 182 /* SourceFile */ || node.end !== node.parent.end) { var trailingComments = ts.getTrailingComments(currentSourceFile.text, node.end); emitComments(trailingComments, false, writer, writeComment); } @@ -7850,21 +8174,27 @@ var ts; writeLine(); } function emitDeclarationFlags(node) { - if (node.flags & 64 /* Static */) { + if (node.flags & 128 /* Static */) { if (node.flags & 32 /* Private */) { write("private "); } + else if (node.flags & 64 /* Protected */) { + write("protected "); + } write("static "); } else { if (node.flags & 32 /* Private */) { write("private "); } + else if (node.flags & 64 /* Protected */) { + write("protected "); + } else if (node.parent === currentSourceFile) { if (node.flags & 1 /* Export */) { write("export "); } - if (node.kind !== 170 /* InterfaceDeclaration */) { + if (node.kind !== 175 /* InterfaceDeclaration */) { write("declare "); } } @@ -7920,7 +8250,7 @@ var ts; emitDeclarationFlags(node); write("module "); emitSourceTextOfNode(node.name); - while (node.body.kind !== 173 /* ModuleBlock */) { + while (node.body.kind !== 178 /* ModuleBlock */) { node = node.body; write("."); emitSourceTextOfNode(node.name); @@ -7968,30 +8298,30 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 120 /* CallSignature */: + case 124 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 116 /* Method */: - if (node.parent.flags & 64 /* Static */) { + case 120 /* Method */: + if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 169 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 174 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 167 /* FunctionDeclaration */: + case 172 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -8007,7 +8337,7 @@ var ts; emitJsDocComments(node); decreaseIndent(); emitSourceTextOfNode(node.name); - if (node.constraint && (node.parent.kind !== 116 /* Method */ || !(node.parent.flags & 32 /* Private */))) { + if (node.constraint && (node.parent.kind !== 120 /* Method */ || !(node.parent.flags & 32 /* Private */))) { write(" extends "); getSymbolVisibilityDiagnosticMessage = getTypeParameterConstraintVisibilityError; resolver.writeTypeAtLocation(node.constraint, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); @@ -8029,7 +8359,7 @@ var ts; resolver.writeTypeAtLocation(node, enclosingDeclaration, 1 /* WriteArrayAsGenericType */ | 2 /* UseTypeOfFunction */, writer); function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.kind === 169 /* ClassDeclaration */) { + if (node.parent.kind === 174 /* ClassDeclaration */) { if (symbolAccesibilityResult.errorModuleName) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2; } @@ -8057,7 +8387,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & (16 /* Public */ | 32 /* Private */)) { + if (param.flags & ts.NodeFlags.AccessibilityModifier) { emitPropertyDeclaration(param); } }); @@ -8114,9 +8444,9 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 166 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 171 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { emitSourceTextOfNode(node.name); - if (node.kind === 115 /* Property */ && (node.flags & 4 /* QuestionMark */)) { + if (node.kind === 119 /* Property */ && (node.flags & 4 /* QuestionMark */)) { write("?"); } if (!(node.flags & 32 /* Private */)) { @@ -8127,14 +8457,14 @@ var ts; } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 166 /* VariableDeclaration */) { + if (node.kind === 171 /* VariableDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 115 /* Property */) { - if (node.flags & 64 /* Static */) { + else if (node.kind === 119 /* Property */) { + if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 169 /* ClassDeclaration */) { + else if (node.parent.kind === 174 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { @@ -8176,8 +8506,8 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 119 /* SetAccessor */) { - if (node.parent.flags & 64 /* Static */) { + if (node.kind === 123 /* SetAccessor */) { + if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { @@ -8190,7 +8520,7 @@ var ts; }; } else { - if (node.flags & 64 /* Static */) { + if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { @@ -8205,14 +8535,14 @@ var ts; } } function emitFunctionDeclaration(node) { - if ((node.kind !== 167 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 172 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); emitDeclarationFlags(node); - if (node.kind === 167 /* FunctionDeclaration */) { + if (node.kind === 172 /* FunctionDeclaration */) { write("function "); emitSourceTextOfNode(node.name); } - else if (node.kind === 117 /* Constructor */) { + else if (node.kind === 121 /* Constructor */) { write("constructor"); } else { @@ -8230,24 +8560,24 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 120 /* CallSignature */ || node.kind === 122 /* IndexSignature */) { + if (node.kind === 124 /* CallSignature */ || node.kind === 126 /* IndexSignature */) { emitJsDocComments(node); } emitTypeParameters(node.typeParameters); - if (node.kind === 122 /* IndexSignature */) { + if (node.kind === 126 /* IndexSignature */) { write("["); } else { write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 122 /* IndexSignature */) { + if (node.kind === 126 /* IndexSignature */) { write("]"); } else { write(")"); } - if (node.kind !== 117 /* Constructor */ && !(node.flags & 32 /* Private */)) { + if (node.kind !== 121 /* Constructor */ && !(node.flags & 32 /* Private */)) { write(": "); getSymbolVisibilityDiagnosticMessage = getReturnTypeVisibilityError; resolver.writeReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); @@ -8257,27 +8587,27 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 120 /* CallSignature */: + case 124 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 122 /* IndexSignature */: + case 126 /* IndexSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 116 /* Method */: - if (node.flags & 64 /* Static */) { + case 120 /* Method */: + if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 169 /* ClassDeclaration */) { + else if (node.parent.kind === 174 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 167 /* FunctionDeclaration */: + case 172 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -8308,27 +8638,27 @@ var ts; function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 117 /* Constructor */: + case 121 /* Constructor */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 120 /* CallSignature */: + case 124 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 116 /* Method */: - if (node.parent.flags & 64 /* Static */) { + case 120 /* Method */: + if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 169 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 174 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 167 /* FunctionDeclaration */: + case 172 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -8343,37 +8673,37 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 117 /* Constructor */: - case 167 /* FunctionDeclaration */: - case 116 /* Method */: + case 121 /* Constructor */: + case 172 /* FunctionDeclaration */: + case 120 /* Method */: return emitFunctionDeclaration(node); - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: return emitConstructSignatureDeclaration(node); - case 120 /* CallSignature */: - case 122 /* IndexSignature */: + case 124 /* CallSignature */: + case 126 /* IndexSignature */: return emitSignatureDeclaration(node); - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: return emitAccessorDeclaration(node); - case 144 /* VariableStatement */: + case 149 /* VariableStatement */: return emitVariableStatement(node); - case 115 /* Property */: + case 119 /* Property */: return emitPropertyDeclaration(node); - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: return emitClassDeclaration(node); - case 176 /* EnumMember */: + case 181 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: return emitImportDeclaration(node); - case 175 /* ExportAssignment */: + case 180 /* ExportAssignment */: return emitExportAssignment(node); - case 177 /* SourceFile */: + case 182 /* SourceFile */: return emitSourceFile(node); } } @@ -8383,7 +8713,7 @@ var ts; } var referencePathsOutput = ""; function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 512 /* DeclarationFile */ ? referencedFile.filename : shouldEmitToOwnFile(referencedFile) ? getOwnEmitOutputFilePath(referencedFile, ".d.ts") : ts.getModuleNameFromFilename(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 1024 /* DeclarationFile */ ? referencedFile.filename : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, ".d.ts") : ts.getModuleNameFromFilename(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, compilerHost.getCurrentDirectory(), false); referencePathsOutput += "/// " + newLine; } @@ -8392,7 +8722,7 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = resolveScriptReference(root, fileReference); - if ((referencedFile.flags & 512 /* DeclarationFile */) || shouldEmitToOwnFile(referencedFile) || !addedGlobalFileReference) { + if ((referencedFile.flags & 1024 /* DeclarationFile */) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -8434,25 +8764,46 @@ var ts; writeFile(ts.getModuleNameFromFilename(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); } } - var shouldEmitDeclarations = resolver.shouldEmitDeclarations(); + var hasSemanticErrors = resolver.hasSemanticErrors(); function emitFile(jsFilePath, sourceFile) { emitJavaScript(jsFilePath, sourceFile); - if (shouldEmitDeclarations) { + if (!hasSemanticErrors && compilerOptions.declaration) { emitDeclarations(jsFilePath, sourceFile); } } - ts.forEach(program.getSourceFiles(), function (sourceFile) { - if (shouldEmitToOwnFile(sourceFile)) { - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, ".js"); - emitFile(jsFilePath, sourceFile); - } - }); + if (targetSourceFile === undefined) { + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + } + else { + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, ".js"); + emitFile(jsFilePath, targetSourceFile); + } if (compilerOptions.out) { emitFile(compilerOptions.out); } diagnostics.sort(ts.compareDiagnostics); diagnostics = ts.deduplicateSortedDiagnostics(diagnostics); + var hasEmitterError = ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1 /* Error */; }); + var returnCode; + if (hasEmitterError) { + returnCode = 4 /* EmitErrorsEncountered */; + } + else if (hasSemanticErrors && compilerOptions.declaration) { + returnCode = 3 /* DeclarationGenerationSkipped */; + } + else if (hasSemanticErrors && !compilerOptions.declaration) { + returnCode = 2 /* JSGeneratedWithSemanticErrors */; + } + else { + returnCode = 0 /* Succeeded */; + } return { + emitResultStatus: returnCode, errors: diagnostics, sourceMaps: sourceMapDataList }; @@ -8508,7 +8859,8 @@ var ts; symbolToString: symbolToString, getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType, getRootSymbol: getRootSymbol, - getContextualType: getContextualType + getContextualType: getContextualType, + getFullyQualifiedName: getFullyQualifiedName }; var undefinedSymbol = createSymbol(2 /* Property */ | 33554432 /* Transient */, "undefined"); var argumentsSymbol = createSymbol(2 /* Property */ | 33554432 /* Transient */, "arguments"); @@ -8537,6 +8889,7 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; + var tupleTypes = {}; var stringLiteralTypes = {}; var emitExtends = false; var mergedSymbols = []; @@ -8668,10 +9021,10 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return getAncestor(node, 177 /* SourceFile */); + return ts.getAncestor(node, 182 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 177 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 182 /* SourceFile */ && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -8711,21 +9064,21 @@ var ts; } } switch (location.kind) { - case 177 /* SourceFile */: + case 182 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & ts.SymbolFlags.ModuleMember)) { return returnResolvedSymbol(result); } break; - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 4 /* EnumMember */)) { return returnResolvedSymbol(result); } break; - case 115 /* Property */: - if (location.parent.kind === 169 /* ClassDeclaration */ && !(location.flags & 64 /* Static */)) { + case 119 /* Property */: + if (location.parent.kind === 174 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & ts.SymbolFlags.Value)) { @@ -8734,10 +9087,10 @@ var ts; } } break; - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & ts.SymbolFlags.Type)) { - if (lastLocation && lastLocation.flags & 64 /* Static */) { + if (lastLocation && lastLocation.flags & 128 /* Static */) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } @@ -8746,17 +9099,17 @@ var ts; } } break; - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 167 /* FunctionDeclaration */: - case 137 /* ArrowFunction */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 172 /* FunctionDeclaration */: + case 142 /* ArrowFunction */: if (name === "arguments") { return returnResolvedSymbol(argumentsSymbol); } break; - case 136 /* FunctionExpression */: + case 141 /* FunctionExpression */: if (name === "arguments") { return returnResolvedSymbol(argumentsSymbol); } @@ -8765,7 +9118,7 @@ var ts; return returnResolvedSymbol(location.symbol); } break; - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: var id = location.variable; if (name === id.text) { return returnResolvedSymbol(location.symbol); @@ -8785,7 +9138,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = getDeclarationOfKind(symbol, 174 /* ImportDeclaration */); + var node = getDeclarationOfKind(symbol, 179 /* ImportDeclaration */); var target = node.externalModuleName ? resolveExternalModuleName(node, node.externalModuleName) : getSymbolOfPartOfRightHandSideOfImport(node.entityName, node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; @@ -8801,17 +9154,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = getAncestor(entityName, 174 /* ImportDeclaration */); + importDeclaration = ts.getAncestor(entityName, 179 /* ImportDeclaration */); ts.Debug.assert(importDeclaration); } - if (entityName.kind === 55 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 59 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 55 /* Identifier */ || entityName.parent.kind === 112 /* QualifiedName */) { + if (entityName.kind === 59 /* Identifier */ || entityName.parent.kind === 116 /* QualifiedName */) { return resolveEntityName(importDeclaration, entityName, ts.SymbolFlags.Namespace); } else { - ts.Debug.assert(entityName.parent.kind === 174 /* ImportDeclaration */); + ts.Debug.assert(entityName.parent.kind === 179 /* ImportDeclaration */); return resolveEntityName(importDeclaration, entityName, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace); } } @@ -8819,15 +9172,15 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(location, name, meaning) { - if (name.kind === 55 /* Identifier */) { + if (name.kind === 59 /* Identifier */) { var symbol = resolveName(location, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, ts.identifierToString(name)); if (!symbol) { return; } } - else if (name.kind === 112 /* QualifiedName */) { + else if (name.kind === 116 /* QualifiedName */) { var namespace = resolveEntityName(location, name.left, ts.SymbolFlags.Namespace); - if (!namespace || namespace === unknownSymbol || name.right.kind === 111 /* Missing */) + if (!namespace || namespace === unknownSymbol || name.right.kind === 115 /* Missing */) return; var symbol = getSymbol(namespace.exports, name.right.text, meaning); if (!symbol) { @@ -8916,9 +9269,9 @@ var ts; var seenExportedMember = false; var result = []; ts.forEach(symbol.declarations, function (declaration) { - var block = (declaration.kind === 177 /* SourceFile */ ? declaration : declaration.body); + var block = (declaration.kind === 182 /* SourceFile */ ? declaration : declaration.body); ts.forEach(block.statements, function (node) { - if (node.kind === 175 /* ExportAssignment */) { + if (node.kind === 180 /* ExportAssignment */) { result.push(node); } else { @@ -8960,7 +9313,7 @@ var ts; var members = node.members; for (var i = 0; i < members.length; i++) { var member = members[i]; - if (member.kind === 117 /* Constructor */ && member.body) { + if (member.kind === 121 /* Constructor */ && member.body) { return member; } } @@ -9011,13 +9364,10 @@ var ts; return type; } function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { - return setObjectTypeMembers(createObjectType(8192 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + return setObjectTypeMembers(createObjectType(16384 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function isOptionalProperty(propertySymbol) { - if (propertySymbol.flags & 67108864 /* Prototype */) { - return false; - } - return (propertySymbol.valueDeclaration.flags & 4 /* QuestionMark */) && propertySymbol.valueDeclaration.kind !== 114 /* Parameter */; + return propertySymbol.valueDeclaration && propertySymbol.valueDeclaration.flags & 4 /* QuestionMark */ && propertySymbol.valueDeclaration.kind !== 118 /* Parameter */; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; @@ -9028,17 +9378,17 @@ var ts; } } switch (location.kind) { - case 177 /* SourceFile */: + case 182 /* SourceFile */: if (!ts.isExternalModule(location)) { break; } - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location).members)) { return result; } @@ -9149,7 +9499,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 172 /* ModuleDeclaration */ && declaration.name.kind === 3 /* StringLiteral */) || (declaration.kind === 177 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 177 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 182 /* SourceFile */ && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9159,7 +9509,7 @@ var ts; return { aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 174 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 179 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -9270,7 +9620,10 @@ var ts; else if (type.flags & (1024 /* Class */ | 2048 /* Interface */ | 128 /* Enum */ | 512 /* TypeParameter */)) { writer.writeSymbol(type.symbol, enclosingDeclaration, ts.SymbolFlags.Type); } - else if (type.flags & 8192 /* Anonymous */) { + else if (type.flags & 8192 /* Tuple */) { + writeTupleType(type); + } + else if (type.flags & 16384 /* Anonymous */) { writeAnonymousType(type, allowFunctionOrConstructorTypeLiteral); } else if (type.flags & 256 /* StringLiteral */) { @@ -9280,6 +9633,14 @@ var ts; writer.write("{ ... }"); } } + function writeTypeList(types) { + for (var i = 0; i < types.length; i++) { + if (i > 0) { + writer.write(", "); + } + writeType(types[i], true); + } + } function writeTypeReference(type) { if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { writeType(type.typeArguments[0], false); @@ -9288,15 +9649,15 @@ var ts; else { writer.writeSymbol(type.target.symbol, enclosingDeclaration, ts.SymbolFlags.Type); writer.write("<"); - for (var i = 0; i < type.typeArguments.length; i++) { - if (i > 0) { - writer.write(", "); - } - writeType(type.typeArguments[i], true); - } + writeTypeList(type.typeArguments); writer.write(">"); } } + function writeTupleType(type) { + writer.write("["); + writeTypeList(type.elementTypes); + writer.write("]"); + } function writeAnonymousType(type, allowFunctionOrConstructorTypeLiteral) { if (type.symbol && type.symbol.flags & (16 /* Class */ | 64 /* Enum */ | 128 /* ValueModule */)) { writeTypeofSymbol(type); @@ -9317,8 +9678,8 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 2048 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 64 /* Static */; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 8 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 177 /* SourceFile */ || declaration.parent.kind === 173 /* ModuleBlock */; })); + var isStaticMethodSymbol = !!(type.symbol.flags & 2048 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 8 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 182 /* SourceFile */ || declaration.parent.kind === 178 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2 /* UseTypeOfFunction */) || (typeStack && ts.contains(typeStack, type)); } @@ -9443,12 +9804,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 172 /* ModuleDeclaration */) { - if (node.name.kind === 3 /* StringLiteral */) { + if (node.kind === 177 /* ModuleDeclaration */) { + if (node.name.kind === 7 /* StringLiteral */) { return node; } } - else if (node.kind === 177 /* SourceFile */) { + else if (node.kind === 182 /* SourceFile */) { return ts.isExternalModule(node) ? node : undefined; } } @@ -9490,31 +9851,31 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 166 /* VariableDeclaration */: - case 172 /* ModuleDeclaration */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 167 /* FunctionDeclaration */: - case 171 /* EnumDeclaration */: - case 174 /* ImportDeclaration */: - var parent = node.kind === 166 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (!(node.flags & 1 /* Export */) && !(node.kind !== 174 /* ImportDeclaration */ && parent.kind !== 177 /* SourceFile */ && ts.isInAmbientContext(parent))) { + case 171 /* VariableDeclaration */: + case 177 /* ModuleDeclaration */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 172 /* FunctionDeclaration */: + case 176 /* EnumDeclaration */: + case 179 /* ImportDeclaration */: + var parent = node.kind === 171 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (!(node.flags & 1 /* Export */) && !(node.kind !== 179 /* ImportDeclaration */ && parent.kind !== 182 /* SourceFile */ && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); - case 115 /* Property */: - case 116 /* Method */: - if (node.flags & 32 /* Private */) { + case 119 /* Property */: + case 120 /* Method */: + if (node.flags & (32 /* Private */ | 64 /* Protected */)) { return false; } - case 117 /* Constructor */: - case 121 /* ConstructSignature */: - case 120 /* CallSignature */: - case 122 /* IndexSignature */: - case 114 /* Parameter */: - case 173 /* ModuleBlock */: + case 121 /* Constructor */: + case 125 /* ConstructSignature */: + case 124 /* CallSignature */: + case 126 /* IndexSignature */: + case 118 /* Parameter */: + case 178 /* ModuleBlock */: return isDeclarationVisible(node.parent); - case 177 /* SourceFile */: + case 182 /* SourceFile */: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + ts.SyntaxKind[node.kind]); @@ -9552,16 +9913,16 @@ var ts; return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } function getTypeOfVariableDeclaration(declaration) { - if (declaration.parent.kind === 151 /* ForInStatement */) { + if (declaration.parent.kind === 156 /* ForInStatement */) { return anyType; } if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 114 /* Parameter */) { + if (declaration.kind === 118 /* Parameter */) { var func = declaration.parent; - if (func.kind === 119 /* SetAccessor */) { - var getter = getDeclarationOfKind(declaration.parent.symbol, 118 /* GetAccessor */); + if (func.kind === 123 /* SetAccessor */) { + var getter = getDeclarationOfKind(declaration.parent.symbol, 122 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -9572,10 +9933,13 @@ var ts; } } if (declaration.initializer) { - var unwidenedType = checkAndMarkExpression(declaration.initializer); - var type = getWidenedType(unwidenedType); - if (type !== unwidenedType) { - checkImplicitAny(type); + var type = checkAndMarkExpression(declaration.initializer); + if (declaration.kind !== 134 /* PropertyAssignment */) { + var unwidenedType = type; + type = getWidenedType(type); + if (type !== unwidenedType) { + checkImplicitAny(type); + } } return type; } @@ -9589,14 +9953,14 @@ var ts; if (getInnermostTypeOfNestedArrayTypes(type) !== anyType) { return; } - if (isPrivateWithinAmbient(declaration) || (declaration.kind === 114 /* Parameter */ && isPrivateWithinAmbient(declaration.parent))) { + if (isPrivateWithinAmbient(declaration) || (declaration.kind === 118 /* Parameter */ && isPrivateWithinAmbient(declaration.parent))) { return; } switch (declaration.kind) { - case 115 /* Property */: + case 119 /* Property */: var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 114 /* Parameter */: + case 118 /* Parameter */: var diagnostic = declaration.flags & 8 /* Rest */ ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; default: @@ -9612,7 +9976,7 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.kind === 163 /* CatchBlock */) { + if (declaration.kind === 168 /* CatchBlock */) { return links.type = anyType; } links.type = resolvingType; @@ -9623,6 +9987,10 @@ var ts; } else if (links.type === resolvingType) { links.type = anyType; + if (compilerOptions.noImplicitAny) { + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + } } return links.type; } @@ -9631,7 +9999,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 118 /* GetAccessor */) { + if (accessor.kind === 122 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -9650,8 +10018,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = getDeclarationOfKind(symbol, 118 /* GetAccessor */); - var setter = getDeclarationOfKind(symbol, 119 /* SetAccessor */); + var getter = getDeclarationOfKind(symbol, 122 /* GetAccessor */); + var setter = getDeclarationOfKind(symbol, 123 /* SetAccessor */); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -9668,7 +10036,7 @@ var ts; } else { if (compilerOptions.noImplicitAny) { - error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbol.name); + error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol)); } type = anyType; } @@ -9680,12 +10048,16 @@ var ts; } else if (links.type === resolvingType) { links.type = anyType; + if (compilerOptions.noImplicitAny) { + var getter = getDeclarationOfKind(symbol, 122 /* GetAccessor */); + error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = createObjectType(8192 /* Anonymous */, symbol); + links.type = createObjectType(16384 /* Anonymous */, symbol); } return links.type; } @@ -9744,7 +10116,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 170 /* InterfaceDeclaration */ || node.kind === 169 /* ClassDeclaration */) { + if (node.kind === 175 /* InterfaceDeclaration */ || node.kind === 174 /* ClassDeclaration */) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -9775,7 +10147,7 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = getDeclarationOfKind(symbol, 169 /* ClassDeclaration */); + var declaration = getDeclarationOfKind(symbol, 174 /* ClassDeclaration */); if (declaration.baseType) { var baseType = getTypeFromTypeReferenceNode(declaration.baseType); if (baseType !== unknownType) { @@ -9815,7 +10187,7 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 170 /* InterfaceDeclaration */ && declaration.baseTypes) { + if (declaration.kind === 175 /* InterfaceDeclaration */ && declaration.baseTypes) { ts.forEach(declaration.baseTypes, function (node) { var baseType = getTypeFromTypeReferenceNode(node); if (baseType !== unknownType) { @@ -9856,7 +10228,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!getDeclarationOfKind(symbol, 113 /* TypeParameter */).constraint) { + if (!getDeclarationOfKind(symbol, 117 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -9983,6 +10355,21 @@ var ts; } return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; } + function createTupleTypeMemberSymbols(memberTypes) { + var members = {}; + for (var i = 0; i < memberTypes.length; i++) { + var symbol = createSymbol(2 /* Property */ | 33554432 /* Transient */, "" + i); + symbol.type = memberTypes[i]; + members[i] = symbol; + } + return members; + } + function resolveTupleTypeMembers(type) { + var arrayType = resolveObjectTypeMembers(createArrayType(getBestCommonType(type.elementTypes))); + var members = createTupleTypeMemberSymbols(type.elementTypes); + addInheritedMembers(members, arrayType.properties); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; if (symbol.flags & 512 /* TypeLiteral */) { @@ -10023,9 +10410,12 @@ var ts; if (type.flags & (1024 /* Class */ | 2048 /* Interface */)) { resolveClassOrInterfaceMembers(type); } - else if (type.flags & 8192 /* Anonymous */) { + else if (type.flags & 16384 /* Anonymous */) { resolveAnonymousTypeMembers(type); } + else if (type.flags & 8192 /* Tuple */) { + resolveTupleTypeMembers(type); + } else { resolveTypeReferenceMembers(type); } @@ -10092,7 +10482,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 117 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 121 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; @@ -10100,7 +10490,7 @@ var ts; for (var i = 0, n = declaration.parameters.length; i < n; i++) { var param = declaration.parameters[i]; parameters.push(param.symbol); - if (param.type && param.type.kind === 3 /* StringLiteral */) { + if (param.type && param.type.kind === 7 /* StringLiteral */) { hasStringLiterals = true; } if (minArgumentCount < 0) { @@ -10120,8 +10510,8 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 118 /* GetAccessor */) { - var setter = getDeclarationOfKind(declaration.symbol, 119 /* SetAccessor */); + if (declaration.kind === 122 /* GetAccessor */) { + var setter = getDeclarationOfKind(declaration.symbol, 123 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && !declaration.body) { @@ -10139,16 +10529,16 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 167 /* FunctionDeclaration */: - case 116 /* Method */: - case 117 /* Constructor */: - case 120 /* CallSignature */: - case 121 /* ConstructSignature */: - case 122 /* IndexSignature */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 172 /* FunctionDeclaration */: + case 120 /* Method */: + case 121 /* Constructor */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + case 126 /* IndexSignature */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -10175,6 +10565,15 @@ var ts; } else if (signature.resolvedReturnType === resolvingType) { signature.resolvedReturnType = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.identifierToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } + } } return signature.resolvedReturnType; } @@ -10205,8 +10604,8 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 117 /* Constructor */ || signature.declaration.kind === 121 /* ConstructSignature */; - var type = createObjectType(8192 /* Anonymous */ | 16384 /* FromSignature */); + var isConstructor = signature.declaration.kind === 121 /* Constructor */ || signature.declaration.kind === 125 /* ConstructSignature */; + var type = createObjectType(16384 /* Anonymous */ | 32768 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; type.callSignatures = !isConstructor ? [signature] : emptyArray; @@ -10219,7 +10618,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 108 /* NumberKeyword */ : 110 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 112 /* NumberKeyword */ : 114 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; @@ -10246,7 +10645,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(getDeclarationOfKind(type.symbol, 113 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(getDeclarationOfKind(type.symbol, 117 /* TypeParameter */).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -10286,13 +10685,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 113 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 117 /* TypeParameter */; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 123 /* TypeReference */ && n.typeName.kind === 55 /* Identifier */) { + if (n.kind === 127 /* TypeReference */ && n.typeName.kind === 59 /* Identifier */) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, ts.SymbolFlags.Type, undefined, undefined); @@ -10325,7 +10724,7 @@ var ts; if (type.flags & (1024 /* Class */ | 2048 /* Interface */) && type.flags & 4096 /* Reference */) { var typeParameters = type.typeParameters; if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, ts.map(node.typeArguments, function (t) { return getTypeFromTypeNode(t); })); + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); } else { error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */), typeParameters.length); @@ -10357,9 +10756,9 @@ var ts; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; switch (declaration.kind) { - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 171 /* EnumDeclaration */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: return declaration; } } @@ -10395,10 +10794,26 @@ var ts; } return links.resolvedType; } + function createTupleType(elementTypes) { + var id = getTypeListId(elementTypes); + var type = tupleTypes[id]; + if (!type) { + type = tupleTypes[id] = createObjectType(8192 /* Tuple */); + type.elementTypes = elementTypes; + } + return type; + } + function getTypeFromTupleTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + } + return links.resolvedType; + } function getTypeFromTypeLiteralNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createObjectType(8192 /* Anonymous */, node.symbol); + links.resolvedType = createObjectType(16384 /* Anonymous */, node.symbol); } return links.resolvedType; } @@ -10418,30 +10833,32 @@ var ts; } function getTypeFromTypeNode(node) { switch (node.kind) { - case 101 /* AnyKeyword */: + case 105 /* AnyKeyword */: return anyType; - case 110 /* StringKeyword */: + case 114 /* StringKeyword */: return stringType; - case 108 /* NumberKeyword */: + case 112 /* NumberKeyword */: return numberType; - case 102 /* BooleanKeyword */: + case 106 /* BooleanKeyword */: return booleanType; - case 89 /* VoidKeyword */: + case 93 /* VoidKeyword */: return voidType; - case 3 /* StringLiteral */: + case 7 /* StringLiteral */: return getTypeFromStringLiteral(node); - case 123 /* TypeReference */: + case 127 /* TypeReference */: return getTypeFromTypeReferenceNode(node); - case 124 /* TypeQuery */: + case 128 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 126 /* ArrayType */: + case 130 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 125 /* TypeLiteral */: + case 131 /* TupleType */: + return getTypeFromTupleTypeNode(node); + case 129 /* TypeLiteral */: return getTypeFromTypeLiteralNode(node); - case 55 /* Identifier */: - case 112 /* QualifiedName */: + case 59 /* Identifier */: + case 116 /* QualifiedName */: var symbol = getSymbolInfo(node); - return getDeclaredTypeOfSymbol(symbol); + return symbol && getDeclaredTypeOfSymbol(symbol); default: return unknownType; } @@ -10553,7 +10970,7 @@ var ts; return result; } function instantiateAnonymousType(type, mapper) { - var result = createObjectType(8192 /* Anonymous */, type.symbol); + var result = createObjectType(16384 /* Anonymous */, type.symbol); result.properties = instantiateList(getPropertiesOfType(type), mapper, instantiateSymbol); result.members = createSymbolTable(result.properties); result.callSignatures = instantiateList(getSignaturesOfType(type, 0 /* Call */), mapper, instantiateSignature); @@ -10571,28 +10988,31 @@ var ts; if (type.flags & 512 /* TypeParameter */) { return mapper(type); } - if (type.flags & 8192 /* Anonymous */) { + if (type.flags & 16384 /* Anonymous */) { return type.symbol && type.symbol.flags & (8 /* Function */ | 2048 /* Method */ | 512 /* TypeLiteral */ | 1024 /* ObjectLiteral */) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096 /* Reference */) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); } + if (type.flags & 8192 /* Tuple */) { + return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); + } } return type; } function isContextSensitiveExpression(node) { switch (node.kind) { - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: return !node.typeParameters && !ts.forEach(node.parameters, function (p) { return p.type; }); - case 128 /* ObjectLiteral */: - return ts.forEach(node.properties, function (p) { return p.kind === 129 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); - case 127 /* ArrayLiteral */: + case 133 /* ObjectLiteral */: + return ts.forEach(node.properties, function (p) { return p.kind === 134 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); + case 132 /* ArrayLiteral */: return ts.forEach(node.elements, function (e) { return isContextSensitiveExpression(e); }); - case 141 /* ConditionalExpression */: + case 146 /* ConditionalExpression */: return isContextSensitiveExpression(node.whenTrue) || isContextSensitiveExpression(node.whenFalse); - case 140 /* BinaryExpression */: - return node.operator === 40 /* BarBarToken */ && (isContextSensitiveExpression(node.left) || isContextSensitiveExpression(node.right)); + case 145 /* BinaryExpression */: + return node.operator === 44 /* BarBarToken */ && (isContextSensitiveExpression(node.left) || isContextSensitiveExpression(node.right)); } return false; } @@ -10600,7 +11020,7 @@ var ts; if (type.flags & ts.TypeFlags.ObjectType) { var resolved = resolveObjectTypeMembers(type); if (resolved.constructSignatures.length) { - var result = createObjectType(8192 /* Anonymous */, type.symbol); + var result = createObjectType(16384 /* Anonymous */, type.symbol); result.members = resolved.members; result.properties = resolved.properties; result.callSignatures = resolved.callSignatures; @@ -10673,17 +11093,16 @@ var ts; return ok; } function isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, relate) { - ts.Debug.assert(sourceProp); - if (!targetProp) { + if (sourceProp === targetProp) { + return true; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); + if (sourcePropAccessibility !== targetPropAccessibility) { return false; } - var sourcePropIsPrivate = getDeclarationFlagsFromSymbol(sourceProp) & 32 /* Private */; - var targetPropIsPrivate = getDeclarationFlagsFromSymbol(targetProp) & 32 /* Private */; - if (sourcePropIsPrivate !== targetPropIsPrivate) { - return false; - } - if (sourcePropIsPrivate) { - return (getTargetSymbol(sourceProp).parent === getTargetSymbol(targetProp).parent) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (sourcePropAccessibility) { + return getTargetSymbol(sourceProp) === getTargetSymbol(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); } else { return isOptionalProperty(sourceProp) === isOptionalProperty(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); @@ -10705,8 +11124,8 @@ var ts; addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, program.getCompilerHost().getNewLine())); } return result; - function reportError(message, arg0, arg1) { - errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1); + function reportError(message, arg0, arg1, arg2) { + errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } function isRelatedTo(source, target, reportErrors) { return isRelatedToWithCustomErrors(source, target, reportErrors, undefined, undefined); @@ -10858,9 +11277,6 @@ var ts; } } function propertiesAreIdenticalTo(source, target, reportErrors) { - if (source === target) { - return true; - } var sourceProperties = getPropertiesOfType(source); var targetProperties = getPropertiesOfType(target); if (sourceProperties.length !== targetProperties.length) { @@ -10869,7 +11285,7 @@ var ts; for (var i = 0, len = sourceProperties.length; i < len; ++i) { var sourceProp = sourceProperties[i]; var targetProp = getPropertyOfType(target, sourceProp.name); - if (!isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, isRelatedTo)) { + if (!targetProp || !isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, isRelatedTo)) { return false; } } @@ -10880,39 +11296,60 @@ var ts; for (var i = 0; i < properties.length; i++) { var targetProp = properties[i]; var sourceProp = getPropertyOfApparentType(source, targetProp.name); - if (sourceProp === targetProp) { - continue; - } - var targetPropIsOptional = isOptionalProperty(targetProp); - if (!sourceProp) { - if (!targetPropIsOptional) { - if (reportErrors) { - reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); + if (sourceProp !== targetProp) { + if (!sourceProp) { + if (!isOptionalProperty(targetProp)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); + } + return false; } - return false; } - } - else if (sourceProp !== targetProp) { - if (targetProp.flags & 67108864 /* Prototype */) { - continue; - } - if (getDeclarationFlagsFromSymbol(sourceProp) & 32 /* Private */ || getDeclarationFlagsFromSymbol(targetProp) & 32 /* Private */) { - if (reportErrors) { - reportError(ts.Diagnostics.Private_property_0_cannot_be_reimplemented, symbolToString(targetProp)); + else if (!(targetProp.flags & 67108864 /* Prototype */)) { + var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); + var targetFlags = getDeclarationFlagsFromSymbol(targetProp); + if (sourceFlags & 32 /* Private */ || targetFlags & 32 /* Private */) { + if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (reportErrors) { + if (sourceFlags & 32 /* Private */ && targetFlags & 32 /* Private */) { + reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } + else { + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourceFlags & 32 /* Private */ ? source : target), typeToString(sourceFlags & 32 /* Private */ ? target : source)); + } + } + return false; + } } - return false; - } - if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) { - if (reportErrors) { - reportError(ts.Diagnostics.Types_of_property_0_are_incompatible_Colon, symbolToString(targetProp)); + else if (targetFlags & 64 /* Protected */) { + var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 16 /* Class */; + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; + var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + } + return false; + } } - return false; - } - else if (isOptionalProperty(sourceProp) && !targetPropIsOptional) { - if (reportErrors) { - reportError(ts.Diagnostics.Required_property_0_cannot_be_reimplemented_with_optional_property_in_1, targetProp.name, typeToString(source)); + else if (sourceFlags & 64 /* Protected */) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return false; + } + if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_property_0_are_incompatible_Colon, symbolToString(targetProp)); + } + return false; + } + if (isOptionalProperty(sourceProp) && !isOptionalProperty(targetProp)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return false; } - return false; } } } @@ -10986,11 +11423,11 @@ var ts; var saveErrorInfo = errorInfo; outer: for (var i = 0; i < targetSignatures.length; i++) { var t = targetSignatures[i]; - if (!t.hasStringLiterals || target.flags & 16384 /* FromSignature */) { + if (!t.hasStringLiterals || target.flags & 32768 /* FromSignature */) { var localErrors = reportErrors; for (var j = 0; j < sourceSignatures.length; j++) { var s = sourceSignatures[j]; - if (!s.hasStringLiterals || source.flags & 16384 /* FromSignature */) { + if (!s.hasStringLiterals || source.flags & 32768 /* FromSignature */) { if (isSignatureSubtypeOrAssignableTo(s, t, localErrors)) { errorInfo = saveErrorInfo; continue outer; @@ -11125,7 +11562,7 @@ var ts; return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }) || (candidatesOnly ? undefined : emptyObjectType); } function isTypeOfObjectLiteral(type) { - return (type.flags & 8192 /* Anonymous */) && type.symbol && (type.symbol.flags & 1024 /* ObjectLiteral */) ? true : false; + return (type.flags & 16384 /* Anonymous */) && type.symbol && (type.symbol.flags & 1024 /* ObjectLiteral */) ? true : false; } function isArrayType(type) { return type.flags & 4096 /* Reference */ && type.target === globalArrayType; @@ -11274,7 +11711,7 @@ var ts; inferFromTypes(sourceTypes[i], targetTypes[i]); } } - else if (source.flags & ts.TypeFlags.ObjectType && (target.flags & 4096 /* Reference */ || (target.flags & 8192 /* Anonymous */) && target.symbol && target.symbol.flags & (2048 /* Method */ | 512 /* TypeLiteral */))) { + else if (source.flags & ts.TypeFlags.ObjectType && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || (target.flags & 16384 /* Anonymous */) && target.symbol && target.symbol.flags & (2048 /* Method */ | 512 /* TypeLiteral */))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -11345,47 +11782,16 @@ var ts; return context.inferredTypes; } function hasAncestor(node, kind) { - return getAncestor(node, kind) !== undefined; - } - function getAncestor(node, kind) { - switch (kind) { - case 169 /* ClassDeclaration */: - while (node) { - switch (node.kind) { - case 169 /* ClassDeclaration */: - return node; - case 171 /* EnumDeclaration */: - case 170 /* InterfaceDeclaration */: - case 172 /* ModuleDeclaration */: - case 174 /* ImportDeclaration */: - return undefined; - default: - node = node.parent; - continue; - } - } - break; - default: - while (node) { - if (node.kind === kind) { - return node; - } - else { - node = node.parent; - } - } - break; - } - return undefined; + return ts.getAncestor(node, kind) !== undefined; } function checkIdentifier(node) { function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 124 /* TypeQuery */: + case 128 /* TypeQuery */: return true; - case 55 /* Identifier */: - case 112 /* QualifiedName */: + case 59 /* Identifier */: + case 116 /* QualifiedName */: node = node.parent; continue; default: @@ -11407,32 +11813,10 @@ var ts; checkCollisionWithIndexVariableInGeneratedCode(node, node); return getTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol)); } - function getThisContainer(node) { - while (true) { - node = node.parent; - if (!node) { - return node; - } - switch (node.kind) { - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 172 /* ModuleDeclaration */: - case 115 /* Property */: - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 171 /* EnumDeclaration */: - case 177 /* SourceFile */: - case 137 /* ArrowFunction */: - return node; - } - } - } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 169 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 174 /* ClassDeclaration */ ? container.parent : undefined; getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 115 /* Property */ || container.kind === 117 /* Constructor */) { + if (container.kind === 119 /* Property */ || container.kind === 121 /* Constructor */) { getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } else { @@ -11440,26 +11824,26 @@ var ts; } } function checkThisExpression(node) { - var container = getThisContainer(node); + var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - while (container.kind === 137 /* ArrowFunction */) { - container = getThisContainer(container); + if (container.kind === 142 /* ArrowFunction */) { + container = ts.getThisContainer(container, false); needToCaptureLexicalThis = true; } switch (container.kind) { - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 117 /* Constructor */: + case 121 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 115 /* Property */: - if (container.flags & 64 /* Static */) { + case 119 /* Property */: + if (container.flags & 128 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; @@ -11467,10 +11851,10 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 169 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 174 /* ClassDeclaration */ ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); - return container.flags & 64 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); } return anyType; } @@ -11480,29 +11864,29 @@ var ts; if (!node) return node; switch (node.kind) { - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: - case 115 /* Property */: - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: + case 119 /* Property */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: return node; } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 114 /* Parameter */) { + if (n.kind === 118 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 132 /* CallExpression */ && node.parent.func === node; - var enclosingClass = getAncestor(node, 169 /* ClassDeclaration */); + var isCallExpression = node.parent.kind === 137 /* CallExpression */ && node.parent.func === node; + var enclosingClass = ts.getAncestor(node, 174 /* ClassDeclaration */); var baseClass; if (enclosingClass && enclosingClass.baseType) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -11516,26 +11900,26 @@ var ts; if (container) { var canUseSuperExpression = false; if (isCallExpression) { - canUseSuperExpression = container.kind === 117 /* Constructor */; + canUseSuperExpression = container.kind === 121 /* Constructor */; } else { var needToCaptureLexicalThis = false; - while (container && container.kind === 137 /* ArrowFunction */) { + while (container && container.kind === 142 /* ArrowFunction */) { container = getSuperContainer(container); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 169 /* ClassDeclaration */) { - if (container.flags & 64 /* Static */) { - canUseSuperExpression = container.kind === 116 /* Method */ || container.kind === 118 /* GetAccessor */ || container.kind === 119 /* SetAccessor */; + if (container && container.parent && container.parent.kind === 174 /* ClassDeclaration */) { + if (container.flags & 128 /* Static */) { + canUseSuperExpression = container.kind === 120 /* Method */ || container.kind === 122 /* GetAccessor */ || container.kind === 123 /* SetAccessor */; } else { - canUseSuperExpression = container.kind === 116 /* Method */ || container.kind === 118 /* GetAccessor */ || container.kind === 119 /* SetAccessor */ || container.kind === 115 /* Property */ || container.kind === 117 /* Constructor */; + canUseSuperExpression = container.kind === 120 /* Method */ || container.kind === 122 /* GetAccessor */ || container.kind === 123 /* SetAccessor */ || container.kind === 119 /* Property */ || container.kind === 121 /* Constructor */; } } } if (canUseSuperExpression) { var returnType; - if ((container.flags & 64 /* Static */) || isCallExpression) { + if ((container.flags & 128 /* Static */) || isCallExpression) { getNodeLinks(node).flags |= 32 /* SuperStatic */; returnType = getTypeOfSymbol(baseClass.symbol); } @@ -11543,7 +11927,7 @@ var ts; getNodeLinks(node).flags |= 16 /* SuperInstance */; returnType = baseClass; } - if (container.kind === 117 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 121 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; } @@ -11563,7 +11947,7 @@ var ts; } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; - if (func.kind === 136 /* FunctionExpression */ || func.kind === 137 /* ArrowFunction */) { + if (func.kind === 141 /* FunctionExpression */ || func.kind === 142 /* ArrowFunction */) { if (isContextSensitiveExpression(func)) { var signature = getContextualSignature(func); if (signature) { @@ -11579,16 +11963,16 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 114 /* Parameter */) { + if (declaration.kind === 118 /* Parameter */) { return getContextuallyTypedParameterType(declaration); } } return undefined; } function getContextualTypeForReturnExpression(node) { - var func = getContainingFunction(node); + var func = ts.getContainingFunction(node); if (func) { - if (func.type || func.kind === 117 /* Constructor */ || func.kind === 118 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 119 /* SetAccessor */))) { + if (func.type || func.kind === 121 /* Constructor */ || func.kind === 122 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 123 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } var signature = getContextualSignature(func); @@ -11615,7 +11999,7 @@ var ts; return checkExpression(binaryExpression.left); } } - else if (operator === 40 /* BarBarToken */) { + else if (operator === 44 /* BarBarToken */) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -11641,37 +12025,48 @@ var ts; function getContextualTypeForElementExpression(node) { var arrayLiteral = node.parent; var type = getContextualType(arrayLiteral); - return type ? getIndexTypeOfType(type, 1 /* Number */) : undefined; + if (type) { + var index = ts.indexOf(arrayLiteral.elements, node); + var prop = getPropertyOfType(type, "" + index); + if (prop) { + return getTypeOfSymbol(prop); + } + return getIndexTypeOfType(type, 1 /* Number */); + } + return undefined; } function getContextualTypeForConditionalOperand(node) { var conditional = node.parent; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualType(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } if (node.contextualType) { return node.contextualType; } var parent = node.parent; switch (parent.kind) { - case 166 /* VariableDeclaration */: - case 114 /* Parameter */: - case 115 /* Property */: + case 171 /* VariableDeclaration */: + case 118 /* Parameter */: + case 119 /* Property */: return getContextualTypeForInitializerExpression(node); - case 137 /* ArrowFunction */: - case 154 /* ReturnStatement */: + case 142 /* ArrowFunction */: + case 159 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 132 /* CallExpression */: - case 133 /* NewExpression */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: return getContextualTypeForArgument(node); - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return getTypeFromTypeNode(parent.type); - case 140 /* BinaryExpression */: + case 145 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 129 /* PropertyAssignment */: + case 134 /* PropertyAssignment */: return getContextualTypeForPropertyExpression(node); - case 127 /* ArrayLiteral */: + case 132 /* ArrayLiteral */: return getContextualTypeForElementExpression(node); - case 141 /* ConditionalExpression */: + case 146 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); } return undefined; @@ -11693,19 +12088,26 @@ var ts; return mapper && mapper !== identityMapper; } function checkArrayLiteral(node, contextualMapper) { + var contextualType = getContextualType(node); + var elements = node.elements; var elementTypes = []; - ts.forEach(node.elements, function (element) { - if (element.kind !== 142 /* OmittedExpression */) { - var type = checkExpression(element, contextualMapper); - if (!ts.contains(elementTypes, type)) - elementTypes.push(type); + var isTupleLiteral = false; + for (var i = 0; i < elements.length; i++) { + if (contextualType && getPropertyOfType(contextualType, "" + i)) { + isTupleLiteral = true; } - }); - var contextualType = isInferentialContext(contextualMapper) ? undefined : getContextualType(node); - var contextualElementType = contextualType && getIndexTypeOfType(contextualType, 1 /* Number */); - var elementType = getBestCommonType(elementTypes, contextualElementType, true); - if (!elementType) - elementType = elementTypes.length ? emptyObjectType : undefinedType; + var element = elements[i]; + var type = element.kind !== 147 /* OmittedExpression */ ? checkExpression(element, contextualMapper) : undefinedType; + elementTypes.push(type); + } + if (isTupleLiteral) { + return createTupleType(elementTypes); + } + var contextualElementType = contextualType && !isInferentialContext(contextualMapper) ? getIndexTypeOfType(contextualType, 1 /* Number */) : undefined; + var elementType = getBestCommonType(ts.uniqueElements(elementTypes), contextualElementType, true); + if (!elementType) { + elementType = elements.length ? emptyObjectType : undefinedType; + } return createArrayType(elementType); } function isNumericName(name) { @@ -11730,11 +12132,11 @@ var ts; member = prop; } else { - var getAccessor = getDeclarationOfKind(member, 118 /* GetAccessor */); + var getAccessor = getDeclarationOfKind(member, 122 /* GetAccessor */); if (getAccessor) { checkAccessorDeclaration(getAccessor); } - var setAccessor = getDeclarationOfKind(member, 119 /* SetAccessor */); + var setAccessor = getDeclarationOfKind(member, 123 /* SetAccessor */); if (setAccessor) { checkAccessorDeclaration(setAccessor); } @@ -11765,10 +12167,38 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.flags & 67108864 /* Prototype */ ? 115 /* Property */ : s.valueDeclaration.kind; + return s.valueDeclaration ? s.valueDeclaration.kind : 119 /* Property */; } function getDeclarationFlagsFromSymbol(s) { - return s.flags & 67108864 /* Prototype */ ? 16 /* Public */ | 64 /* Static */ : s.valueDeclaration.flags; + return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & 67108864 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; + } + function checkClassPropertyAccess(node, type, prop) { + var flags = getDeclarationFlagsFromSymbol(prop); + if (!(flags & (32 /* Private */ | 64 /* Protected */))) { + return; + } + var enclosingClassDeclaration = ts.getAncestor(node, 174 /* ClassDeclaration */); + var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; + var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + if (flags & 32 /* Private */) { + if (declaringClass !== enclosingClass) { + error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + } + return; + } + if (node.left.kind === 85 /* SuperKeyword */) { + return; + } + if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + return; + } + if (flags & 128 /* Static */) { + return; + } + if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + } } function checkPropertyAccess(node) { var type = checkExpression(node.left); @@ -11788,14 +12218,11 @@ var ts; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 16 /* Class */) { - if (node.left.kind === 81 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 116 /* Method */) { - error(node.right, ts.Diagnostics.Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword); + if (node.left.kind === 85 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 120 /* Method */) { + error(node.right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } - else if (getDeclarationFlagsFromSymbol(prop) & 32 /* Private */) { - var classDeclaration = getAncestor(node, 169 /* ClassDeclaration */); - if (!classDeclaration || !ts.contains(prop.parent.declarations, classDeclaration)) { - error(node, ts.Diagnostics.Property_0_is_inaccessible, getFullyQualifiedName(prop)); - } + else { + checkClassPropertyAccess(node, type, prop); } } return getTypeOfSymbol(prop); @@ -11811,7 +12238,7 @@ var ts; if (apparentType === unknownType) { return unknownType; } - if (node.index.kind === 3 /* StringLiteral */ || node.index.kind === 2 /* NumericLiteral */) { + if (node.index.kind === 7 /* StringLiteral */ || node.index.kind === 6 /* NumericLiteral */) { var name = node.index.text; var prop = getPropertyOfApparentType(apparentType, name); if (prop) { @@ -11939,7 +12366,7 @@ var ts; for (var i = 0; i < node.arguments.length; i++) { var arg = node.arguments[i]; var paramType = getTypeAtPosition(signature, i); - var argType = arg.kind === 3 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = arg.kind === 7 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); if (!isValidArgument) { return false; @@ -11992,7 +12419,7 @@ var ts; return resolveErrorCall(node); } function resolveCallExpression(node) { - if (node.func.kind === 81 /* SuperKeyword */) { + if (node.func.kind === 85 /* SuperKeyword */) { var superType = checkSuperExpression(node.func); if (superType !== unknownType) { return resolveCall(node, getSignaturesOfType(superType, 1 /* Construct */)); @@ -12060,18 +12487,18 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature) { links.resolvedSignature = anySignature; - links.resolvedSignature = node.kind === 132 /* CallExpression */ ? resolveCallExpression(node) : resolveNewExpression(node); + links.resolvedSignature = node.kind === 137 /* CallExpression */ ? resolveCallExpression(node) : resolveNewExpression(node); } return links.resolvedSignature; } function checkCallExpression(node) { var signature = getResolvedSignature(node); - if (node.func.kind === 81 /* SuperKeyword */) { + if (node.func.kind === 85 /* SuperKeyword */) { return voidType; } - if (node.kind === 133 /* NewExpression */) { + if (node.kind === 138 /* NewExpression */) { var declaration = signature.declaration; - if (declaration && (declaration.kind !== 117 /* Constructor */ && declaration.kind !== 121 /* ConstructSignature */)) { + if (declaration && (declaration.kind !== 121 /* Constructor */ && declaration.kind !== 125 /* ConstructSignature */)) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -12108,7 +12535,7 @@ var ts; } } function getReturnTypeFromBody(func, contextualMapper) { - if (func.body.kind !== 168 /* FunctionBlock */) { + if (func.body.kind !== 173 /* FunctionBlock */) { var unwidenedType = checkAndMarkExpression(func.body, contextualMapper); var widenedType = getWidenedType(unwidenedType); if (fullTypeCheck && compilerOptions.noImplicitAny && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { @@ -12137,35 +12564,9 @@ var ts; } return voidType; } - function forEachReturnStatement(body, visitor) { - return traverse(body); - function traverse(node) { - switch (node.kind) { - case 154 /* ReturnStatement */: - return visitor(node); - case 143 /* Block */: - case 168 /* FunctionBlock */: - case 147 /* IfStatement */: - case 148 /* DoStatement */: - case 149 /* WhileStatement */: - case 150 /* ForStatement */: - case 151 /* ForInStatement */: - case 155 /* WithStatement */: - case 156 /* SwitchStatement */: - case 157 /* CaseClause */: - case 158 /* DefaultClause */: - case 159 /* LabelledStatement */: - case 161 /* TryStatement */: - case 162 /* TryBlock */: - case 163 /* CatchBlock */: - case 164 /* FinallyBlock */: - return ts.forEachChild(node, traverse); - } - } - } function checkAndAggregateReturnExpressionTypes(body, contextualMapper) { var aggregatedTypes = []; - forEachReturnStatement(body, function (returnStatement) { + ts.forEachReturnStatement(body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { var type = checkAndMarkExpression(expr, contextualMapper); @@ -12177,12 +12578,12 @@ var ts; return aggregatedTypes; } function bodyContainsAReturnStatement(funcBody) { - return forEachReturnStatement(funcBody, function (returnStatement) { + return ts.forEachReturnStatement(funcBody, function (returnStatement) { return true; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 160 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 165 /* ThrowStatement */); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!fullTypeCheck) { @@ -12191,7 +12592,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (!func.body || func.body.kind !== 168 /* FunctionBlock */) { + if (!func.body || func.body.kind !== 173 /* FunctionBlock */) { return; } var bodyBlock = func.body; @@ -12235,7 +12636,7 @@ var ts; if (node.type) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } - if (node.body.kind === 168 /* FunctionBlock */) { + if (node.body.kind === 173 /* FunctionBlock */) { checkSourceElement(node.body); } else { @@ -12260,15 +12661,15 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 55 /* Identifier */: + case 59 /* Identifier */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 1 /* Variable */) !== 0; - case 130 /* PropertyAccess */: + case 135 /* PropertyAccess */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~4 /* EnumMember */) !== 0; - case 131 /* IndexedAccess */: + case 136 /* IndexedAccess */: return true; - case 135 /* ParenExpression */: + case 140 /* ParenExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -12283,19 +12684,19 @@ var ts; function checkPrefixExpression(node) { var operandType = checkExpression(node.operand); switch (node.operator) { - case 24 /* PlusToken */: - case 25 /* MinusToken */: - case 38 /* TildeToken */: + case 28 /* PlusToken */: + case 29 /* MinusToken */: + case 42 /* TildeToken */: return numberType; - case 37 /* ExclamationToken */: - case 64 /* DeleteKeyword */: + case 41 /* ExclamationToken */: + case 68 /* DeleteKeyword */: return booleanType; - case 87 /* TypeOfKeyword */: + case 91 /* TypeOfKeyword */: return stringType; - case 89 /* VoidKeyword */: + case 93 /* VoidKeyword */: return undefinedType; - case 29 /* PlusPlusToken */: - case 30 /* MinusMinusToken */: + case 33 /* PlusPlusToken */: + case 34 /* MinusMinusToken */: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer); @@ -12338,26 +12739,26 @@ var ts; var leftType = checkExpression(node.left, contextualMapper); var rightType = checkExpression(node.right, contextualMapper); switch (operator) { - case 26 /* AsteriskToken */: - case 46 /* AsteriskEqualsToken */: - case 27 /* SlashToken */: - case 47 /* SlashEqualsToken */: - case 28 /* PercentToken */: - case 48 /* PercentEqualsToken */: - case 25 /* MinusToken */: - case 45 /* MinusEqualsToken */: - case 31 /* LessThanLessThanToken */: - case 49 /* LessThanLessThanEqualsToken */: - case 32 /* GreaterThanGreaterThanToken */: - case 50 /* GreaterThanGreaterThanEqualsToken */: - case 33 /* GreaterThanGreaterThanGreaterThanToken */: - case 51 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 35 /* BarToken */: - case 53 /* BarEqualsToken */: - case 36 /* CaretToken */: - case 54 /* CaretEqualsToken */: - case 34 /* AmpersandToken */: - case 52 /* AmpersandEqualsToken */: + case 30 /* AsteriskToken */: + case 50 /* AsteriskEqualsToken */: + case 31 /* SlashToken */: + case 51 /* SlashEqualsToken */: + case 32 /* PercentToken */: + case 52 /* PercentEqualsToken */: + case 29 /* MinusToken */: + case 49 /* MinusEqualsToken */: + case 35 /* LessThanLessThanToken */: + case 53 /* LessThanLessThanEqualsToken */: + case 36 /* GreaterThanGreaterThanToken */: + case 54 /* GreaterThanGreaterThanEqualsToken */: + case 37 /* GreaterThanGreaterThanGreaterThanToken */: + case 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 39 /* BarToken */: + case 57 /* BarEqualsToken */: + case 40 /* CaretToken */: + case 58 /* CaretEqualsToken */: + case 38 /* AmpersandToken */: + case 56 /* AmpersandEqualsToken */: if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) leftType = rightType; if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) @@ -12368,8 +12769,8 @@ var ts; checkAssignmentOperator(numberType); } return numberType; - case 24 /* PlusToken */: - case 44 /* PlusEqualsToken */: + case 28 /* PlusToken */: + case 48 /* PlusEqualsToken */: if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) leftType = rightType; if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) @@ -12388,34 +12789,34 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 44 /* PlusEqualsToken */) { + if (operator === 48 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; - case 19 /* EqualsEqualsToken */: - case 20 /* ExclamationEqualsToken */: - case 21 /* EqualsEqualsEqualsToken */: - case 22 /* ExclamationEqualsEqualsToken */: - case 15 /* LessThanToken */: - case 16 /* GreaterThanToken */: - case 17 /* LessThanEqualsToken */: - case 18 /* GreaterThanEqualsToken */: + case 23 /* EqualsEqualsToken */: + case 24 /* ExclamationEqualsToken */: + case 25 /* EqualsEqualsEqualsToken */: + case 26 /* ExclamationEqualsEqualsToken */: + case 19 /* LessThanToken */: + case 20 /* GreaterThanToken */: + case 21 /* LessThanEqualsToken */: + case 22 /* GreaterThanEqualsToken */: if (!isTypeSubtypeOf(leftType, rightType) && !isTypeSubtypeOf(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 77 /* InstanceOfKeyword */: + case 81 /* InstanceOfKeyword */: return checkInstanceOfExpression(node, leftType, rightType); - case 76 /* InKeyword */: + case 80 /* InKeyword */: return checkInExpression(node, leftType, rightType); - case 39 /* AmpersandAmpersandToken */: + case 43 /* AmpersandAmpersandToken */: return rightType; - case 40 /* BarBarToken */: + case 44 /* BarBarToken */: return getBestCommonType([leftType, rightType], isInferentialContext(contextualMapper) ? undefined : getContextualType(node)); - case 43 /* EqualsToken */: + case 47 /* EqualsToken */: checkAssignmentOperator(rightType); return rightType; - case 14 /* CommaToken */: + case 18 /* CommaToken */: return rightType; } function checkAssignmentOperator(valueType) { @@ -12477,50 +12878,50 @@ var ts; } function checkExpressionNode(node, contextualMapper) { switch (node.kind) { - case 55 /* Identifier */: + case 59 /* Identifier */: return checkIdentifier(node); - case 83 /* ThisKeyword */: + case 87 /* ThisKeyword */: return checkThisExpression(node); - case 81 /* SuperKeyword */: + case 85 /* SuperKeyword */: return checkSuperExpression(node); - case 79 /* NullKeyword */: + case 83 /* NullKeyword */: return nullType; - case 85 /* TrueKeyword */: - case 70 /* FalseKeyword */: + case 89 /* TrueKeyword */: + case 74 /* FalseKeyword */: return booleanType; - case 2 /* NumericLiteral */: + case 6 /* NumericLiteral */: return numberType; - case 3 /* StringLiteral */: + case 7 /* StringLiteral */: return stringType; - case 4 /* RegularExpressionLiteral */: + case 8 /* RegularExpressionLiteral */: return globalRegExpType; - case 112 /* QualifiedName */: + case 116 /* QualifiedName */: return checkPropertyAccess(node); - case 127 /* ArrayLiteral */: + case 132 /* ArrayLiteral */: return checkArrayLiteral(node, contextualMapper); - case 128 /* ObjectLiteral */: + case 133 /* ObjectLiteral */: return checkObjectLiteral(node, contextualMapper); - case 130 /* PropertyAccess */: + case 135 /* PropertyAccess */: return checkPropertyAccess(node); - case 131 /* IndexedAccess */: + case 136 /* IndexedAccess */: return checkIndexedAccess(node); - case 132 /* CallExpression */: - case 133 /* NewExpression */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: return checkCallExpression(node); - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return checkTypeAssertion(node); - case 135 /* ParenExpression */: + case 140 /* ParenExpression */: return checkExpression(node.expression); - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: return checkFunctionExpression(node, contextualMapper); - case 138 /* PrefixOperator */: + case 143 /* PrefixOperator */: return checkPrefixExpression(node); - case 139 /* PostfixOperator */: + case 144 /* PostfixOperator */: return checkPostfixExpression(node); - case 140 /* BinaryExpression */: + case 145 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 141 /* ConditionalExpression */: + case 146 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); } return unknownType; @@ -12536,7 +12937,7 @@ var ts; checkVariableDeclaration(parameterDeclaration); if (fullTypeCheck) { checkCollisionWithIndexVariableInGeneratedCode(parameterDeclaration, parameterDeclaration.name); - if (parameterDeclaration.flags & (16 /* Public */ | 32 /* Private */) && !(parameterDeclaration.parent.kind === 117 /* Constructor */ && parameterDeclaration.parent.body)) { + if (parameterDeclaration.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */) && !(parameterDeclaration.parent.kind === 121 /* Constructor */ && parameterDeclaration.parent.body)) { error(parameterDeclaration, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } if (parameterDeclaration.flags & 8 /* Rest */) { @@ -12551,10 +12952,10 @@ var ts; } } function checkReferencesInInitializer(n) { - if (n.kind === 55 /* Identifier */) { + if (n.kind === 59 /* Identifier */) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(parameterDeclaration.parent.locals, referencedSymbol.name, ts.SymbolFlags.Value) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 114 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 118 /* Parameter */) { if (referencedSymbol.valueDeclaration === parameterDeclaration) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.identifierToString(parameterDeclaration.name)); return; @@ -12588,10 +12989,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 120 /* CallSignature */: + case 124 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -12600,7 +13001,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 170 /* InterfaceDeclaration */) { + if (node.kind === 175 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -12614,7 +13015,7 @@ var ts; var declaration = indexSymbol.declarations[i]; if (declaration.parameters.length == 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 110 /* StringKeyword */: + case 114 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -12622,7 +13023,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 108 /* NumberKeyword */: + case 112 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -12656,39 +13057,39 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 132 /* CallExpression */ && n.func.kind === 81 /* SuperKeyword */; + return n.kind === 137 /* CallExpression */ && n.func.kind === 85 /* SuperKeyword */; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 136 /* FunctionExpression */: - case 167 /* FunctionDeclaration */: - case 137 /* ArrowFunction */: - case 128 /* ObjectLiteral */: + case 141 /* FunctionExpression */: + case 172 /* FunctionDeclaration */: + case 142 /* ArrowFunction */: + case 133 /* ObjectLiteral */: return false; default: return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { - if (n.kind === 83 /* ThisKeyword */) { + if (n.kind === 87 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 136 /* FunctionExpression */ && n.kind !== 167 /* FunctionDeclaration */) { + else if (n.kind !== 141 /* FunctionExpression */ && n.kind !== 172 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 115 /* Property */ && !(n.flags & 64 /* Static */) && !!n.initializer; + return n.kind === 119 /* Property */ && !(n.flags & 128 /* Static */) && !!n.initializer; } if (node.parent.baseType) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 146 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 151 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -12703,16 +13104,15 @@ var ts; } function checkAccessorDeclaration(node) { if (fullTypeCheck) { - if (node.kind === 118 /* GetAccessor */) { + if (node.kind === 122 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && node.body && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } - var otherKind = node.kind === 118 /* GetAccessor */ ? 119 /* SetAccessor */ : 118 /* GetAccessor */; + var otherKind = node.kind === 122 /* GetAccessor */ ? 123 /* SetAccessor */ : 122 /* GetAccessor */; var otherAccessor = getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - var visibilityFlags = 32 /* Private */ | 16 /* Public */; - if (((node.flags & visibilityFlags) !== (otherAccessor.flags & visibilityFlags))) { + if (((node.flags & ts.NodeFlags.AccessibilityModifier) !== (otherAccessor.flags & ts.NodeFlags.AccessibilityModifier))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } var thisType = getAnnotatedAccessorType(node); @@ -12753,7 +13153,10 @@ var ts; } } function checkArrayType(node) { - getTypeFromArrayTypeNode(node); + checkSourceElement(node.elementType); + } + function checkTupleType(node) { + ts.forEach(node.elementTypes, checkSourceElement); } function isPrivateWithinAmbient(node) { return (node.flags & 32 /* Private */) && ts.isInAmbientContext(node); @@ -12772,9 +13175,9 @@ var ts; } var symbol = getSymbolOfNode(signatureDeclarationNode); var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 170 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 120 /* CallSignature */ || signatureDeclarationNode.kind === 121 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 120 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 175 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 124 /* CallSignature */ || signatureDeclarationNode.kind === 125 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 124 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -12792,7 +13195,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = n.flags; - if (n.parent.kind !== 170 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 175 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { flags |= 1 /* Export */; } @@ -12817,8 +13220,8 @@ var ts; else if (deviation & 2 /* Ambient */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & 32 /* Private */) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_or_private); + else if (deviation & (32 /* Private */ | 64 /* Protected */)) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } else if (deviation & 4 /* QuestionMark */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); @@ -12826,7 +13229,7 @@ var ts; }); } } - var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 32 /* Private */ | 4 /* QuestionMark */; + var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 32 /* Private */ | 64 /* Protected */ | 4 /* QuestionMark */; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var hasOverloads = false; @@ -12849,9 +13252,9 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 116 /* Method */); - ts.Debug.assert((node.flags & 64 /* Static */) !== (subsequentNode.flags & 64 /* Static */)); - var diagnostic = node.flags & 64 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + ts.Debug.assert(node.kind === 120 /* Method */); + ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); + var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode, diagnostic); return; } @@ -12873,11 +13276,11 @@ var ts; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 170 /* InterfaceDeclaration */ || node.parent.kind === 125 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 175 /* InterfaceDeclaration */ || node.parent.kind === 129 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 167 /* FunctionDeclaration */ || node.kind === 116 /* Method */ || node.kind === 117 /* Constructor */) { + if (node.kind === 172 /* FunctionDeclaration */ || node.kind === 120 /* Method */ || node.kind === 121 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -12961,14 +13364,14 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: return 1048576 /* ExportType */; - case 172 /* ModuleDeclaration */: - return d.name.kind === 3 /* StringLiteral */ || ts.isInstantiated(d) ? 2097152 /* ExportNamespace */ | 524288 /* ExportValue */ : 2097152 /* ExportNamespace */; - case 169 /* ClassDeclaration */: - case 171 /* EnumDeclaration */: + case 177 /* ModuleDeclaration */: + return d.name.kind === 7 /* StringLiteral */ || ts.isInstantiated(d) ? 2097152 /* ExportNamespace */ | 524288 /* ExportValue */ : 2097152 /* ExportNamespace */; + case 174 /* ClassDeclaration */: + case 176 /* EnumDeclaration */: return 1048576 /* ExportType */ | 524288 /* ExportValue */; - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: var result = 0; var target = resolveImport(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { @@ -13026,7 +13429,7 @@ var ts; if (!(name && name.text === "_i")) { return; } - if (node.kind === 114 /* Parameter */) { + if (node.kind === 118 /* Parameter */) { if (node.parent.body && ts.hasRestParameters(node.parent) && !ts.isInAmbientContext(node)) { error(node, ts.Diagnostics.Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter); } @@ -13043,11 +13446,11 @@ var ts; return; } switch (current.kind) { - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 116 /* Method */: - case 137 /* ArrowFunction */: - case 117 /* Constructor */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 120 /* Method */: + case 142 /* ArrowFunction */: + case 121 /* Constructor */: if (ts.hasRestParameters(current)) { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter); return; @@ -13061,13 +13464,13 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 115 /* Property */ || node.kind === 116 /* Method */ || node.kind === 118 /* GetAccessor */ || node.kind === 119 /* SetAccessor */) { + if (node.kind === 119 /* Property */ || node.kind === 120 /* Method */ || node.kind === 122 /* GetAccessor */ || node.kind === 123 /* SetAccessor */) { return false; } if (ts.isInAmbientContext(node)) { return false; } - if (node.kind === 114 /* Parameter */ && !node.parent.body) { + if (node.kind === 118 /* Parameter */ && !node.parent.body) { return false; } return true; @@ -13082,7 +13485,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration = node.kind !== 55 /* Identifier */; + var isDeclaration = node.kind !== 59 /* Identifier */; if (isDeclaration) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -13098,12 +13501,12 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = getAncestor(node, 169 /* ClassDeclaration */); + var enclosingClass = ts.getAncestor(node, 174 /* ClassDeclaration */); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } if (enclosingClass.baseType) { - var isDeclaration = node.kind !== 55 /* Identifier */; + var isDeclaration = node.kind !== 59 /* Identifier */; if (isDeclaration) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -13116,11 +13519,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 172 /* ModuleDeclaration */ && !ts.isInstantiated(node)) { + if (node.kind === 177 /* ModuleDeclaration */ && !ts.isInstantiated(node)) { return; } - var parent = node.kind === 166 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (parent.kind === 177 /* SourceFile */ && ts.isExternalModule(parent)) { + var parent = node.kind === 171 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (parent.kind === 182 /* SourceFile */ && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, name.text, name.text); } } @@ -13207,30 +13610,22 @@ var ts; } function checkBreakOrContinueStatement(node) { } - function getContainingFunction(node) { - while (true) { - node = node.parent; - if (!node || node.kind === 167 /* FunctionDeclaration */ || node.kind === 136 /* FunctionExpression */ || node.kind === 137 /* ArrowFunction */ || node.kind === 116 /* Method */ || node.kind === 117 /* Constructor */ || node.kind === 118 /* GetAccessor */ || node.kind === 119 /* SetAccessor */) { - return node; - } - } - } function checkReturnStatement(node) { if (node.expression && !(getNodeLinks(node.expression).flags & 1 /* TypeChecked */)) { - var func = getContainingFunction(node); + var func = ts.getContainingFunction(node); if (func) { - if (func.kind === 119 /* SetAccessor */) { + if (func.kind === 123 /* SetAccessor */) { if (node.expression) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } } else { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); - var checkAssignability = func.type || (func.kind === 118 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 119 /* SetAccessor */))); + var checkAssignability = func.type || (func.kind === 122 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 123 /* SetAccessor */))); if (checkAssignability) { checkTypeAssignableTo(checkExpression(node.expression), returnType, node.expression, undefined, undefined); } - else if (func.kind == 117 /* Constructor */) { + else if (func.kind == 121 /* Constructor */) { if (!isTypeAssignableTo(checkExpression(node.expression), returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -13255,7 +13650,7 @@ var ts; checkBlock(clause); }); } - function checkLabelledStatement(node) { + function checkLabeledStatement(node) { checkSourceElement(node.statement); } function checkThrowStatement(node) { @@ -13406,7 +13801,7 @@ var ts; if ((baseDeclarationFlags & 32 /* Private */) || (derivedDeclarationFlags & 32 /* Private */)) { continue; } - if ((baseDeclarationFlags & 64 /* Static */) !== (derivedDeclarationFlags & 64 /* Static */)) { + if ((baseDeclarationFlags & 128 /* Static */) !== (derivedDeclarationFlags & 128 /* Static */)) { continue; } if ((base.flags & derived.flags & 2048 /* Method */) || ((base.flags & ts.SymbolFlags.PropertyOrAccessor) && (derived.flags & ts.SymbolFlags.PropertyOrAccessor))) { @@ -13436,7 +13831,7 @@ var ts; } } function isAccessor(kind) { - return kind === 118 /* GetAccessor */ || kind === 119 /* SetAccessor */; + return kind === 122 /* GetAccessor */ || kind === 123 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -13469,7 +13864,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = getDeclarationOfKind(symbol, 170 /* InterfaceDeclaration */); + var firstInterfaceDecl = getDeclarationOfKind(symbol, 175 /* InterfaceDeclaration */); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -13493,14 +13888,14 @@ var ts; } function getConstantValue(node) { var isNegative = false; - if (node.kind === 138 /* PrefixOperator */) { + if (node.kind === 143 /* PrefixOperator */) { var unaryExpression = node; - if (unaryExpression.operator === 25 /* MinusToken */ || unaryExpression.operator === 24 /* PlusToken */) { + if (unaryExpression.operator === 29 /* MinusToken */ || unaryExpression.operator === 28 /* PlusToken */) { node = unaryExpression.operand; - isNegative = unaryExpression.operator === 25 /* MinusToken */; + isNegative = unaryExpression.operator === 29 /* MinusToken */; } } - if (node.kind === 2 /* NumericLiteral */) { + if (node.kind === 6 /* NumericLiteral */) { var literalText = node.text; return isNegative ? -literalText : +literalText; } @@ -13537,7 +13932,7 @@ var ts; if (node === firstDeclaration) { var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 171 /* EnumDeclaration */) { + if (declaration.kind !== 176 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -13560,7 +13955,7 @@ var ts; var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; - if ((declaration.kind === 169 /* ClassDeclaration */ || (declaration.kind === 167 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 174 /* ClassDeclaration */ || (declaration.kind === 172 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -13583,7 +13978,7 @@ var ts; } } } - if (node.name.kind === 3 /* StringLiteral */) { + if (node.name.kind === 7 /* StringLiteral */) { if (!isGlobalSourceFile(node.parent)) { error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); } @@ -13595,7 +13990,7 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 112 /* QualifiedName */) { + while (node.kind === 116 /* QualifiedName */) { node = node.left; } return node; @@ -13623,10 +14018,10 @@ var ts; } } else { - if (node.parent.kind === 177 /* SourceFile */) { + if (node.parent.kind === 182 /* SourceFile */) { target = resolveImport(symbol); } - else if (node.parent.kind === 173 /* ModuleBlock */ && node.parent.parent.name.kind === 3 /* StringLiteral */) { + else if (node.parent.kind === 178 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { if (isExternalModuleNameRelative(node.externalModuleName.text)) { error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); target = unknownSymbol; @@ -13648,7 +14043,7 @@ var ts; } function checkExportAssignment(node) { var container = node.parent; - if (container.kind !== 177 /* SourceFile */) { + if (container.kind !== 182 /* SourceFile */) { container = container.parent; } checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); @@ -13657,142 +14052,144 @@ var ts; if (!node) return; switch (node.kind) { - case 113 /* TypeParameter */: + case 117 /* TypeParameter */: return checkTypeParameter(node); - case 114 /* Parameter */: + case 118 /* Parameter */: return checkParameter(node); - case 115 /* Property */: + case 119 /* Property */: return checkPropertyDeclaration(node); - case 120 /* CallSignature */: - case 121 /* ConstructSignature */: - case 122 /* IndexSignature */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + case 126 /* IndexSignature */: return checkSignatureDeclaration(node); - case 116 /* Method */: + case 120 /* Method */: return checkMethodDeclaration(node); - case 117 /* Constructor */: + case 121 /* Constructor */: return checkConstructorDeclaration(node); - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: return checkAccessorDeclaration(node); - case 123 /* TypeReference */: + case 127 /* TypeReference */: return checkTypeReference(node); - case 124 /* TypeQuery */: + case 128 /* TypeQuery */: return checkTypeQuery(node); - case 125 /* TypeLiteral */: + case 129 /* TypeLiteral */: return checkTypeLiteral(node); - case 126 /* ArrayType */: + case 130 /* ArrayType */: return checkArrayType(node); - case 167 /* FunctionDeclaration */: + case 131 /* TupleType */: + return checkTupleType(node); + case 172 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 143 /* Block */: + case 148 /* Block */: return checkBlock(node); - case 168 /* FunctionBlock */: - case 173 /* ModuleBlock */: + case 173 /* FunctionBlock */: + case 178 /* ModuleBlock */: return checkBody(node); - case 144 /* VariableStatement */: + case 149 /* VariableStatement */: return checkVariableStatement(node); - case 146 /* ExpressionStatement */: + case 151 /* ExpressionStatement */: return checkExpressionStatement(node); - case 147 /* IfStatement */: + case 152 /* IfStatement */: return checkIfStatement(node); - case 148 /* DoStatement */: + case 153 /* DoStatement */: return checkDoStatement(node); - case 149 /* WhileStatement */: + case 154 /* WhileStatement */: return checkWhileStatement(node); - case 150 /* ForStatement */: + case 155 /* ForStatement */: return checkForStatement(node); - case 151 /* ForInStatement */: + case 156 /* ForInStatement */: return checkForInStatement(node); - case 152 /* ContinueStatement */: - case 153 /* BreakStatement */: + case 157 /* ContinueStatement */: + case 158 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 154 /* ReturnStatement */: + case 159 /* ReturnStatement */: return checkReturnStatement(node); - case 155 /* WithStatement */: + case 160 /* WithStatement */: return checkWithStatement(node); - case 156 /* SwitchStatement */: + case 161 /* SwitchStatement */: return checkSwitchStatement(node); - case 159 /* LabelledStatement */: - return checkLabelledStatement(node); - case 160 /* ThrowStatement */: + case 164 /* LabeledStatement */: + return checkLabeledStatement(node); + case 165 /* ThrowStatement */: return checkThrowStatement(node); - case 161 /* TryStatement */: + case 166 /* TryStatement */: return checkTryStatement(node); - case 166 /* VariableDeclaration */: + case 171 /* VariableDeclaration */: return ts.Debug.fail("Checker encountered variable declaration"); - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: return checkClassDeclaration(node); - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: return checkImportDeclaration(node); - case 175 /* ExportAssignment */: + case 180 /* ExportAssignment */: return checkExportAssignment(node); } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionBody(node); break; - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 167 /* FunctionDeclaration */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 172 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 155 /* WithStatement */: + case 160 /* WithStatement */: checkFunctionExpressionBodies(node.expression); break; - case 114 /* Parameter */: - case 115 /* Property */: - case 127 /* ArrayLiteral */: - case 128 /* ObjectLiteral */: - case 129 /* PropertyAssignment */: - case 130 /* PropertyAccess */: - case 131 /* IndexedAccess */: - case 132 /* CallExpression */: - case 133 /* NewExpression */: - case 134 /* TypeAssertion */: - case 135 /* ParenExpression */: - case 138 /* PrefixOperator */: - case 139 /* PostfixOperator */: - case 140 /* BinaryExpression */: - case 141 /* ConditionalExpression */: - case 143 /* Block */: - case 168 /* FunctionBlock */: - case 173 /* ModuleBlock */: - case 144 /* VariableStatement */: - case 146 /* ExpressionStatement */: - case 147 /* IfStatement */: - case 148 /* DoStatement */: - case 149 /* WhileStatement */: - case 150 /* ForStatement */: - case 151 /* ForInStatement */: - case 152 /* ContinueStatement */: - case 153 /* BreakStatement */: - case 154 /* ReturnStatement */: - case 156 /* SwitchStatement */: - case 157 /* CaseClause */: - case 158 /* DefaultClause */: - case 159 /* LabelledStatement */: - case 160 /* ThrowStatement */: - case 161 /* TryStatement */: - case 162 /* TryBlock */: - case 163 /* CatchBlock */: - case 164 /* FinallyBlock */: - case 166 /* VariableDeclaration */: - case 169 /* ClassDeclaration */: - case 171 /* EnumDeclaration */: - case 176 /* EnumMember */: - case 177 /* SourceFile */: + case 118 /* Parameter */: + case 119 /* Property */: + case 132 /* ArrayLiteral */: + case 133 /* ObjectLiteral */: + case 134 /* PropertyAssignment */: + case 135 /* PropertyAccess */: + case 136 /* IndexedAccess */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: + case 139 /* TypeAssertion */: + case 140 /* ParenExpression */: + case 143 /* PrefixOperator */: + case 144 /* PostfixOperator */: + case 145 /* BinaryExpression */: + case 146 /* ConditionalExpression */: + case 148 /* Block */: + case 173 /* FunctionBlock */: + case 178 /* ModuleBlock */: + case 149 /* VariableStatement */: + case 151 /* ExpressionStatement */: + case 152 /* IfStatement */: + case 153 /* DoStatement */: + case 154 /* WhileStatement */: + case 155 /* ForStatement */: + case 156 /* ForInStatement */: + case 157 /* ContinueStatement */: + case 158 /* BreakStatement */: + case 159 /* ReturnStatement */: + case 161 /* SwitchStatement */: + case 162 /* CaseClause */: + case 163 /* DefaultClause */: + case 164 /* LabeledStatement */: + case 165 /* ThrowStatement */: + case 166 /* TryStatement */: + case 167 /* TryBlock */: + case 168 /* CatchBlock */: + case 169 /* FinallyBlock */: + case 171 /* VariableDeclaration */: + case 174 /* ClassDeclaration */: + case 176 /* EnumDeclaration */: + case 181 /* EnumMember */: + case 182 /* SourceFile */: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -13860,6 +14257,17 @@ var ts; position = sourceFile.end; return findChildAtPosition(sourceFile); } + function isInsideWithStatementBody(node) { + if (node) { + while (node.parent) { + if (node.parent.kind === 160 /* WithStatement */ && node.parent.statement === node) { + return true; + } + node = node.parent; + } + } + return false; + } function getSymbolsInScope(location, meaning) { var symbols = {}; var memberFlags = 0; @@ -13880,32 +14288,35 @@ var ts; } } } + if (isInsideWithStatementBody(location)) { + return []; + } while (location) { if (location.locals && !isGlobalSourceFile(location)) { copySymbols(location.locals, meaning); } switch (location.kind) { - case 177 /* SourceFile */: + case 182 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & ts.SymbolFlags.ModuleMember); break; - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 4 /* EnumMember */); break; - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - if (!(memberFlags & 64 /* Static */)) { + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & ts.SymbolFlags.Type); } break; - case 136 /* FunctionExpression */: + case 141 /* FunctionExpression */: if (location.name) { copySymbol(location.symbol, meaning); } break; - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: if (location.variable.text) { copySymbol(location.symbol, meaning); } @@ -13918,81 +14329,81 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 55 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 59 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 113 /* TypeParameter */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 171 /* EnumDeclaration */: + case 117 /* TypeParameter */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 112 /* QualifiedName */) + while (node.parent && node.parent.kind === 116 /* QualifiedName */) node = node.parent; - return node.parent && node.parent.kind === 123 /* TypeReference */; + return node.parent && node.parent.kind === 127 /* TypeReference */; } function isExpression(node) { switch (node.kind) { - case 83 /* ThisKeyword */: - case 81 /* SuperKeyword */: - case 79 /* NullKeyword */: - case 85 /* TrueKeyword */: - case 70 /* FalseKeyword */: - case 4 /* RegularExpressionLiteral */: - case 127 /* ArrayLiteral */: - case 128 /* ObjectLiteral */: - case 130 /* PropertyAccess */: - case 131 /* IndexedAccess */: - case 132 /* CallExpression */: - case 133 /* NewExpression */: - case 134 /* TypeAssertion */: - case 135 /* ParenExpression */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: - case 138 /* PrefixOperator */: - case 139 /* PostfixOperator */: - case 140 /* BinaryExpression */: - case 141 /* ConditionalExpression */: - case 142 /* OmittedExpression */: + case 87 /* ThisKeyword */: + case 85 /* SuperKeyword */: + case 83 /* NullKeyword */: + case 89 /* TrueKeyword */: + case 74 /* FalseKeyword */: + case 8 /* RegularExpressionLiteral */: + case 132 /* ArrayLiteral */: + case 133 /* ObjectLiteral */: + case 135 /* PropertyAccess */: + case 136 /* IndexedAccess */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: + case 139 /* TypeAssertion */: + case 140 /* ParenExpression */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: + case 143 /* PrefixOperator */: + case 144 /* PostfixOperator */: + case 145 /* BinaryExpression */: + case 146 /* ConditionalExpression */: + case 147 /* OmittedExpression */: return true; - case 112 /* QualifiedName */: - while (node.parent.kind === 112 /* QualifiedName */) + case 116 /* QualifiedName */: + while (node.parent.kind === 116 /* QualifiedName */) node = node.parent; - return node.parent.kind === 124 /* TypeQuery */; - case 55 /* Identifier */: - if (node.parent.kind === 124 /* TypeQuery */) { + return node.parent.kind === 128 /* TypeQuery */; + case 59 /* Identifier */: + if (node.parent.kind === 128 /* TypeQuery */) { return true; } - case 2 /* NumericLiteral */: - case 3 /* StringLiteral */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: var parent = node.parent; switch (parent.kind) { - case 166 /* VariableDeclaration */: - case 114 /* Parameter */: - case 115 /* Property */: - case 176 /* EnumMember */: - case 129 /* PropertyAssignment */: + case 171 /* VariableDeclaration */: + case 118 /* Parameter */: + case 119 /* Property */: + case 181 /* EnumMember */: + case 134 /* PropertyAssignment */: return parent.initializer === node; - case 146 /* ExpressionStatement */: - case 147 /* IfStatement */: - case 148 /* DoStatement */: - case 149 /* WhileStatement */: - case 154 /* ReturnStatement */: - case 155 /* WithStatement */: - case 156 /* SwitchStatement */: - case 157 /* CaseClause */: - case 160 /* ThrowStatement */: - case 156 /* SwitchStatement */: + case 151 /* ExpressionStatement */: + case 152 /* IfStatement */: + case 153 /* DoStatement */: + case 154 /* WhileStatement */: + case 159 /* ReturnStatement */: + case 160 /* WithStatement */: + case 161 /* SwitchStatement */: + case 162 /* CaseClause */: + case 165 /* ThrowStatement */: + case 161 /* SwitchStatement */: return parent.expression === node; - case 150 /* ForStatement */: + case 155 /* ForStatement */: return parent.initializer === node || parent.condition === node || parent.iterator === node; - case 151 /* ForInStatement */: + case 156 /* ForInStatement */: return parent.variable === node || parent.expression === node; - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return node === parent.operand; default: if (isExpression(parent)) { @@ -14007,75 +14418,75 @@ var ts; return true; } switch (node.kind) { - case 101 /* AnyKeyword */: - case 108 /* NumberKeyword */: - case 110 /* StringKeyword */: - case 102 /* BooleanKeyword */: + case 105 /* AnyKeyword */: + case 112 /* NumberKeyword */: + case 114 /* StringKeyword */: + case 106 /* BooleanKeyword */: return true; - case 89 /* VoidKeyword */: - return node.parent.kind !== 138 /* PrefixOperator */; - case 3 /* StringLiteral */: - return node.parent.kind === 114 /* Parameter */; - case 55 /* Identifier */: - if (node.parent.kind === 112 /* QualifiedName */) { + case 93 /* VoidKeyword */: + return node.parent.kind !== 143 /* PrefixOperator */; + case 7 /* StringLiteral */: + return node.parent.kind === 118 /* Parameter */; + case 59 /* Identifier */: + if (node.parent.kind === 116 /* QualifiedName */) { node = node.parent; } - case 112 /* QualifiedName */: + case 116 /* QualifiedName */: var parent = node.parent; - if (parent.kind === 124 /* TypeQuery */) { + if (parent.kind === 128 /* TypeQuery */) { return false; } if (parent.kind >= ts.SyntaxKind.FirstTypeNode && parent.kind <= ts.SyntaxKind.LastTypeNode) { return true; } switch (parent.kind) { - case 113 /* TypeParameter */: + case 117 /* TypeParameter */: return node === parent.constraint; - case 115 /* Property */: - case 114 /* Parameter */: - case 166 /* VariableDeclaration */: + case 119 /* Property */: + case 118 /* Parameter */: + case 171 /* VariableDeclaration */: return node === parent.type; - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: - case 117 /* Constructor */: - case 116 /* Method */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: + case 121 /* Constructor */: + case 120 /* Method */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: return node === parent.type; - case 120 /* CallSignature */: - case 121 /* ConstructSignature */: - case 122 /* IndexSignature */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + case 126 /* IndexSignature */: return node === parent.type; - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return node === parent.type; - case 132 /* CallExpression */: - case 133 /* NewExpression */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: return parent.typeArguments.indexOf(node) >= 0; } } return false; } function isInRightSideOfImportOrExportAssignment(node) { - while (node.parent.kind === 112 /* QualifiedName */) { + while (node.parent.kind === 116 /* QualifiedName */) { node = node.parent; } - if (node.parent.kind === 174 /* ImportDeclaration */) { + if (node.parent.kind === 179 /* ImportDeclaration */) { return node.parent.entityName === node; } - if (node.parent.kind === 175 /* ExportAssignment */) { + if (node.parent.kind === 180 /* ExportAssignment */) { return node.parent.exportName === node; } return false; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 112 /* QualifiedName */ || node.parent.kind === 130 /* PropertyAccess */) && node.parent.right === node; + return (node.parent.kind === 116 /* QualifiedName */ || node.parent.kind === 135 /* PropertyAccess */) && node.parent.right === node; } function getSymbolOfEntityName(entityName) { if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 175 /* ExportAssignment */) { + if (entityName.parent.kind === 180 /* ExportAssignment */) { return resolveEntityName(entityName.parent.parent, entityName, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace | 4194304 /* Import */); } if (isInRightSideOfImportOrExportAssignment(entityName)) { @@ -14085,11 +14496,11 @@ var ts; entityName = entityName.parent; } if (isExpression(entityName)) { - if (entityName.kind === 55 /* Identifier */) { + if (entityName.kind === 59 /* Identifier */) { var meaning = ts.SymbolFlags.Value | 4194304 /* Import */; return resolveEntityName(entityName, entityName, meaning); } - else if (entityName.kind === 112 /* QualifiedName */ || entityName.kind === 130 /* PropertyAccess */) { + else if (entityName.kind === 116 /* QualifiedName */ || entityName.kind === 135 /* PropertyAccess */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccess(entityName); @@ -14101,42 +14512,45 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 123 /* TypeReference */ ? ts.SymbolFlags.Type : ts.SymbolFlags.Namespace; + var meaning = entityName.parent.kind === 127 /* TypeReference */ ? ts.SymbolFlags.Type : ts.SymbolFlags.Namespace; meaning |= 4194304 /* Import */; return resolveEntityName(entityName, entityName, meaning); } return undefined; } function getSymbolInfo(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { return getSymbolOfNode(node.parent); } - if (node.kind === 55 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 175 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); + if (node.kind === 59 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 180 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); } switch (node.kind) { - case 55 /* Identifier */: - case 130 /* PropertyAccess */: - case 112 /* QualifiedName */: + case 59 /* Identifier */: + case 135 /* PropertyAccess */: + case 116 /* QualifiedName */: return getSymbolOfEntityName(node); - case 83 /* ThisKeyword */: - case 81 /* SuperKeyword */: + case 87 /* ThisKeyword */: + case 85 /* SuperKeyword */: var type = checkExpression(node); return type.symbol; - case 103 /* ConstructorKeyword */: + case 107 /* ConstructorKeyword */: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 117 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 121 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; - case 3 /* StringLiteral */: - if (node.parent.kind === 174 /* ImportDeclaration */ && node.parent.externalModuleName === node) { + case 7 /* StringLiteral */: + if (node.parent.kind === 179 /* ImportDeclaration */ && node.parent.externalModuleName === node) { var importSymbol = getSymbolOfNode(node.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; } - case 2 /* NumericLiteral */: - if (node.parent.kind == 131 /* IndexedAccess */ && node.parent.index === node) { + case 6 /* NumericLiteral */: + if (node.parent.kind == 136 /* IndexedAccess */ && node.parent.index === node) { var objectType = checkExpression(node.parent.object); if (objectType === unknownType) return undefined; @@ -14150,6 +14564,9 @@ var ts; return undefined; } function getTypeOfNode(node) { + if (isInsideWithStatementBody(node)) { + return unknownType; + } if (isExpression(node)) { return getTypeOfExpression(node); } @@ -14162,7 +14579,7 @@ var ts; } if (isTypeDeclarationName(node)) { var symbol = getSymbolInfo(node); - return getDeclaredTypeOfSymbol(symbol); + return symbol && getDeclaredTypeOfSymbol(symbol); } if (ts.isDeclaration(node)) { var symbol = getSymbolOfNode(node); @@ -14170,11 +14587,11 @@ var ts; } if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { var symbol = getSymbolInfo(node); - return getTypeOfSymbol(symbol); + return symbol && getTypeOfSymbol(symbol); } if (isInRightSideOfImportOrExportAssignment(node)) { var symbol = getSymbolInfo(node); - var declaredType = getDeclaredTypeOfSymbol(symbol); + var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); } return unknownType; @@ -14216,10 +14633,10 @@ var ts; } } function getRootSymbol(symbol) { - return (symbol.flags & 33554432 /* Transient */) ? getSymbolLinks(symbol).target : symbol; + return ((symbol.flags & 33554432 /* Transient */) && getSymbolLinks(symbol).target) || symbol; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 128 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 177 /* SourceFile */; + return symbol.flags & 128 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 182 /* SourceFile */; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -14252,7 +14669,7 @@ var ts; function getLocalNameForSymbol(symbol, location) { var node = location; while (node) { - if ((node.kind === 172 /* ModuleDeclaration */ || node.kind === 171 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { + if ((node.kind === 177 /* ModuleDeclaration */ || node.kind === 176 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { return getLocalNameOfContainer(node); } node = node.parent; @@ -14276,7 +14693,7 @@ var ts; if (symbol && (symbol.flags & 4 /* EnumMember */)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 176 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { + if (declaration.kind === 181 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { return constantValue.toString() + " /* " + ts.identifierToString(declaration.name) + " */"; } } @@ -14286,15 +14703,15 @@ var ts; return symbol && symbolIsValue(symbol) ? symbolToString(symbol) : undefined; } function isTopLevelValueImportedViaEntityName(node) { - if (node.parent.kind !== 177 /* SourceFile */ || !node.entityName) { + if (node.parent.kind !== 182 /* SourceFile */ || !node.entityName) { return false; } var symbol = getSymbolOfNode(node); var target = resolveImport(symbol); return target !== unknownSymbol && ((target.flags & ts.SymbolFlags.Value) !== 0); } - function shouldEmitDeclarations() { - return compilerOptions.declaration && !program.getDiagnostics().length && !getDiagnostics().length; + function hasSemanticErrors() { + return getDiagnostics().length > 0 || getGlobalDiagnostics().length > 0; } function isReferencedImportDeclaration(node) { var symbol = getSymbolOfNode(node); @@ -14332,7 +14749,7 @@ var ts; var signature = getSignatureFromDeclaration(signatureDeclaration); writeTypeToTextWriter(getReturnTypeOfSignature(signature), enclosingDeclaration, flags, writer); } - function invokeEmitter() { + function invokeEmitter(targetSourceFile) { var resolver = { getProgram: function () { return program; }, getLocalNameOfContainer: getLocalNameOfContainer, @@ -14343,7 +14760,7 @@ var ts; getNodeCheckFlags: getNodeCheckFlags, getEnumMemberValue: getEnumMemberValue, isTopLevelValueImportedViaEntityName: isTopLevelValueImportedViaEntityName, - shouldEmitDeclarations: shouldEmitDeclarations, + hasSemanticErrors: hasSemanticErrors, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, writeTypeAtLocation: writeTypeAtLocation, @@ -14353,7 +14770,7 @@ var ts; isImportDeclarationEntityNameReferenceDeclarationVisibile: isImportDeclarationEntityNameReferenceDeclarationVisibile }; checkProgram(); - return ts.emitFiles(resolver); + return ts.emitFiles(resolver, targetSourceFile); } function initializeTypeChecker() { ts.forEach(program.getSourceFiles(), function (file) { @@ -14757,32 +15174,42 @@ var ts; } function executeCommandLine(args) { var commandLine = ts.parseCommandLine(args); - if (commandLine.options.locale) { + var compilerOptions = commandLine.options; + if (compilerOptions.locale) { + if (typeof JSON === "undefined") { + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale")); + return sys.exit(1); + } validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); } if (commandLine.errors.length > 0) { reportDiagnostics(commandLine.errors); - return sys.exit(1); + return sys.exit(5 /* CompilerOptionsErrors */); } - if (commandLine.options.version) { + if (compilerOptions.version) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, version)); - return sys.exit(0); + return sys.exit(0 /* Succeeded */); } - if (commandLine.options.help || commandLine.filenames.length === 0) { + if (compilerOptions.help) { printVersion(); printHelp(); - return sys.exit(0); + return sys.exit(0 /* Succeeded */); } - var defaultCompilerHost = createCompilerHost(commandLine.options); - if (commandLine.options.watch) { + if (commandLine.filenames.length === 0) { + printVersion(); + printHelp(); + return sys.exit(5 /* CompilerOptionsErrors */); + } + var defaultCompilerHost = createCompilerHost(compilerOptions); + if (compilerOptions.watch) { if (!sys.watchFile) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); - return sys.exit(1); + return sys.exit(5 /* CompilerOptionsErrors */); } watchProgram(commandLine, defaultCompilerHost); } else { - var result = compile(commandLine, defaultCompilerHost).errors.length > 0 ? 1 : 0; + var result = compile(commandLine, defaultCompilerHost).exitStatus; return sys.exit(result); } } @@ -14843,20 +15270,25 @@ var ts; } function compile(commandLine, compilerHost) { var parseStart = new Date().getTime(); - var program = ts.createProgram(commandLine.filenames, commandLine.options, compilerHost); + var compilerOptions = commandLine.options; + var program = ts.createProgram(commandLine.filenames, compilerOptions, compilerHost); var bindStart = new Date().getTime(); var errors = program.getDiagnostics(); + var exitStatus; if (errors.length) { var checkStart = bindStart; var emitStart = bindStart; var reportStart = bindStart; + exitStatus = 1 /* AllOutputGenerationSkipped */; } else { var checker = program.getTypeChecker(true); var checkStart = new Date().getTime(); var semanticErrors = checker.getDiagnostics(); var emitStart = new Date().getTime(); - var emitErrors = checker.emitFiles().errors; + var emitOutput = checker.emitFiles(); + var emitErrors = emitOutput.errors; + exitStatus = emitOutput.emitResultStatus; var reportStart = new Date().getTime(); errors = ts.concatenate(semanticErrors, emitErrors); } @@ -14878,7 +15310,7 @@ var ts; reportTimeStatistic("Emit time", reportStart - emitStart); reportTimeStatistic("Total time", reportStart - parseStart); } - return { program: program, errors: errors }; + return { program: program, exitStatus: exitStatus }; } function printVersion() { sys.write(getDiagnosticText(ts.Diagnostics.Version_0, version) + sys.newLine); diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 1efb6d232e3..38f2d4e1ecf 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -98,6 +98,7 @@ var ts; An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1 /* Error */, key: "An object literal cannot have property and accessor with the same name." }, An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1 /* Error */, key: "An export assignment cannot have modifiers." }, Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1 /* Error */, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1 /* Error */, key: "A tuple type element list cannot be empty." }, Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1 /* Error */, key: "Variable declaration list cannot be empty." }, Digit_expected: { code: 1124, category: 1 /* Error */, key: "Digit expected." }, Hexadecimal_digit_expected: { code: 1125, category: 1 /* Error */, key: "Hexadecimal digit expected." }, @@ -151,9 +152,9 @@ var ts; Type_0_is_not_assignable_to_type_1_Colon: { code: 2322, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}':" }, Type_0_is_not_assignable_to_type_1: { code: 2323, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}'." }, Property_0_is_missing_in_type_1: { code: 2324, category: 1 /* Error */, key: "Property '{0}' is missing in type '{1}'." }, - Private_property_0_cannot_be_reimplemented: { code: 2325, category: 1 /* Error */, key: "Private property '{0}' cannot be reimplemented." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1 /* Error */, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, Types_of_property_0_are_incompatible_Colon: { code: 2326, category: 1 /* Error */, key: "Types of property '{0}' are incompatible:" }, - Required_property_0_cannot_be_reimplemented_with_optional_property_in_1: { code: 2327, category: 1 /* Error */, key: "Required property '{0}' cannot be reimplemented with optional property in '{1}'." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1 /* Error */, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, Types_of_parameters_0_and_1_are_incompatible_Colon: { code: 2328, category: 1 /* Error */, key: "Types of parameters '{0}' and '{1}' are incompatible:" }, Index_signature_is_missing_in_type_0: { code: 2329, category: 1 /* Error */, key: "Index signature is missing in type '{0}'." }, Index_signatures_are_incompatible_Colon: { code: 2330, category: 1 /* Error */, key: "Index signatures are incompatible:" }, @@ -166,8 +167,8 @@ var ts; Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1 /* Error */, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1 /* Error */, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, Property_0_does_not_exist_on_type_1: { code: 2339, category: 1 /* Error */, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_inaccessible: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is inaccessible." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1 /* Error */, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, Type_0_does_not_satisfy_the_constraint_1_Colon: { code: 2343, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}':" }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}'." }, @@ -211,7 +212,7 @@ var ts; Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1 /* Error */, key: "Specialized overload signature is not assignable to any non-specialized signature." }, Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1 /* Error */, key: "Overload signatures must all be exported or not exported." }, Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1 /* Error */, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_or_private: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public or private." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public, private or protected." }, Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1 /* Error */, key: "Overload signatures must all be optional or required." }, Function_overload_must_be_static: { code: 2387, category: 1 /* Error */, key: "Function overload must be static." }, Function_overload_must_not_be_static: { code: 2388, category: 1 /* Error */, key: "Function overload must not be static." }, @@ -268,6 +269,11 @@ var ts; Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1 /* Error */, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1 /* Error */, key: "Import declaration conflicts with local declaration of '{0}'" }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1 /* Error */, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1 /* Error */, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1 /* Error */, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1 /* Error */, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* Error */, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, @@ -404,117 +410,121 @@ var ts; Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1 /* Error */, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1 /* Error */, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." } }; })(ts || (ts = {})); var ts; (function (ts) { var textToToken = { - "any": 101 /* AnyKeyword */, - "boolean": 102 /* BooleanKeyword */, - "break": 56 /* BreakKeyword */, - "case": 57 /* CaseKeyword */, - "catch": 58 /* CatchKeyword */, - "class": 59 /* ClassKeyword */, - "continue": 61 /* ContinueKeyword */, - "const": 60 /* ConstKeyword */, - "constructor": 103 /* ConstructorKeyword */, - "debugger": 62 /* DebuggerKeyword */, - "declare": 104 /* DeclareKeyword */, - "default": 63 /* DefaultKeyword */, - "delete": 64 /* DeleteKeyword */, - "do": 65 /* DoKeyword */, - "else": 66 /* ElseKeyword */, - "enum": 67 /* EnumKeyword */, - "export": 68 /* ExportKeyword */, - "extends": 69 /* ExtendsKeyword */, - "false": 70 /* FalseKeyword */, - "finally": 71 /* FinallyKeyword */, - "for": 72 /* ForKeyword */, - "function": 73 /* FunctionKeyword */, - "get": 105 /* GetKeyword */, - "if": 74 /* IfKeyword */, - "implements": 92 /* ImplementsKeyword */, - "import": 75 /* ImportKeyword */, - "in": 76 /* InKeyword */, - "instanceof": 77 /* InstanceOfKeyword */, - "interface": 93 /* InterfaceKeyword */, - "let": 94 /* LetKeyword */, - "module": 106 /* ModuleKeyword */, - "new": 78 /* NewKeyword */, - "null": 79 /* NullKeyword */, - "number": 108 /* NumberKeyword */, - "package": 95 /* PackageKeyword */, - "private": 96 /* PrivateKeyword */, - "protected": 97 /* ProtectedKeyword */, - "public": 98 /* PublicKeyword */, - "require": 107 /* RequireKeyword */, - "return": 80 /* ReturnKeyword */, - "set": 109 /* SetKeyword */, - "static": 99 /* StaticKeyword */, - "string": 110 /* StringKeyword */, - "super": 81 /* SuperKeyword */, - "switch": 82 /* SwitchKeyword */, - "this": 83 /* ThisKeyword */, - "throw": 84 /* ThrowKeyword */, - "true": 85 /* TrueKeyword */, - "try": 86 /* TryKeyword */, - "typeof": 87 /* TypeOfKeyword */, - "var": 88 /* VarKeyword */, - "void": 89 /* VoidKeyword */, - "while": 90 /* WhileKeyword */, - "with": 91 /* WithKeyword */, - "yield": 100 /* YieldKeyword */, - "{": 5 /* OpenBraceToken */, - "}": 6 /* CloseBraceToken */, - "(": 7 /* OpenParenToken */, - ")": 8 /* CloseParenToken */, - "[": 9 /* OpenBracketToken */, - "]": 10 /* CloseBracketToken */, - ".": 11 /* DotToken */, - "...": 12 /* DotDotDotToken */, - ";": 13 /* SemicolonToken */, - ",": 14 /* CommaToken */, - "<": 15 /* LessThanToken */, - ">": 16 /* GreaterThanToken */, - "<=": 17 /* LessThanEqualsToken */, - ">=": 18 /* GreaterThanEqualsToken */, - "==": 19 /* EqualsEqualsToken */, - "!=": 20 /* ExclamationEqualsToken */, - "===": 21 /* EqualsEqualsEqualsToken */, - "!==": 22 /* ExclamationEqualsEqualsToken */, - "=>": 23 /* EqualsGreaterThanToken */, - "+": 24 /* PlusToken */, - "-": 25 /* MinusToken */, - "*": 26 /* AsteriskToken */, - "/": 27 /* SlashToken */, - "%": 28 /* PercentToken */, - "++": 29 /* PlusPlusToken */, - "--": 30 /* MinusMinusToken */, - "<<": 31 /* LessThanLessThanToken */, - ">>": 32 /* GreaterThanGreaterThanToken */, - ">>>": 33 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 34 /* AmpersandToken */, - "|": 35 /* BarToken */, - "^": 36 /* CaretToken */, - "!": 37 /* ExclamationToken */, - "~": 38 /* TildeToken */, - "&&": 39 /* AmpersandAmpersandToken */, - "||": 40 /* BarBarToken */, - "?": 41 /* QuestionToken */, - ":": 42 /* ColonToken */, - "=": 43 /* EqualsToken */, - "+=": 44 /* PlusEqualsToken */, - "-=": 45 /* MinusEqualsToken */, - "*=": 46 /* AsteriskEqualsToken */, - "/=": 47 /* SlashEqualsToken */, - "%=": 48 /* PercentEqualsToken */, - "<<=": 49 /* LessThanLessThanEqualsToken */, - ">>=": 50 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 51 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 52 /* AmpersandEqualsToken */, - "|=": 53 /* BarEqualsToken */, - "^=": 54 /* CaretEqualsToken */ + "any": 105 /* AnyKeyword */, + "boolean": 106 /* BooleanKeyword */, + "break": 60 /* BreakKeyword */, + "case": 61 /* CaseKeyword */, + "catch": 62 /* CatchKeyword */, + "class": 63 /* ClassKeyword */, + "continue": 65 /* ContinueKeyword */, + "const": 64 /* ConstKeyword */, + "constructor": 107 /* ConstructorKeyword */, + "debugger": 66 /* DebuggerKeyword */, + "declare": 108 /* DeclareKeyword */, + "default": 67 /* DefaultKeyword */, + "delete": 68 /* DeleteKeyword */, + "do": 69 /* DoKeyword */, + "else": 70 /* ElseKeyword */, + "enum": 71 /* EnumKeyword */, + "export": 72 /* ExportKeyword */, + "extends": 73 /* ExtendsKeyword */, + "false": 74 /* FalseKeyword */, + "finally": 75 /* FinallyKeyword */, + "for": 76 /* ForKeyword */, + "function": 77 /* FunctionKeyword */, + "get": 109 /* GetKeyword */, + "if": 78 /* IfKeyword */, + "implements": 96 /* ImplementsKeyword */, + "import": 79 /* ImportKeyword */, + "in": 80 /* InKeyword */, + "instanceof": 81 /* InstanceOfKeyword */, + "interface": 97 /* InterfaceKeyword */, + "let": 98 /* LetKeyword */, + "module": 110 /* ModuleKeyword */, + "new": 82 /* NewKeyword */, + "null": 83 /* NullKeyword */, + "number": 112 /* NumberKeyword */, + "package": 99 /* PackageKeyword */, + "private": 100 /* PrivateKeyword */, + "protected": 101 /* ProtectedKeyword */, + "public": 102 /* PublicKeyword */, + "require": 111 /* RequireKeyword */, + "return": 84 /* ReturnKeyword */, + "set": 113 /* SetKeyword */, + "static": 103 /* StaticKeyword */, + "string": 114 /* StringKeyword */, + "super": 85 /* SuperKeyword */, + "switch": 86 /* SwitchKeyword */, + "this": 87 /* ThisKeyword */, + "throw": 88 /* ThrowKeyword */, + "true": 89 /* TrueKeyword */, + "try": 90 /* TryKeyword */, + "typeof": 91 /* TypeOfKeyword */, + "var": 92 /* VarKeyword */, + "void": 93 /* VoidKeyword */, + "while": 94 /* WhileKeyword */, + "with": 95 /* WithKeyword */, + "yield": 104 /* YieldKeyword */, + "{": 9 /* OpenBraceToken */, + "}": 10 /* CloseBraceToken */, + "(": 11 /* OpenParenToken */, + ")": 12 /* CloseParenToken */, + "[": 13 /* OpenBracketToken */, + "]": 14 /* CloseBracketToken */, + ".": 15 /* DotToken */, + "...": 16 /* DotDotDotToken */, + ";": 17 /* SemicolonToken */, + ",": 18 /* CommaToken */, + "<": 19 /* LessThanToken */, + ">": 20 /* GreaterThanToken */, + "<=": 21 /* LessThanEqualsToken */, + ">=": 22 /* GreaterThanEqualsToken */, + "==": 23 /* EqualsEqualsToken */, + "!=": 24 /* ExclamationEqualsToken */, + "===": 25 /* EqualsEqualsEqualsToken */, + "!==": 26 /* ExclamationEqualsEqualsToken */, + "=>": 27 /* EqualsGreaterThanToken */, + "+": 28 /* PlusToken */, + "-": 29 /* MinusToken */, + "*": 30 /* AsteriskToken */, + "/": 31 /* SlashToken */, + "%": 32 /* PercentToken */, + "++": 33 /* PlusPlusToken */, + "--": 34 /* MinusMinusToken */, + "<<": 35 /* LessThanLessThanToken */, + ">>": 36 /* GreaterThanGreaterThanToken */, + ">>>": 37 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 38 /* AmpersandToken */, + "|": 39 /* BarToken */, + "^": 40 /* CaretToken */, + "!": 41 /* ExclamationToken */, + "~": 42 /* TildeToken */, + "&&": 43 /* AmpersandAmpersandToken */, + "||": 44 /* BarBarToken */, + "?": 45 /* QuestionToken */, + ":": 46 /* ColonToken */, + "=": 47 /* EqualsToken */, + "+=": 48 /* PlusEqualsToken */, + "-=": 49 /* MinusEqualsToken */, + "*=": 50 /* AsteriskEqualsToken */, + "/=": 51 /* SlashEqualsToken */, + "%=": 52 /* PercentEqualsToken */, + "<<=": 53 /* LessThanLessThanEqualsToken */, + ">>=": 54 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 56 /* AmpersandEqualsToken */, + "|=": 57 /* BarEqualsToken */, + "^=": 58 /* CaretEqualsToken */ }; var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; @@ -764,7 +774,7 @@ var ts; return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; - function createScanner(languageVersion, text, onError, onComment) { + function createScanner(languageVersion, skipTrivia, text, onError, onComment) { var pos; var len; var startPos; @@ -969,7 +979,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 55 /* Identifier */; + return token = 59 /* Identifier */; } function scan() { startPos = pos; @@ -984,73 +994,94 @@ var ts; case 10 /* lineFeed */: case 13 /* carriageReturn */: precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; + } + else { + if (ch === 13 /* carriageReturn */ && pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos += 2; + } + else { + pos++; + } + return token = 4 /* NewLineTrivia */; + } case 9 /* tab */: case 11 /* verticalTab */: case 12 /* formFeed */: case 32 /* space */: - pos++; - continue; + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { + pos++; + } + return token = 5 /* WhitespaceTrivia */; + } case 33 /* exclamation */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 22 /* ExclamationEqualsEqualsToken */; + return pos += 3, token = 26 /* ExclamationEqualsEqualsToken */; } - return pos += 2, token = 20 /* ExclamationEqualsToken */; + return pos += 2, token = 24 /* ExclamationEqualsToken */; } - return pos++, token = 37 /* ExclamationToken */; + return pos++, token = 41 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); - return token = 3 /* StringLiteral */; + return token = 7 /* StringLiteral */; case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 48 /* PercentEqualsToken */; + return pos += 2, token = 52 /* PercentEqualsToken */; } - return pos++, token = 28 /* PercentToken */; + return pos++, token = 32 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 39 /* AmpersandAmpersandToken */; + return pos += 2, token = 43 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 52 /* AmpersandEqualsToken */; + return pos += 2, token = 56 /* AmpersandEqualsToken */; } - return pos++, token = 34 /* AmpersandToken */; + return pos++, token = 38 /* AmpersandToken */; case 40 /* openParen */: - return pos++, token = 7 /* OpenParenToken */; + return pos++, token = 11 /* OpenParenToken */; case 41 /* closeParen */: - return pos++, token = 8 /* CloseParenToken */; + return pos++, token = 12 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 46 /* AsteriskEqualsToken */; + return pos += 2, token = 50 /* AsteriskEqualsToken */; } - return pos++, token = 26 /* AsteriskToken */; + return pos++, token = 30 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 29 /* PlusPlusToken */; + return pos += 2, token = 33 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 44 /* PlusEqualsToken */; + return pos += 2, token = 48 /* PlusEqualsToken */; } - return pos++, token = 24 /* PlusToken */; + return pos++, token = 28 /* PlusToken */; case 44 /* comma */: - return pos++, token = 14 /* CommaToken */; + return pos++, token = 18 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 30 /* MinusMinusToken */; + return pos += 2, token = 34 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 45 /* MinusEqualsToken */; + return pos += 2, token = 49 /* MinusEqualsToken */; } - return pos++, token = 25 /* MinusToken */; + return pos++, token = 29 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanNumber(); - return token = 2 /* NumericLiteral */; + return token = 6 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 12 /* DotDotDotToken */; + return pos += 3, token = 16 /* DotDotDotToken */; } - return pos++, token = 11 /* DotToken */; + return pos++, token = 15 /* DotToken */; case 47 /* slash */: if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; @@ -1063,7 +1094,12 @@ var ts; if (onComment) { onComment(tokenPos, pos); } - continue; + if (skipTrivia) { + continue; + } + else { + return token = 2 /* SingleLineCommentTrivia */; + } } if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { pos += 2; @@ -1086,12 +1122,17 @@ var ts; if (onComment) { onComment(tokenPos, pos); } - continue; + if (skipTrivia) { + continue; + } + else { + return token = 3 /* MultiLineCommentTrivia */; + } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 47 /* SlashEqualsToken */; + return pos += 2, token = 51 /* SlashEqualsToken */; } - return pos++, token = 27 /* SlashToken */; + return pos++, token = 31 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -1101,11 +1142,11 @@ var ts; value = 0; } tokenValue = "" + value; - return 2 /* NumericLiteral */; + return 6 /* NumericLiteral */; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); - return 2 /* NumericLiteral */; + return 6 /* NumericLiteral */; } case 49 /* _1 */: case 50 /* _2 */: @@ -1117,60 +1158,60 @@ var ts; case 56 /* _8 */: case 57 /* _9 */: tokenValue = "" + scanNumber(); - return token = 2 /* NumericLiteral */; + return token = 6 /* NumericLiteral */; case 58 /* colon */: - return pos++, token = 42 /* ColonToken */; + return pos++, token = 46 /* ColonToken */; case 59 /* semicolon */: - return pos++, token = 13 /* SemicolonToken */; + return pos++, token = 17 /* SemicolonToken */; case 60 /* lessThan */: if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 49 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 53 /* LessThanLessThanEqualsToken */; } - return pos += 2, token = 31 /* LessThanLessThanToken */; + return pos += 2, token = 35 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 17 /* LessThanEqualsToken */; + return pos += 2, token = 21 /* LessThanEqualsToken */; } - return pos++, token = 15 /* LessThanToken */; + return pos++, token = 19 /* LessThanToken */; case 61 /* equals */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 21 /* EqualsEqualsEqualsToken */; + return pos += 3, token = 25 /* EqualsEqualsEqualsToken */; } - return pos += 2, token = 19 /* EqualsEqualsToken */; + return pos += 2, token = 23 /* EqualsEqualsToken */; } if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 23 /* EqualsGreaterThanToken */; + return pos += 2, token = 27 /* EqualsGreaterThanToken */; } - return pos++, token = 43 /* EqualsToken */; + return pos++, token = 47 /* EqualsToken */; case 62 /* greaterThan */: - return pos++, token = 16 /* GreaterThanToken */; + return pos++, token = 20 /* GreaterThanToken */; case 63 /* question */: - return pos++, token = 41 /* QuestionToken */; + return pos++, token = 45 /* QuestionToken */; case 91 /* openBracket */: - return pos++, token = 9 /* OpenBracketToken */; + return pos++, token = 13 /* OpenBracketToken */; case 93 /* closeBracket */: - return pos++, token = 10 /* CloseBracketToken */; + return pos++, token = 14 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 54 /* CaretEqualsToken */; + return pos += 2, token = 58 /* CaretEqualsToken */; } - return pos++, token = 36 /* CaretToken */; + return pos++, token = 40 /* CaretToken */; case 123 /* openBrace */: - return pos++, token = 5 /* OpenBraceToken */; + return pos++, token = 9 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 40 /* BarBarToken */; + return pos += 2, token = 44 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 53 /* BarEqualsToken */; + return pos += 2, token = 57 /* BarEqualsToken */; } - return pos++, token = 35 /* BarToken */; + return pos++, token = 39 /* BarToken */; case 125 /* closeBrace */: - return pos++, token = 6 /* CloseBraceToken */; + return pos++, token = 10 /* CloseBraceToken */; case 126 /* tilde */: - return pos++, token = 38 /* TildeToken */; + return pos++, token = 42 /* TildeToken */; case 92 /* backslash */: var ch = peekUnicodeEscape(); if (ch >= 0 && isIdentifierStart(ch)) { @@ -1206,27 +1247,27 @@ var ts; } } function reScanGreaterToken() { - if (token === 16 /* GreaterThanToken */) { + if (token === 20 /* GreaterThanToken */) { if (text.charCodeAt(pos) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 51 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } - return pos += 2, token = 33 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 37 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 50 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 54 /* GreaterThanGreaterThanEqualsToken */; } - return pos++, token = 32 /* GreaterThanGreaterThanToken */; + return pos++, token = 36 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 18 /* GreaterThanEqualsToken */; + return pos++, token = 22 /* GreaterThanEqualsToken */; } } return token; } function reScanSlashToken() { - if (token === 27 /* SlashToken */ || token === 47 /* SlashEqualsToken */) { + if (token === 31 /* SlashToken */ || token === 51 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -1261,7 +1302,7 @@ var ts; } pos = p; tokenValue = text.substring(tokenPos, pos); - token = 4 /* RegularExpressionLiteral */; + token = 8 /* RegularExpressionLiteral */; } return token; } @@ -1304,7 +1345,7 @@ var ts; getTokenText: function () { return text.substring(tokenPos, pos); }, getTokenValue: function () { return tokenValue; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 55 /* Identifier */ || token > ts.SyntaxKind.LastReservedWord; }, + isIdentifier: function () { return token === 59 /* Identifier */ || token > ts.SyntaxKind.LastReservedWord; }, isReservedWord: function () { return token >= ts.SyntaxKind.FirstReservedWord && token <= ts.SyntaxKind.LastReservedWord; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -1321,185 +1362,190 @@ var ts; (function (SyntaxKind) { SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown"; SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken"; - SyntaxKind[SyntaxKind["NumericLiteral"] = 2] = "NumericLiteral"; - SyntaxKind[SyntaxKind["StringLiteral"] = 3] = "StringLiteral"; - SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 4] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["OpenBraceToken"] = 5] = "OpenBraceToken"; - SyntaxKind[SyntaxKind["CloseBraceToken"] = 6] = "CloseBraceToken"; - SyntaxKind[SyntaxKind["OpenParenToken"] = 7] = "OpenParenToken"; - SyntaxKind[SyntaxKind["CloseParenToken"] = 8] = "CloseParenToken"; - SyntaxKind[SyntaxKind["OpenBracketToken"] = 9] = "OpenBracketToken"; - SyntaxKind[SyntaxKind["CloseBracketToken"] = 10] = "CloseBracketToken"; - SyntaxKind[SyntaxKind["DotToken"] = 11] = "DotToken"; - SyntaxKind[SyntaxKind["DotDotDotToken"] = 12] = "DotDotDotToken"; - SyntaxKind[SyntaxKind["SemicolonToken"] = 13] = "SemicolonToken"; - SyntaxKind[SyntaxKind["CommaToken"] = 14] = "CommaToken"; - SyntaxKind[SyntaxKind["LessThanToken"] = 15] = "LessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 16] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 17] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 18] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 19] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 20] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 21] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 22] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 23] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 24] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 25] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 26] = "AsteriskToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 27] = "SlashToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 28] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 29] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 30] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 31] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 32] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 33] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 34] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 35] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 36] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 37] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 38] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 39] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 40] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 41] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 42] = "ColonToken"; - SyntaxKind[SyntaxKind["EqualsToken"] = 43] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 44] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 45] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 46] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 47] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 48] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 49] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 50] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 51] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 52] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 53] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 54] = "CaretEqualsToken"; - SyntaxKind[SyntaxKind["Identifier"] = 55] = "Identifier"; - SyntaxKind[SyntaxKind["BreakKeyword"] = 56] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 57] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 58] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 59] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 60] = "ConstKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 61] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 62] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 63] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 64] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 65] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 66] = "ElseKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 67] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 68] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 69] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 70] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 71] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 72] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 73] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 74] = "IfKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 75] = "ImportKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 76] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 77] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 78] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 79] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 80] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 81] = "SuperKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 82] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 83] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 84] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 85] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 86] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 87] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 88] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 89] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 90] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 91] = "WithKeyword"; - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 92] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 93] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 94] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 95] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 96] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 97] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 98] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 99] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 100] = "YieldKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 101] = "AnyKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 102] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 103] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 104] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 105] = "GetKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 106] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 107] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 108] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 109] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 110] = "StringKeyword"; - SyntaxKind[SyntaxKind["Missing"] = 111] = "Missing"; - SyntaxKind[SyntaxKind["QualifiedName"] = 112] = "QualifiedName"; - SyntaxKind[SyntaxKind["TypeParameter"] = 113] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 114] = "Parameter"; - SyntaxKind[SyntaxKind["Property"] = 115] = "Property"; - SyntaxKind[SyntaxKind["Method"] = 116] = "Method"; - SyntaxKind[SyntaxKind["Constructor"] = 117] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 118] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 119] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 120] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 121] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 122] = "IndexSignature"; - SyntaxKind[SyntaxKind["TypeReference"] = 123] = "TypeReference"; - SyntaxKind[SyntaxKind["TypeQuery"] = 124] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 125] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 126] = "ArrayType"; - SyntaxKind[SyntaxKind["ArrayLiteral"] = 127] = "ArrayLiteral"; - SyntaxKind[SyntaxKind["ObjectLiteral"] = 128] = "ObjectLiteral"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 129] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["PropertyAccess"] = 130] = "PropertyAccess"; - SyntaxKind[SyntaxKind["IndexedAccess"] = 131] = "IndexedAccess"; - SyntaxKind[SyntaxKind["CallExpression"] = 132] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 133] = "NewExpression"; - SyntaxKind[SyntaxKind["TypeAssertion"] = 134] = "TypeAssertion"; - SyntaxKind[SyntaxKind["ParenExpression"] = 135] = "ParenExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 136] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 137] = "ArrowFunction"; - SyntaxKind[SyntaxKind["PrefixOperator"] = 138] = "PrefixOperator"; - SyntaxKind[SyntaxKind["PostfixOperator"] = 139] = "PostfixOperator"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 140] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 141] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 142] = "OmittedExpression"; - SyntaxKind[SyntaxKind["Block"] = 143] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 144] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 145] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 146] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 147] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 148] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 149] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 150] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 151] = "ForInStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 152] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 153] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 154] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 155] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 156] = "SwitchStatement"; - SyntaxKind[SyntaxKind["CaseClause"] = 157] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 158] = "DefaultClause"; - SyntaxKind[SyntaxKind["LabelledStatement"] = 159] = "LabelledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 160] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 161] = "TryStatement"; - SyntaxKind[SyntaxKind["TryBlock"] = 162] = "TryBlock"; - SyntaxKind[SyntaxKind["CatchBlock"] = 163] = "CatchBlock"; - SyntaxKind[SyntaxKind["FinallyBlock"] = 164] = "FinallyBlock"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 165] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 166] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 167] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["FunctionBlock"] = 168] = "FunctionBlock"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 169] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 170] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 171] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 172] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 173] = "ModuleBlock"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 174] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 175] = "ExportAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 176] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 177] = "SourceFile"; - SyntaxKind[SyntaxKind["Program"] = 178] = "Program"; - SyntaxKind[SyntaxKind["SyntaxList"] = 179] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 180] = "Count"; + SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia"; + SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia"; + SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia"; + SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; + SyntaxKind[SyntaxKind["NumericLiteral"] = 6] = "NumericLiteral"; + SyntaxKind[SyntaxKind["StringLiteral"] = 7] = "StringLiteral"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 8] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 9] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 10] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 11] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 12] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 13] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 14] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 15] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 16] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 17] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 18] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 19] = "LessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 20] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 21] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 22] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 23] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 24] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 25] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 26] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 27] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 28] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 29] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 30] = "AsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 31] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 32] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 33] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 34] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 35] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 36] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 37] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 38] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 39] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 40] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 41] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 42] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 43] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 44] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 45] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 46] = "ColonToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 47] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 48] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 49] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 50] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 51] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 52] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 53] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 54] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 55] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 56] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 57] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 58] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["Identifier"] = 59] = "Identifier"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 60] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 61] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 62] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 63] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 64] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 65] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 66] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 67] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 68] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 69] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 70] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 71] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 72] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 73] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 74] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 75] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 76] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 77] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 78] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 79] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 80] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 81] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 82] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 83] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 84] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 85] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 86] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 87] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 88] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 89] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 90] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 91] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 92] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 93] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 94] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 95] = "WithKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 96] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 97] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 98] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 99] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 100] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 101] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 102] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 103] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 104] = "YieldKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 105] = "AnyKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 106] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 107] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 108] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 109] = "GetKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 110] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 111] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 112] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 113] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 114] = "StringKeyword"; + SyntaxKind[SyntaxKind["Missing"] = 115] = "Missing"; + SyntaxKind[SyntaxKind["QualifiedName"] = 116] = "QualifiedName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 117] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 118] = "Parameter"; + SyntaxKind[SyntaxKind["Property"] = 119] = "Property"; + SyntaxKind[SyntaxKind["Method"] = 120] = "Method"; + SyntaxKind[SyntaxKind["Constructor"] = 121] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 122] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 123] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 124] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 125] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 126] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypeReference"] = 127] = "TypeReference"; + SyntaxKind[SyntaxKind["TypeQuery"] = 128] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 129] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 130] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 131] = "TupleType"; + SyntaxKind[SyntaxKind["ArrayLiteral"] = 132] = "ArrayLiteral"; + SyntaxKind[SyntaxKind["ObjectLiteral"] = 133] = "ObjectLiteral"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 134] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAccess"] = 135] = "PropertyAccess"; + SyntaxKind[SyntaxKind["IndexedAccess"] = 136] = "IndexedAccess"; + SyntaxKind[SyntaxKind["CallExpression"] = 137] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 138] = "NewExpression"; + SyntaxKind[SyntaxKind["TypeAssertion"] = 139] = "TypeAssertion"; + SyntaxKind[SyntaxKind["ParenExpression"] = 140] = "ParenExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 141] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 142] = "ArrowFunction"; + SyntaxKind[SyntaxKind["PrefixOperator"] = 143] = "PrefixOperator"; + SyntaxKind[SyntaxKind["PostfixOperator"] = 144] = "PostfixOperator"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 145] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 146] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 147] = "OmittedExpression"; + SyntaxKind[SyntaxKind["Block"] = 148] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 149] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 150] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 151] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 152] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 153] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 154] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 155] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 156] = "ForInStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 157] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 158] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 159] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 160] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 161] = "SwitchStatement"; + SyntaxKind[SyntaxKind["CaseClause"] = 162] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 163] = "DefaultClause"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 164] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 165] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 166] = "TryStatement"; + SyntaxKind[SyntaxKind["TryBlock"] = 167] = "TryBlock"; + SyntaxKind[SyntaxKind["CatchBlock"] = 168] = "CatchBlock"; + SyntaxKind[SyntaxKind["FinallyBlock"] = 169] = "FinallyBlock"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 170] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 171] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 172] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["FunctionBlock"] = 173] = "FunctionBlock"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 174] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 175] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 176] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 177] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 178] = "ModuleBlock"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 179] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 180] = "ExportAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 181] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 182] = "SourceFile"; + SyntaxKind[SyntaxKind["Program"] = 183] = "Program"; + SyntaxKind[SyntaxKind["SyntaxList"] = 184] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 185] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = SyntaxKind.EqualsToken] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = SyntaxKind.CaretEqualsToken] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = SyntaxKind.BreakKeyword] = "FirstReservedWord"; @@ -1509,9 +1555,11 @@ var ts; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = SyntaxKind.ImplementsKeyword] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = SyntaxKind.YieldKeyword] = "LastFutureReservedWord"; SyntaxKind[SyntaxKind["FirstTypeNode"] = SyntaxKind.TypeReference] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = SyntaxKind.ArrayType] = "LastTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = SyntaxKind.TupleType] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = SyntaxKind.OpenBraceToken] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = SyntaxKind.CaretEqualsToken] = "LastPunctuation"; + SyntaxKind[SyntaxKind["FirstToken"] = SyntaxKind.EndOfFileToken] = "FirstToken"; + SyntaxKind[SyntaxKind["LastToken"] = SyntaxKind.StringKeyword] = "LastToken"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -1521,13 +1569,24 @@ var ts; NodeFlags[NodeFlags["Rest"] = 0x00000008] = "Rest"; NodeFlags[NodeFlags["Public"] = 0x00000010] = "Public"; NodeFlags[NodeFlags["Private"] = 0x00000020] = "Private"; - NodeFlags[NodeFlags["Static"] = 0x00000040] = "Static"; - NodeFlags[NodeFlags["MultiLine"] = 0x00000080] = "MultiLine"; - NodeFlags[NodeFlags["Synthetic"] = 0x00000100] = "Synthetic"; - NodeFlags[NodeFlags["DeclarationFile"] = 0x00000200] = "DeclarationFile"; - NodeFlags[NodeFlags["Modifier"] = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Public | NodeFlags.Private | NodeFlags.Static] = "Modifier"; + NodeFlags[NodeFlags["Protected"] = 0x00000040] = "Protected"; + NodeFlags[NodeFlags["Static"] = 0x00000080] = "Static"; + NodeFlags[NodeFlags["MultiLine"] = 0x00000100] = "MultiLine"; + NodeFlags[NodeFlags["Synthetic"] = 0x00000200] = "Synthetic"; + NodeFlags[NodeFlags["DeclarationFile"] = 0x00000400] = "DeclarationFile"; + NodeFlags[NodeFlags["Modifier"] = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected | NodeFlags.Static] = "Modifier"; + NodeFlags[NodeFlags["AccessibilityModifier"] = NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected] = "AccessibilityModifier"; })(ts.NodeFlags || (ts.NodeFlags = {})); var NodeFlags = ts.NodeFlags; + (function (EmitReturnStatus) { + EmitReturnStatus[EmitReturnStatus["Succeeded"] = 0] = "Succeeded"; + EmitReturnStatus[EmitReturnStatus["AllOutputGenerationSkipped"] = 1] = "AllOutputGenerationSkipped"; + EmitReturnStatus[EmitReturnStatus["JSGeneratedWithSemanticErrors"] = 2] = "JSGeneratedWithSemanticErrors"; + EmitReturnStatus[EmitReturnStatus["DeclarationGenerationSkipped"] = 3] = "DeclarationGenerationSkipped"; + EmitReturnStatus[EmitReturnStatus["EmitErrorsEncountered"] = 4] = "EmitErrorsEncountered"; + EmitReturnStatus[EmitReturnStatus["CompilerOptionsErrors"] = 5] = "CompilerOptionsErrors"; + })(ts.EmitReturnStatus || (ts.EmitReturnStatus = {})); + var EmitReturnStatus = ts.EmitReturnStatus; (function (TypeFormatFlags) { TypeFormatFlags[TypeFormatFlags["None"] = 0x00000000] = "None"; TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 0x00000001] = "WriteArrayAsGenericType"; @@ -1624,12 +1683,13 @@ var ts; TypeFlags[TypeFlags["Class"] = 0x00000400] = "Class"; TypeFlags[TypeFlags["Interface"] = 0x00000800] = "Interface"; TypeFlags[TypeFlags["Reference"] = 0x00001000] = "Reference"; - TypeFlags[TypeFlags["Anonymous"] = 0x00002000] = "Anonymous"; - TypeFlags[TypeFlags["FromSignature"] = 0x00004000] = "FromSignature"; + TypeFlags[TypeFlags["Tuple"] = 0x00002000] = "Tuple"; + TypeFlags[TypeFlags["Anonymous"] = 0x00004000] = "Anonymous"; + TypeFlags[TypeFlags["FromSignature"] = 0x00008000] = "FromSignature"; TypeFlags[TypeFlags["Intrinsic"] = TypeFlags.Any | TypeFlags.String | TypeFlags.Number | TypeFlags.Boolean | TypeFlags.Void | TypeFlags.Undefined | TypeFlags.Null] = "Intrinsic"; TypeFlags[TypeFlags["StringLike"] = TypeFlags.String | TypeFlags.StringLiteral] = "StringLike"; TypeFlags[TypeFlags["NumberLike"] = TypeFlags.Number | TypeFlags.Enum] = "NumberLike"; - TypeFlags[TypeFlags["ObjectType"] = TypeFlags.Class | TypeFlags.Interface | TypeFlags.Reference | TypeFlags.Anonymous] = "ObjectType"; + TypeFlags[TypeFlags["ObjectType"] = TypeFlags.Class | TypeFlags.Interface | TypeFlags.Reference | TypeFlags.Tuple | TypeFlags.Anonymous] = "ObjectType"; })(ts.TypeFlags || (ts.TypeFlags = {})); var TypeFlags = ts.TypeFlags; (function (SignatureKind) { @@ -1800,8 +1860,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - var len = array.length; - for (var i = 0; i < len; i++) { + for (var i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return true; } @@ -1812,8 +1871,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - var len = array.length; - for (var i = 0; i < len; i++) { + for (var i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return i; } @@ -1823,9 +1881,8 @@ var ts; } ts.indexOf = indexOf; function filter(array, f) { - var result; if (array) { - result = []; + var result = []; for (var i = 0, len = array.length; i < len; i++) { var item = array[i]; if (f(item)) { @@ -1837,11 +1894,9 @@ var ts; } ts.filter = filter; function map(array, f) { - var result; if (array) { - result = []; - var len = array.length; - for (var i = 0; i < len; i++) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { result.push(f(array[i])); } } @@ -1856,6 +1911,18 @@ var ts; return array1.concat(array2); } ts.concatenate = concatenate; + function uniqueElements(array) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (!contains(result, item)) + result.push(item); + } + } + return result; + } + ts.uniqueElements = uniqueElements; function sum(array, prop) { var result = 0; for (var i = 0; i < array.length; i++) { @@ -2140,12 +2207,12 @@ var ts; return normalizedPathComponents(path, rootLength); } ts.getNormalizedPathComponents = getNormalizedPathComponents; - function getNormalizedPathFromPathCompoments(pathComponents) { + function getNormalizedPathFromPathComponents(pathComponents) { if (pathComponents && pathComponents.length) { return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator); } } - ts.getNormalizedPathFromPathCompoments = getNormalizedPathFromPathCompoments; + ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; function getNormalizedPathComponentsOfUrl(url) { var urlLength = url.length; var rootLength = url.indexOf("://") + "://".length; @@ -2198,7 +2265,7 @@ var ts; } return relativePath + relativePathComponents.join(ts.directorySeparator); } - var absolutePath = getNormalizedPathFromPathCompoments(pathComponents); + var absolutePath = getNormalizedPathFromPathComponents(pathComponents); if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) { absolutePath = "file:///" + absolutePath; } @@ -2287,7 +2354,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(180 /* Count */); + var nodeConstructors = new Array(185 /* Count */); function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); } @@ -2311,7 +2378,7 @@ var ts; } ts.getModuleNameFromFilename = getModuleNameFromFilename; function getSourceFileOfNode(node) { - while (node && node.kind !== 177 /* SourceFile */) + while (node && node.kind !== 182 /* SourceFile */) node = node.parent; return node; } @@ -2326,8 +2393,8 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; - function getTokenPosOfNode(node) { - return ts.skipTrivia(getSourceFileOfNode(node).text, node.pos); + function getTokenPosOfNode(node, sourceFile) { + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function getSourceTextOfNodeFromSourceText(sourceText, node) { @@ -2348,13 +2415,13 @@ var ts; } ts.unescapeIdentifier = unescapeIdentifier; function identifierToString(identifier) { - return identifier.kind === 111 /* Missing */ ? "(Missing)" : getSourceTextOfNode(identifier); + return identifier.kind === 115 /* Missing */ ? "(Missing)" : getSourceTextOfNode(identifier); } ts.identifierToString = identifierToString; function createDiagnosticForNode(node, message, arg0, arg1, arg2) { node = getErrorSpanForNode(node); var file = getSourceFileOfNode(node); - var start = node.kind === 111 /* Missing */ ? node.pos : ts.skipTrivia(file.text, node.pos); + var start = node.kind === 115 /* Missing */ ? node.pos : ts.skipTrivia(file.text, node.pos); var length = node.end - start; return ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); } @@ -2370,12 +2437,12 @@ var ts; function getErrorSpanForNode(node) { var errorSpan; switch (node.kind) { - case 166 /* VariableDeclaration */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 172 /* ModuleDeclaration */: - case 171 /* EnumDeclaration */: - case 176 /* EnumMember */: + case 171 /* VariableDeclaration */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 177 /* ModuleDeclaration */: + case 176 /* EnumDeclaration */: + case 181 /* EnumMember */: errorSpan = node.name; break; } @@ -2387,18 +2454,18 @@ var ts; } ts.isExternalModule = isExternalModule; function isPrologueDirective(node) { - return node.kind === 146 /* ExpressionStatement */ && node.expression.kind === 3 /* StringLiteral */; + return node.kind === 151 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 55 /* Identifier */ && node.text && (node.text === "eval" || node.text === "arguments"); + return node.kind === 59 /* Identifier */ && node.text && (node.text === "eval" || node.text === "arguments"); } function isUseStrictPrologueDirective(node) { ts.Debug.assert(isPrologueDirective(node)); return node.expression.text === "use strict"; } function getLeadingCommentsOfNode(node, sourceFileOfNode) { - if (node.kind === 114 /* Parameter */ || node.kind === 113 /* TypeParameter */) { + if (node.kind === 118 /* Parameter */ || node.kind === 117 /* TypeParameter */) { return ts.concatenate(ts.getTrailingComments(sourceFileOfNode.text, node.pos), ts.getLeadingComments(sourceFileOfNode.text, node.pos)); } else { @@ -2434,124 +2501,221 @@ var ts; if (!node) return; switch (node.kind) { - case 112 /* QualifiedName */: + case 116 /* QualifiedName */: return child(node.left) || child(node.right); - case 113 /* TypeParameter */: + case 117 /* TypeParameter */: return child(node.name) || child(node.constraint); - case 114 /* Parameter */: + case 118 /* Parameter */: return child(node.name) || child(node.type) || child(node.initializer); - case 115 /* Property */: - case 129 /* PropertyAssignment */: + case 119 /* Property */: + case 134 /* PropertyAssignment */: return child(node.name) || child(node.type) || child(node.initializer); - case 120 /* CallSignature */: - case 121 /* ConstructSignature */: - case 122 /* IndexSignature */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + case 126 /* IndexSignature */: return children(node.typeParameters) || children(node.parameters) || child(node.type); - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 136 /* FunctionExpression */: - case 167 /* FunctionDeclaration */: - case 137 /* ArrowFunction */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 141 /* FunctionExpression */: + case 172 /* FunctionDeclaration */: + case 142 /* ArrowFunction */: return child(node.name) || children(node.typeParameters) || children(node.parameters) || child(node.type) || child(node.body); - case 123 /* TypeReference */: + case 127 /* TypeReference */: return child(node.typeName) || children(node.typeArguments); - case 124 /* TypeQuery */: + case 128 /* TypeQuery */: return child(node.exprName); - case 125 /* TypeLiteral */: + case 129 /* TypeLiteral */: return children(node.members); - case 126 /* ArrayType */: + case 130 /* ArrayType */: return child(node.elementType); - case 127 /* ArrayLiteral */: + case 131 /* TupleType */: + return children(node.elementTypes); + case 132 /* ArrayLiteral */: return children(node.elements); - case 128 /* ObjectLiteral */: + case 133 /* ObjectLiteral */: return children(node.properties); - case 130 /* PropertyAccess */: + case 135 /* PropertyAccess */: return child(node.left) || child(node.right); - case 131 /* IndexedAccess */: + case 136 /* IndexedAccess */: return child(node.object) || child(node.index); - case 132 /* CallExpression */: - case 133 /* NewExpression */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: return child(node.func) || children(node.typeArguments) || children(node.arguments); - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return child(node.type) || child(node.operand); - case 135 /* ParenExpression */: + case 140 /* ParenExpression */: return child(node.expression); - case 138 /* PrefixOperator */: - case 139 /* PostfixOperator */: + case 143 /* PrefixOperator */: + case 144 /* PostfixOperator */: return child(node.operand); - case 140 /* BinaryExpression */: + case 145 /* BinaryExpression */: return child(node.left) || child(node.right); - case 141 /* ConditionalExpression */: + case 146 /* ConditionalExpression */: return child(node.condition) || child(node.whenTrue) || child(node.whenFalse); - case 143 /* Block */: - case 162 /* TryBlock */: - case 164 /* FinallyBlock */: - case 168 /* FunctionBlock */: - case 173 /* ModuleBlock */: - case 177 /* SourceFile */: + case 148 /* Block */: + case 167 /* TryBlock */: + case 169 /* FinallyBlock */: + case 173 /* FunctionBlock */: + case 178 /* ModuleBlock */: + case 182 /* SourceFile */: return children(node.statements); - case 144 /* VariableStatement */: + case 149 /* VariableStatement */: return children(node.declarations); - case 146 /* ExpressionStatement */: + case 151 /* ExpressionStatement */: return child(node.expression); - case 147 /* IfStatement */: + case 152 /* IfStatement */: return child(node.expression) || child(node.thenStatement) || child(node.elseStatement); - case 148 /* DoStatement */: + case 153 /* DoStatement */: return child(node.statement) || child(node.expression); - case 149 /* WhileStatement */: + case 154 /* WhileStatement */: return child(node.expression) || child(node.statement); - case 150 /* ForStatement */: + case 155 /* ForStatement */: return children(node.declarations) || child(node.initializer) || child(node.condition) || child(node.iterator) || child(node.statement); - case 151 /* ForInStatement */: + case 156 /* ForInStatement */: return child(node.declaration) || child(node.variable) || child(node.expression) || child(node.statement); - case 152 /* ContinueStatement */: - case 153 /* BreakStatement */: + case 157 /* ContinueStatement */: + case 158 /* BreakStatement */: return child(node.label); - case 154 /* ReturnStatement */: + case 159 /* ReturnStatement */: return child(node.expression); - case 155 /* WithStatement */: + case 160 /* WithStatement */: return child(node.expression) || child(node.statement); - case 156 /* SwitchStatement */: + case 161 /* SwitchStatement */: return child(node.expression) || children(node.clauses); - case 157 /* CaseClause */: - case 158 /* DefaultClause */: + case 162 /* CaseClause */: + case 163 /* DefaultClause */: return child(node.expression) || children(node.statements); - case 159 /* LabelledStatement */: + case 164 /* LabeledStatement */: return child(node.label) || child(node.statement); - case 160 /* ThrowStatement */: + case 165 /* ThrowStatement */: return child(node.expression); - case 161 /* TryStatement */: + case 166 /* TryStatement */: return child(node.tryBlock) || child(node.catchBlock) || child(node.finallyBlock); - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: return child(node.variable) || children(node.statements); - case 166 /* VariableDeclaration */: + case 171 /* VariableDeclaration */: return child(node.name) || child(node.type) || child(node.initializer); - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: return child(node.name) || children(node.typeParameters) || child(node.baseType) || children(node.implementedTypes) || children(node.members); - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: return child(node.name) || children(node.typeParameters) || children(node.baseTypes) || children(node.members); - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: return child(node.name) || children(node.members); - case 176 /* EnumMember */: + case 181 /* EnumMember */: return child(node.name) || child(node.initializer); - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: return child(node.name) || child(node.body); - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: return child(node.name) || child(node.entityName) || child(node.externalModuleName); - case 175 /* ExportAssignment */: + case 180 /* ExportAssignment */: return child(node.exportName); } } ts.forEachChild = forEachChild; + function forEachReturnStatement(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 159 /* ReturnStatement */: + return visitor(node); + case 148 /* Block */: + case 173 /* FunctionBlock */: + case 152 /* IfStatement */: + case 153 /* DoStatement */: + case 154 /* WhileStatement */: + case 155 /* ForStatement */: + case 156 /* ForInStatement */: + case 160 /* WithStatement */: + case 161 /* SwitchStatement */: + case 162 /* CaseClause */: + case 163 /* DefaultClause */: + case 164 /* LabeledStatement */: + case 166 /* TryStatement */: + case 167 /* TryBlock */: + case 168 /* CatchBlock */: + case 169 /* FinallyBlock */: + return forEachChild(node, traverse); + } + } + } + ts.forEachReturnStatement = forEachReturnStatement; + function isAnyFunction(node) { + if (node) { + switch (node.kind) { + case 141 /* FunctionExpression */: + case 172 /* FunctionDeclaration */: + case 142 /* ArrowFunction */: + case 120 /* Method */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 121 /* Constructor */: + return true; + } + } + return false; + } + ts.isAnyFunction = isAnyFunction; + function getContainingFunction(node) { + while (true) { + node = node.parent; + if (!node || isAnyFunction(node)) { + return node; + } + } + } + ts.getContainingFunction = getContainingFunction; + function getThisContainer(node, includeArrowFunctions) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 142 /* ArrowFunction */: + if (!includeArrowFunctions) { + continue; + } + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 177 /* ModuleDeclaration */: + case 119 /* Property */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 176 /* EnumDeclaration */: + case 182 /* SourceFile */: + return node; + } + } + } + ts.getThisContainer = getThisContainer; + function getSuperContainer(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 119 /* Property */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + return node; + } + } + } + ts.getSuperContainer = getSuperContainer; function hasRestParameters(s) { return s.parameters.length > 0 && (s.parameters[s.parameters.length - 1].flags & 8 /* Rest */) !== 0; } ts.hasRestParameters = hasRestParameters; function isInAmbientContext(node) { while (node) { - if (node.flags & (2 /* Ambient */ | 512 /* DeclarationFile */)) + if (node.flags & (2 /* Ambient */ | 1024 /* DeclarationFile */)) return true; node = node.parent; } @@ -2560,40 +2724,96 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 113 /* TypeParameter */: - case 114 /* Parameter */: - case 166 /* VariableDeclaration */: - case 115 /* Property */: - case 129 /* PropertyAssignment */: - case 176 /* EnumMember */: - case 116 /* Method */: - case 167 /* FunctionDeclaration */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 171 /* EnumDeclaration */: - case 172 /* ModuleDeclaration */: - case 174 /* ImportDeclaration */: + case 117 /* TypeParameter */: + case 118 /* Parameter */: + case 171 /* VariableDeclaration */: + case 119 /* Property */: + case 134 /* PropertyAssignment */: + case 181 /* EnumMember */: + case 120 /* Method */: + case 172 /* FunctionDeclaration */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: + case 177 /* ModuleDeclaration */: + case 179 /* ImportDeclaration */: return true; } return false; } ts.isDeclaration = isDeclaration; + function isStatement(n) { + switch (n.kind) { + case 158 /* BreakStatement */: + case 157 /* ContinueStatement */: + case 170 /* DebuggerStatement */: + case 153 /* DoStatement */: + case 151 /* ExpressionStatement */: + case 150 /* EmptyStatement */: + case 156 /* ForInStatement */: + case 155 /* ForStatement */: + case 152 /* IfStatement */: + case 164 /* LabeledStatement */: + case 159 /* ReturnStatement */: + case 161 /* SwitchStatement */: + case 88 /* ThrowKeyword */: + case 166 /* TryStatement */: + case 149 /* VariableStatement */: + case 154 /* WhileStatement */: + case 160 /* WithStatement */: + case 180 /* ExportAssignment */: + return true; + default: + return false; + } + } + ts.isStatement = isStatement; function isDeclarationOrFunctionExpressionOrCatchVariableName(name) { - if (name.kind !== 55 /* Identifier */ && name.kind !== 3 /* StringLiteral */ && name.kind !== 2 /* NumericLiteral */) { + if (name.kind !== 59 /* Identifier */ && name.kind !== 7 /* StringLiteral */ && name.kind !== 6 /* NumericLiteral */) { return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === 136 /* FunctionExpression */) { + if (isDeclaration(parent) || parent.kind === 141 /* FunctionExpression */) { return parent.name === name; } - if (parent.kind === 163 /* CatchBlock */) { + if (parent.kind === 168 /* CatchBlock */) { return parent.variable === name; } return false; } ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; + function getAncestor(node, kind) { + switch (kind) { + case 174 /* ClassDeclaration */: + while (node) { + switch (node.kind) { + case 174 /* ClassDeclaration */: + return node; + case 176 /* EnumDeclaration */: + case 175 /* InterfaceDeclaration */: + case 177 /* ModuleDeclaration */: + case 179 /* ImportDeclaration */: + return undefined; + default: + node = node.parent; + continue; + } + } + break; + default: + while (node) { + if (node.kind === kind) { + return node; + } + node = node.parent; + } + break; + } + return undefined; + } + ts.getAncestor = getAncestor; var ParsingContext; (function (ParsingContext) { ParsingContext[ParsingContext["SourceElements"] = 0] = "SourceElements"; @@ -2612,7 +2832,8 @@ var ts; ParsingContext[ParsingContext["Parameters"] = 13] = "Parameters"; ParsingContext[ParsingContext["TypeParameters"] = 14] = "TypeParameters"; ParsingContext[ParsingContext["TypeArguments"] = 15] = "TypeArguments"; - ParsingContext[ParsingContext["Count"] = 16] = "Count"; + ParsingContext[ParsingContext["TupleElementTypes"] = 16] = "TupleElementTypes"; + ParsingContext[ParsingContext["Count"] = 17] = "Count"; })(ParsingContext || (ParsingContext = {})); var Tristate; (function (Tristate) { @@ -2654,6 +2875,8 @@ var ts; return ts.Diagnostics.Type_parameter_declaration_expected; case 15 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected; + case 16 /* TupleElementTypes */: + return ts.Diagnostics.Type_expected; } } ; @@ -2688,11 +2911,12 @@ var ts; ts.isKeyword = isKeyword; function isModifier(token) { switch (token) { - case 98 /* PublicKeyword */: - case 96 /* PrivateKeyword */: - case 99 /* StaticKeyword */: - case 68 /* ExportKeyword */: - case 104 /* DeclareKeyword */: + case 102 /* PublicKeyword */: + case 100 /* PrivateKeyword */: + case 101 /* ProtectedKeyword */: + case 103 /* StaticKeyword */: + case 72 /* ExportKeyword */: + case 108 /* DeclareKeyword */: return true; } return false; @@ -2808,7 +3032,7 @@ var ts; } function grammarErrorOnNode(node, message, arg0, arg1, arg2) { var span = getErrorSpanForNode(node); - var start = ts.skipTrivia(file.text, span.pos); + var start = span.end > span.pos ? ts.skipTrivia(file.text, span.pos) : span.pos; var length = span.end - start; file.syntacticErrors.push(ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); } @@ -2883,7 +3107,7 @@ var ts; return scanner.tryScan(function () { return lookAheadHelper(callback, false); }); } function isIdentifier() { - return token === 55 /* Identifier */ || (isInStrictMode ? token > ts.SyntaxKind.LastFutureReservedWord : token > ts.SyntaxKind.LastReservedWord); + return token === 59 /* Identifier */ || (isInStrictMode ? token > ts.SyntaxKind.LastFutureReservedWord : token > ts.SyntaxKind.LastReservedWord); } function parseExpected(t) { if (token === t) { @@ -2901,14 +3125,14 @@ var ts; return false; } function canParseSemicolon() { - if (token === 13 /* SemicolonToken */) { + if (token === 17 /* SemicolonToken */) { return true; } - return token === 6 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); + return token === 10 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); } function parseSemicolon() { if (canParseSemicolon()) { - if (token === 13 /* SemicolonToken */) { + if (token === 17 /* SemicolonToken */) { nextToken(); } } @@ -2930,7 +3154,7 @@ var ts; return node; } function createMissingNode() { - return createNode(111 /* Missing */); + return createNode(115 /* Missing */); } function internIdentifier(text) { return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); @@ -2938,7 +3162,7 @@ var ts; function createIdentifier(isIdentifier) { identifierCount++; if (isIdentifier) { - var node = createNode(55 /* Identifier */); + var node = createNode(59 /* Identifier */); var text = escapeIdentifier(scanner.getTokenValue()); node.text = internIdentifier(text); nextToken(); @@ -2951,13 +3175,13 @@ var ts; return createIdentifier(isIdentifier()); } function parseIdentifierName() { - return createIdentifier(token >= 55 /* Identifier */); + return createIdentifier(token >= 59 /* Identifier */); } function isPropertyName() { - return token >= 55 /* Identifier */ || token === 3 /* StringLiteral */ || token === 2 /* NumericLiteral */; + return token >= 59 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */; } function parsePropertyName() { - if (token === 3 /* StringLiteral */ || token === 2 /* NumericLiteral */) { + if (token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { return parseLiteralNode(true); } return parseIdentifierName(); @@ -2965,13 +3189,13 @@ var ts; function parseContextualModifier(t) { return token === t && tryParse(function () { nextToken(); - return token === 9 /* OpenBracketToken */ || isPropertyName(); + return token === 13 /* OpenBracketToken */ || isPropertyName(); }); } function parseAnyContextualModifier() { return isModifier(token) && tryParse(function () { nextToken(); - return token === 9 /* OpenBracketToken */ || isPropertyName(); + return token === 13 /* OpenBracketToken */ || isPropertyName(); }); } function isListElement(kind, inErrorRecovery) { @@ -2983,7 +3207,7 @@ var ts; case 4 /* SwitchClauseStatements */: return isStatement(inErrorRecovery); case 3 /* SwitchClauses */: - return token === 57 /* CaseKeyword */ || token === 63 /* DefaultKeyword */; + return token === 61 /* CaseKeyword */ || token === 67 /* DefaultKeyword */; case 5 /* TypeMembers */: return isTypeMember(); case 6 /* ClassMembers */: @@ -2992,17 +3216,18 @@ var ts; case 11 /* ObjectLiteralMembers */: return isPropertyName(); case 8 /* BaseTypeReferences */: - return isIdentifier() && ((token !== 69 /* ExtendsKeyword */ && token !== 92 /* ImplementsKeyword */) || !lookAhead(function () { return (nextToken(), isIdentifier()); })); + return isIdentifier() && ((token !== 73 /* ExtendsKeyword */ && token !== 96 /* ImplementsKeyword */) || !lookAhead(function () { return (nextToken(), isIdentifier()); })); case 9 /* VariableDeclarations */: case 14 /* TypeParameters */: return isIdentifier(); case 10 /* ArgumentExpressions */: return isExpression(); case 12 /* ArrayLiteralMembers */: - return token === 14 /* CommaToken */ || isExpression(); + return token === 18 /* CommaToken */ || isExpression(); case 13 /* Parameters */: return isParameter(); case 15 /* TypeArguments */: + case 16 /* TupleElementTypes */: return isType(); } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); @@ -3019,39 +3244,40 @@ var ts; case 6 /* ClassMembers */: case 7 /* EnumMembers */: case 11 /* ObjectLiteralMembers */: - return token === 6 /* CloseBraceToken */; + return token === 10 /* CloseBraceToken */; case 4 /* SwitchClauseStatements */: - return token === 6 /* CloseBraceToken */ || token === 57 /* CaseKeyword */ || token === 63 /* DefaultKeyword */; + return token === 10 /* CloseBraceToken */ || token === 61 /* CaseKeyword */ || token === 67 /* DefaultKeyword */; case 8 /* BaseTypeReferences */: - return token === 5 /* OpenBraceToken */ || token === 69 /* ExtendsKeyword */ || token === 92 /* ImplementsKeyword */; + return token === 9 /* OpenBraceToken */ || token === 73 /* ExtendsKeyword */ || token === 96 /* ImplementsKeyword */; case 9 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); case 14 /* TypeParameters */: - return token === 16 /* GreaterThanToken */ || token === 7 /* OpenParenToken */ || token === 5 /* OpenBraceToken */ || token === 69 /* ExtendsKeyword */ || token === 92 /* ImplementsKeyword */; + return token === 20 /* GreaterThanToken */ || token === 11 /* OpenParenToken */ || token === 9 /* OpenBraceToken */ || token === 73 /* ExtendsKeyword */ || token === 96 /* ImplementsKeyword */; case 10 /* ArgumentExpressions */: - return token === 8 /* CloseParenToken */ || token === 13 /* SemicolonToken */; + return token === 12 /* CloseParenToken */ || token === 17 /* SemicolonToken */; case 12 /* ArrayLiteralMembers */: - return token === 10 /* CloseBracketToken */; + case 16 /* TupleElementTypes */: + return token === 14 /* CloseBracketToken */; case 13 /* Parameters */: - return token === 8 /* CloseParenToken */ || token === 10 /* CloseBracketToken */ || token === 5 /* OpenBraceToken */; + return token === 12 /* CloseParenToken */ || token === 14 /* CloseBracketToken */ || token === 9 /* OpenBraceToken */; case 15 /* TypeArguments */: - return token === 16 /* GreaterThanToken */ || token === 7 /* OpenParenToken */; + return token === 20 /* GreaterThanToken */ || token === 11 /* OpenParenToken */; } } function isVariableDeclaratorListTerminator() { if (canParseSemicolon()) { return true; } - if (token === 76 /* InKeyword */) { + if (token === 80 /* InKeyword */) { return true; } - if (token === 23 /* EqualsGreaterThanToken */) { + if (token === 27 /* EqualsGreaterThanToken */) { return true; } return false; } function isInSomeParsingContext() { - for (var kind = 0; kind < 16 /* Count */; kind++) { + for (var kind = 0; kind < 17 /* Count */; kind++) { if (parsingContext & (1 << kind)) { if (isListElement(kind, true) || isListTerminator(kind)) { return true; @@ -3106,7 +3332,7 @@ var ts; if (isListElement(kind, false)) { result.push(parseElement()); commaStart = scanner.getTokenPos(); - if (parseOptional(14 /* CommaToken */)) { + if (parseOptional(18 /* CommaToken */)) { continue; } commaStart = -1; @@ -3123,7 +3349,7 @@ var ts; } } else if (trailingCommaBehavior === 2 /* Preserve */) { - result.push(createNode(142 /* OmittedExpression */)); + result.push(createNode(147 /* OmittedExpression */)); } } break; @@ -3163,8 +3389,8 @@ var ts; } function parseEntityName(allowReservedWords) { var entity = parseIdentifier(); - while (parseOptional(11 /* DotToken */)) { - var node = createNode(112 /* QualifiedName */, entity.pos); + while (parseOptional(15 /* DotToken */)) { + var node = createNode(116 /* QualifiedName */, entity.pos); node.left = entity; node.right = allowReservedWords ? parseIdentifierName() : parseIdentifier(); entity = finishNode(node); @@ -3183,7 +3409,7 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 2 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 6 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { if (isInStrictMode) { grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); } @@ -3194,29 +3420,29 @@ var ts; return node; } function parseStringLiteral() { - if (token === 3 /* StringLiteral */) + if (token === 7 /* StringLiteral */) return parseLiteralNode(true); error(ts.Diagnostics.String_literal_expected); return createMissingNode(); } function parseTypeReference() { - var node = createNode(123 /* TypeReference */); + var node = createNode(127 /* TypeReference */); node.typeName = parseEntityName(false); - if (!scanner.hasPrecedingLineBreak() && token === 15 /* LessThanToken */) { + if (!scanner.hasPrecedingLineBreak() && token === 19 /* LessThanToken */) { node.typeArguments = parseTypeArguments(); } return finishNode(node); } function parseTypeQuery() { - var node = createNode(124 /* TypeQuery */); - parseExpected(87 /* TypeOfKeyword */); + var node = createNode(128 /* TypeQuery */); + parseExpected(91 /* TypeOfKeyword */); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(113 /* TypeParameter */); + var node = createNode(117 /* TypeParameter */); node.name = parseIdentifier(); - if (parseOptional(69 /* ExtendsKeyword */)) { + if (parseOptional(73 /* ExtendsKeyword */)) { if (isType() || !isExpression()) { node.constraint = parseType(); } @@ -3228,9 +3454,9 @@ var ts; return finishNode(node); } function parseTypeParameters() { - if (token === 15 /* LessThanToken */) { + if (token === 19 /* LessThanToken */) { var pos = getNodePos(); - var result = parseBracketedList(14 /* TypeParameters */, parseTypeParameter, 15 /* LessThanToken */, 16 /* GreaterThanToken */); + var result = parseBracketedList(14 /* TypeParameters */, parseTypeParameter, 19 /* LessThanToken */, 20 /* GreaterThanToken */); if (!result.length) { var start = getTokenPos(pos); var length = getNodePos() - start; @@ -3240,37 +3466,44 @@ var ts; } } function parseParameterType() { - return parseOptional(42 /* ColonToken */) ? token === 3 /* StringLiteral */ ? parseStringLiteral() : parseType() : undefined; + return parseOptional(46 /* ColonToken */) ? token === 7 /* StringLiteral */ ? parseStringLiteral() : parseType() : undefined; } function isParameter() { - return token === 12 /* DotDotDotToken */ || isIdentifier() || isModifier(token); + return token === 16 /* DotDotDotToken */ || isIdentifier() || isModifier(token); } function parseParameter(flags) { if (flags === void 0) { flags = 0; } - var node = createNode(114 /* Parameter */); + var node = createNode(118 /* Parameter */); node.flags |= parseAndCheckModifiers(3 /* Parameters */); - if (parseOptional(12 /* DotDotDotToken */)) { + if (parseOptional(16 /* DotDotDotToken */)) { node.flags |= 8 /* Rest */; } node.name = parseIdentifier(); - if (node.name.kind === 111 /* Missing */ && node.flags === 0 && isModifier(token)) { + if (node.name.kind === 115 /* Missing */ && node.flags === 0 && isModifier(token)) { nextToken(); } - if (parseOptional(41 /* QuestionToken */)) { + if (parseOptional(45 /* QuestionToken */)) { node.flags |= 4 /* QuestionMark */; } node.type = parseParameterType(); node.initializer = parseInitializer(true); return finishNode(node); } - function parseSignature(kind, returnToken) { - if (kind === 121 /* ConstructSignature */) { - parseExpected(78 /* NewKeyword */); + function parseSignature(kind, returnToken, returnTokenRequired) { + if (kind === 125 /* ConstructSignature */) { + parseExpected(82 /* NewKeyword */); } var typeParameters = parseTypeParameters(); - var parameters = parseParameterList(7 /* OpenParenToken */, 8 /* CloseParenToken */); + var parameters = parseParameterList(11 /* OpenParenToken */, 12 /* CloseParenToken */); checkParameterList(parameters); - var type = parseOptional(returnToken) ? parseType() : undefined; + var type; + if (returnTokenRequired) { + parseExpected(returnToken); + type = parseType(); + } + else if (parseOptional(returnToken)) { + type = parseType(); + } return { typeParameters: typeParameters, parameters: parameters, @@ -3320,7 +3553,7 @@ var ts; } function parseSignatureMember(kind, returnToken) { var node = createNode(kind); - var sig = parseSignature(kind, returnToken); + var sig = parseSignature(kind, returnToken, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -3328,10 +3561,10 @@ var ts; return finishNode(node); } function parseIndexSignatureMember() { - var node = createNode(122 /* IndexSignature */); + var node = createNode(126 /* IndexSignature */); var errorCountBeforeIndexSignature = file.syntacticErrors.length; var indexerStart = scanner.getTokenPos(); - node.parameters = parseParameterList(9 /* OpenBracketToken */, 10 /* CloseBracketToken */); + node.parameters = parseParameterList(13 /* OpenBracketToken */, 14 /* CloseBracketToken */); var indexerLength = scanner.getStartPos() - indexerStart; node.type = parseTypeAnnotation(); parseSemicolon(); @@ -3372,7 +3605,7 @@ var ts; grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); return; } - else if (parameter.type.kind !== 110 /* StringKeyword */ && parameter.type.kind !== 108 /* NumberKeyword */) { + else if (parameter.type.kind !== 114 /* StringKeyword */ && parameter.type.kind !== 112 /* NumberKeyword */) { grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); return; } @@ -3384,18 +3617,18 @@ var ts; function parsePropertyOrMethod() { var node = createNode(0 /* Unknown */); node.name = parsePropertyName(); - if (parseOptional(41 /* QuestionToken */)) { + if (parseOptional(45 /* QuestionToken */)) { node.flags |= 4 /* QuestionMark */; } - if (token === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */) { - node.kind = 116 /* Method */; - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { + node.kind = 120 /* Method */; + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; } else { - node.kind = 115 /* Property */; + node.kind = 119 /* Property */; node.type = parseTypeAnnotation(); } parseSemicolon(); @@ -3403,49 +3636,59 @@ var ts; } function isTypeMember() { switch (token) { - case 7 /* OpenParenToken */: - case 15 /* LessThanToken */: - case 9 /* OpenBracketToken */: + case 11 /* OpenParenToken */: + case 19 /* LessThanToken */: + case 13 /* OpenBracketToken */: return true; default: - return isPropertyName() && lookAhead(function () { return nextToken() === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */ || token === 41 /* QuestionToken */ || token === 42 /* ColonToken */ || canParseSemicolon(); }); + return isPropertyName() && lookAhead(function () { return nextToken() === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */ || token === 45 /* QuestionToken */ || token === 46 /* ColonToken */ || canParseSemicolon(); }); } } function parseTypeMember() { switch (token) { - case 7 /* OpenParenToken */: - case 15 /* LessThanToken */: - return parseSignatureMember(120 /* CallSignature */, 42 /* ColonToken */); - case 9 /* OpenBracketToken */: + case 11 /* OpenParenToken */: + case 19 /* LessThanToken */: + return parseSignatureMember(124 /* CallSignature */, 46 /* ColonToken */); + case 13 /* OpenBracketToken */: return parseIndexSignatureMember(); - case 78 /* NewKeyword */: - if (lookAhead(function () { return nextToken() === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */; })) { - return parseSignatureMember(121 /* ConstructSignature */, 42 /* ColonToken */); + case 82 /* NewKeyword */: + if (lookAhead(function () { return nextToken() === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */; })) { + return parseSignatureMember(125 /* ConstructSignature */, 46 /* ColonToken */); } - case 3 /* StringLiteral */: - case 2 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 6 /* NumericLiteral */: return parsePropertyOrMethod(); default: - if (token >= 55 /* Identifier */) { + if (token >= 59 /* Identifier */) { return parsePropertyOrMethod(); } } } function parseTypeLiteral() { - var node = createNode(125 /* TypeLiteral */); - if (parseExpected(5 /* OpenBraceToken */)) { + var node = createNode(129 /* TypeLiteral */); + if (parseExpected(9 /* OpenBraceToken */)) { node.members = parseList(5 /* TypeMembers */, false, parseTypeMember); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); } else { node.members = createMissingList(); } return finishNode(node); } + function parseTupleType() { + var node = createNode(131 /* TupleType */); + var startTokenPos = scanner.getTokenPos(); + var startErrorCount = file.syntacticErrors.length; + node.elementTypes = parseBracketedList(16 /* TupleElementTypes */, parseType, 13 /* OpenBracketToken */, 14 /* CloseBracketToken */); + if (!node.elementTypes.length && file.syntacticErrors.length === startErrorCount) { + grammarErrorAtPos(startTokenPos, scanner.getStartPos() - startTokenPos, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty); + } + return finishNode(node); + } function parseFunctionType(signatureKind) { - var node = createNode(125 /* TypeLiteral */); + var node = createNode(129 /* TypeLiteral */); var member = createNode(signatureKind); - var sig = parseSignature(signatureKind, 23 /* EqualsGreaterThanToken */); + var sig = parseSignature(signatureKind, 27 /* EqualsGreaterThanToken */, true); member.typeParameters = sig.typeParameters; member.parameters = sig.parameters; member.type = sig.type; @@ -3455,26 +3698,28 @@ var ts; } function parseKeywordAndNoDot() { var node = parseTokenNode(); - return token === 11 /* DotToken */ ? undefined : node; + return token === 15 /* DotToken */ ? undefined : node; } function parseNonArrayType() { switch (token) { - case 101 /* AnyKeyword */: - case 110 /* StringKeyword */: - case 108 /* NumberKeyword */: - case 102 /* BooleanKeyword */: - case 89 /* VoidKeyword */: + case 105 /* AnyKeyword */: + case 114 /* StringKeyword */: + case 112 /* NumberKeyword */: + case 106 /* BooleanKeyword */: + case 93 /* VoidKeyword */: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); - case 87 /* TypeOfKeyword */: + case 91 /* TypeOfKeyword */: return parseTypeQuery(); - case 5 /* OpenBraceToken */: + case 9 /* OpenBraceToken */: return parseTypeLiteral(); - case 7 /* OpenParenToken */: - case 15 /* LessThanToken */: - return parseFunctionType(120 /* CallSignature */); - case 78 /* NewKeyword */: - return parseFunctionType(121 /* ConstructSignature */); + case 13 /* OpenBracketToken */: + return parseTupleType(); + case 11 /* OpenParenToken */: + case 19 /* LessThanToken */: + return parseFunctionType(124 /* CallSignature */); + case 82 /* NewKeyword */: + return parseFunctionType(125 /* ConstructSignature */); default: if (isIdentifier()) { return parseTypeReference(); @@ -3485,20 +3730,21 @@ var ts; } function isType() { switch (token) { - case 101 /* AnyKeyword */: - case 110 /* StringKeyword */: - case 108 /* NumberKeyword */: - case 102 /* BooleanKeyword */: - case 89 /* VoidKeyword */: - case 87 /* TypeOfKeyword */: - case 5 /* OpenBraceToken */: - case 15 /* LessThanToken */: - case 78 /* NewKeyword */: + case 105 /* AnyKeyword */: + case 114 /* StringKeyword */: + case 112 /* NumberKeyword */: + case 106 /* BooleanKeyword */: + case 93 /* VoidKeyword */: + case 91 /* TypeOfKeyword */: + case 9 /* OpenBraceToken */: + case 13 /* OpenBracketToken */: + case 19 /* LessThanToken */: + case 82 /* NewKeyword */: return true; - case 7 /* OpenParenToken */: + case 11 /* OpenParenToken */: return lookAhead(function () { nextToken(); - return token === 8 /* CloseParenToken */ || isParameter(); + return token === 12 /* CloseParenToken */ || isParameter(); }); default: return isIdentifier(); @@ -3506,66 +3752,66 @@ var ts; } function parseType() { var type = parseNonArrayType(); - while (type && !scanner.hasPrecedingLineBreak() && parseOptional(9 /* OpenBracketToken */)) { - parseExpected(10 /* CloseBracketToken */); - var node = createNode(126 /* ArrayType */, type.pos); + while (type && !scanner.hasPrecedingLineBreak() && parseOptional(13 /* OpenBracketToken */)) { + parseExpected(14 /* CloseBracketToken */); + var node = createNode(130 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } return type; } function parseTypeAnnotation() { - return parseOptional(42 /* ColonToken */) ? parseType() : undefined; + return parseOptional(46 /* ColonToken */) ? parseType() : undefined; } function isExpression() { switch (token) { - case 83 /* ThisKeyword */: - case 81 /* SuperKeyword */: - case 79 /* NullKeyword */: - case 85 /* TrueKeyword */: - case 70 /* FalseKeyword */: - case 2 /* NumericLiteral */: - case 3 /* StringLiteral */: - case 7 /* OpenParenToken */: - case 9 /* OpenBracketToken */: - case 5 /* OpenBraceToken */: - case 73 /* FunctionKeyword */: - case 78 /* NewKeyword */: - case 27 /* SlashToken */: - case 47 /* SlashEqualsToken */: - case 24 /* PlusToken */: - case 25 /* MinusToken */: - case 38 /* TildeToken */: - case 37 /* ExclamationToken */: - case 64 /* DeleteKeyword */: - case 87 /* TypeOfKeyword */: - case 89 /* VoidKeyword */: - case 29 /* PlusPlusToken */: - case 30 /* MinusMinusToken */: - case 15 /* LessThanToken */: - case 55 /* Identifier */: + case 87 /* ThisKeyword */: + case 85 /* SuperKeyword */: + case 83 /* NullKeyword */: + case 89 /* TrueKeyword */: + case 74 /* FalseKeyword */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 11 /* OpenParenToken */: + case 13 /* OpenBracketToken */: + case 9 /* OpenBraceToken */: + case 77 /* FunctionKeyword */: + case 82 /* NewKeyword */: + case 31 /* SlashToken */: + case 51 /* SlashEqualsToken */: + case 28 /* PlusToken */: + case 29 /* MinusToken */: + case 42 /* TildeToken */: + case 41 /* ExclamationToken */: + case 68 /* DeleteKeyword */: + case 91 /* TypeOfKeyword */: + case 93 /* VoidKeyword */: + case 33 /* PlusPlusToken */: + case 34 /* MinusMinusToken */: + case 19 /* LessThanToken */: + case 59 /* Identifier */: return true; default: return isIdentifier(); } } function isExpressionStatement() { - return token !== 5 /* OpenBraceToken */ && token !== 73 /* FunctionKeyword */ && isExpression(); + return token !== 9 /* OpenBraceToken */ && token !== 77 /* FunctionKeyword */ && isExpression(); } function parseExpression(noIn) { var expr = parseAssignmentExpression(noIn); - while (parseOptional(14 /* CommaToken */)) { - expr = makeBinaryExpression(expr, 14 /* CommaToken */, parseAssignmentExpression(noIn)); + while (parseOptional(18 /* CommaToken */)) { + expr = makeBinaryExpression(expr, 18 /* CommaToken */, parseAssignmentExpression(noIn)); } return expr; } function parseInitializer(inParameter, noIn) { - if (token !== 43 /* EqualsToken */) { - if (scanner.hasPrecedingLineBreak() || (inParameter && token === 5 /* OpenBraceToken */) || !isExpression()) { + if (token !== 47 /* EqualsToken */) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 9 /* OpenBraceToken */) || !isExpression()) { return undefined; } } - parseExpected(43 /* EqualsToken */); + parseExpected(47 /* EqualsToken */); return parseAssignmentExpression(noIn); } function parseAssignmentExpression(noIn) { @@ -3574,7 +3820,7 @@ var ts; return arrowExpression; } var expr = parseConditionalExpression(noIn); - if (expr.kind === 55 /* Identifier */ && token === 23 /* EqualsGreaterThanToken */) { + if (expr.kind === 59 /* Identifier */ && token === 27 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression(expr); } if (isLeftHandSideExpression(expr) && isAssignmentOperator()) { @@ -3590,33 +3836,33 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 130 /* PropertyAccess */: - case 131 /* IndexedAccess */: - case 133 /* NewExpression */: - case 132 /* CallExpression */: - case 127 /* ArrayLiteral */: - case 135 /* ParenExpression */: - case 128 /* ObjectLiteral */: - case 136 /* FunctionExpression */: - case 55 /* Identifier */: - case 111 /* Missing */: - case 4 /* RegularExpressionLiteral */: - case 2 /* NumericLiteral */: - case 3 /* StringLiteral */: - case 70 /* FalseKeyword */: - case 79 /* NullKeyword */: - case 83 /* ThisKeyword */: - case 85 /* TrueKeyword */: - case 81 /* SuperKeyword */: + case 135 /* PropertyAccess */: + case 136 /* IndexedAccess */: + case 138 /* NewExpression */: + case 137 /* CallExpression */: + case 132 /* ArrayLiteral */: + case 140 /* ParenExpression */: + case 133 /* ObjectLiteral */: + case 141 /* FunctionExpression */: + case 59 /* Identifier */: + case 115 /* Missing */: + case 8 /* RegularExpressionLiteral */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 74 /* FalseKeyword */: + case 83 /* NullKeyword */: + case 87 /* ThisKeyword */: + case 89 /* TrueKeyword */: + case 85 /* SuperKeyword */: return true; } } return false; } function parseSimpleArrowFunctionExpression(identifier) { - ts.Debug.assert(token === 23 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - parseExpected(23 /* EqualsGreaterThanToken */); - var parameter = createNode(114 /* Parameter */, identifier.pos); + ts.Debug.assert(token === 27 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + parseExpected(27 /* EqualsGreaterThanToken */); + var parameter = createNode(118 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); var parameters = []; @@ -3633,17 +3879,17 @@ var ts; } var pos = getNodePos(); if (triState === 1 /* True */) { - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); - if (parseExpected(23 /* EqualsGreaterThanToken */) || token === 5 /* OpenBraceToken */) { + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); + if (parseExpected(27 /* EqualsGreaterThanToken */) || token === 9 /* OpenBraceToken */) { return parseArrowExpressionTail(pos, sig, false); } else { - return makeFunctionExpression(137 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); + return makeFunctionExpression(142 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); } } var sig = tryParseSignatureIfArrowOrBraceFollows(); if (sig) { - parseExpected(23 /* EqualsGreaterThanToken */); + parseExpected(27 /* EqualsGreaterThanToken */); return parseArrowExpressionTail(pos, sig, false); } else { @@ -3651,35 +3897,35 @@ var ts; } } function isParenthesizedArrowFunctionExpression() { - if (token === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */) { + if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { return lookAhead(function () { var first = token; var second = nextToken(); - if (first === 7 /* OpenParenToken */) { - if (second === 8 /* CloseParenToken */) { + if (first === 11 /* OpenParenToken */) { + if (second === 12 /* CloseParenToken */) { var third = nextToken(); switch (third) { - case 23 /* EqualsGreaterThanToken */: - case 42 /* ColonToken */: - case 5 /* OpenBraceToken */: + case 27 /* EqualsGreaterThanToken */: + case 46 /* ColonToken */: + case 9 /* OpenBraceToken */: return 1 /* True */; default: return 0 /* False */; } } - if (second === 12 /* DotDotDotToken */) { + if (second === 16 /* DotDotDotToken */) { return 1 /* True */; } if (!isIdentifier()) { return 0 /* False */; } - if (nextToken() === 42 /* ColonToken */) { + if (nextToken() === 46 /* ColonToken */) { return 1 /* True */; } return 2 /* Unknown */; } else { - ts.Debug.assert(first === 15 /* LessThanToken */); + ts.Debug.assert(first === 19 /* LessThanToken */); if (!isIdentifier()) { return 0 /* False */; } @@ -3687,15 +3933,15 @@ var ts; } }); } - if (token === 23 /* EqualsGreaterThanToken */) { + if (token === 27 /* EqualsGreaterThanToken */) { return 1 /* True */; } return 0 /* False */; } function tryParseSignatureIfArrowOrBraceFollows() { return tryParse(function () { - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); - if (token === 23 /* EqualsGreaterThanToken */ || token === 5 /* OpenBraceToken */) { + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); + if (token === 27 /* EqualsGreaterThanToken */ || token === 9 /* OpenBraceToken */) { return sig; } return undefined; @@ -3703,27 +3949,27 @@ var ts; } function parseArrowExpressionTail(pos, sig, noIn) { var body; - if (token === 5 /* OpenBraceToken */) { + if (token === 9 /* OpenBraceToken */) { body = parseBody(false); } - else if (isStatement(true) && !isExpressionStatement() && token !== 73 /* FunctionKeyword */) { + else if (isStatement(true) && !isExpressionStatement() && token !== 77 /* FunctionKeyword */) { body = parseBody(true); } else { body = parseAssignmentExpression(noIn); } - return makeFunctionExpression(137 /* ArrowFunction */, pos, undefined, sig, body); + return makeFunctionExpression(142 /* ArrowFunction */, pos, undefined, sig, body); } function isAssignmentOperator() { return token >= ts.SyntaxKind.FirstAssignment && token <= ts.SyntaxKind.LastAssignment; } function parseConditionalExpression(noIn) { var expr = parseBinaryExpression(noIn); - while (parseOptional(41 /* QuestionToken */)) { - var node = createNode(141 /* ConditionalExpression */, expr.pos); + while (parseOptional(45 /* QuestionToken */)) { + var node = createNode(146 /* ConditionalExpression */, expr.pos); node.condition = expr; node.whenTrue = parseAssignmentExpression(false); - parseExpected(42 /* ColonToken */); + parseExpected(46 /* ColonToken */); node.whenFalse = parseAssignmentExpression(noIn); expr = finishNode(node); } @@ -3736,7 +3982,7 @@ var ts; while (true) { reScanGreaterToken(); var precedence = getOperatorPrecedence(); - if (precedence && precedence > minPrecedence && (!noIn || token !== 76 /* InKeyword */)) { + if (precedence && precedence > minPrecedence && (!noIn || token !== 80 /* InKeyword */)) { var operator = token; nextToken(); expr = makeBinaryExpression(expr, operator, parseBinaryOperators(parseUnaryExpression(), precedence, noIn)); @@ -3747,44 +3993,44 @@ var ts; } function getOperatorPrecedence() { switch (token) { - case 40 /* BarBarToken */: + case 44 /* BarBarToken */: return 1; - case 39 /* AmpersandAmpersandToken */: + case 43 /* AmpersandAmpersandToken */: return 2; - case 35 /* BarToken */: + case 39 /* BarToken */: return 3; - case 36 /* CaretToken */: + case 40 /* CaretToken */: return 4; - case 34 /* AmpersandToken */: + case 38 /* AmpersandToken */: return 5; - case 19 /* EqualsEqualsToken */: - case 20 /* ExclamationEqualsToken */: - case 21 /* EqualsEqualsEqualsToken */: - case 22 /* ExclamationEqualsEqualsToken */: + case 23 /* EqualsEqualsToken */: + case 24 /* ExclamationEqualsToken */: + case 25 /* EqualsEqualsEqualsToken */: + case 26 /* ExclamationEqualsEqualsToken */: return 6; - case 15 /* LessThanToken */: - case 16 /* GreaterThanToken */: - case 17 /* LessThanEqualsToken */: - case 18 /* GreaterThanEqualsToken */: - case 77 /* InstanceOfKeyword */: - case 76 /* InKeyword */: + case 19 /* LessThanToken */: + case 20 /* GreaterThanToken */: + case 21 /* LessThanEqualsToken */: + case 22 /* GreaterThanEqualsToken */: + case 81 /* InstanceOfKeyword */: + case 80 /* InKeyword */: return 7; - case 31 /* LessThanLessThanToken */: - case 32 /* GreaterThanGreaterThanToken */: - case 33 /* GreaterThanGreaterThanGreaterThanToken */: + case 35 /* LessThanLessThanToken */: + case 36 /* GreaterThanGreaterThanToken */: + case 37 /* GreaterThanGreaterThanGreaterThanToken */: return 8; - case 24 /* PlusToken */: - case 25 /* MinusToken */: + case 28 /* PlusToken */: + case 29 /* MinusToken */: return 9; - case 26 /* AsteriskToken */: - case 27 /* SlashToken */: - case 28 /* PercentToken */: + case 30 /* AsteriskToken */: + case 31 /* SlashToken */: + case 32 /* PercentToken */: return 10; } return undefined; } function makeBinaryExpression(left, operator, right) { - var node = createNode(140 /* BinaryExpression */, left.pos); + var node = createNode(145 /* BinaryExpression */, left.pos); node.left = left; node.operator = operator; node.right = right; @@ -3793,52 +4039,52 @@ var ts; function parseUnaryExpression() { var pos = getNodePos(); switch (token) { - case 24 /* PlusToken */: - case 25 /* MinusToken */: - case 38 /* TildeToken */: - case 37 /* ExclamationToken */: - case 64 /* DeleteKeyword */: - case 87 /* TypeOfKeyword */: - case 89 /* VoidKeyword */: - case 29 /* PlusPlusToken */: - case 30 /* MinusMinusToken */: + case 28 /* PlusToken */: + case 29 /* MinusToken */: + case 42 /* TildeToken */: + case 41 /* ExclamationToken */: + case 68 /* DeleteKeyword */: + case 91 /* TypeOfKeyword */: + case 93 /* VoidKeyword */: + case 33 /* PlusPlusToken */: + case 34 /* MinusMinusToken */: var operator = token; nextToken(); var operand = parseUnaryExpression(); if (isInStrictMode) { - if ((token === 29 /* PlusPlusToken */ || token === 30 /* MinusMinusToken */) && isEvalOrArgumentsIdentifier(operand)) { + if ((token === 33 /* PlusPlusToken */ || token === 34 /* MinusMinusToken */) && isEvalOrArgumentsIdentifier(operand)) { reportInvalidUseInStrictMode(operand); } - else if (token === 64 /* DeleteKeyword */ && operand.kind === 55 /* Identifier */) { + else if (token === 68 /* DeleteKeyword */ && operand.kind === 59 /* Identifier */) { grammarErrorOnNode(operand, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); } } - return makeUnaryExpression(138 /* PrefixOperator */, pos, operator, operand); - case 15 /* LessThanToken */: + return makeUnaryExpression(143 /* PrefixOperator */, pos, operator, operand); + case 19 /* LessThanToken */: return parseTypeAssertion(); } var primaryExpression = parsePrimaryExpression(); - var illegalUsageOfSuperKeyword = primaryExpression.kind === 81 /* SuperKeyword */ && token !== 7 /* OpenParenToken */ && token !== 11 /* DotToken */; + var illegalUsageOfSuperKeyword = primaryExpression.kind === 85 /* SuperKeyword */ && token !== 11 /* OpenParenToken */ && token !== 15 /* DotToken */; if (illegalUsageOfSuperKeyword) { error(ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); } var expr = parseCallAndAccess(primaryExpression, false); ts.Debug.assert(isLeftHandSideExpression(expr)); - if ((token === 29 /* PlusPlusToken */ || token === 30 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + if ((token === 33 /* PlusPlusToken */ || token === 34 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { if (isInStrictMode && isEvalOrArgumentsIdentifier(expr)) { reportInvalidUseInStrictMode(expr); } var operator = token; nextToken(); - expr = makeUnaryExpression(139 /* PostfixOperator */, expr.pos, operator, expr); + expr = makeUnaryExpression(144 /* PostfixOperator */, expr.pos, operator, expr); } return expr; } function parseTypeAssertion() { - var node = createNode(134 /* TypeAssertion */); - parseExpected(15 /* LessThanToken */); + var node = createNode(139 /* TypeAssertion */); + parseExpected(19 /* LessThanToken */); node.type = parseType(); - parseExpected(16 /* GreaterThanToken */); + parseExpected(20 /* GreaterThanToken */); node.operand = parseUnaryExpression(); return finishNode(node); } @@ -3850,44 +4096,52 @@ var ts; } function parseCallAndAccess(expr, inNewExpression) { while (true) { - if (parseOptional(11 /* DotToken */)) { - var propertyAccess = createNode(130 /* PropertyAccess */, expr.pos); + var dotStart = scanner.getTokenPos(); + if (parseOptional(15 /* DotToken */)) { + var propertyAccess = createNode(135 /* PropertyAccess */, expr.pos); + if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord() && lookAhead(function () { return scanner.isReservedWord(); })) { + grammarErrorAtPos(dotStart, scanner.getStartPos() - dotStart, ts.Diagnostics.Identifier_expected); + var id = createMissingNode(); + } + else { + var id = parseIdentifierName(); + } propertyAccess.left = expr; - propertyAccess.right = parseIdentifierName(); + propertyAccess.right = id; expr = finishNode(propertyAccess); continue; } var bracketStart = scanner.getTokenPos(); - if (parseOptional(9 /* OpenBracketToken */)) { - var indexedAccess = createNode(131 /* IndexedAccess */, expr.pos); + if (parseOptional(13 /* OpenBracketToken */)) { + var indexedAccess = createNode(136 /* IndexedAccess */, expr.pos); indexedAccess.object = expr; - if (inNewExpression && parseOptional(10 /* CloseBracketToken */)) { + if (inNewExpression && parseOptional(14 /* CloseBracketToken */)) { indexedAccess.index = createMissingNode(); grammarErrorAtPos(bracketStart, scanner.getStartPos() - bracketStart, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { indexedAccess.index = parseExpression(); - if (indexedAccess.index.kind === 3 /* StringLiteral */ || indexedAccess.index.kind === 2 /* NumericLiteral */) { + if (indexedAccess.index.kind === 7 /* StringLiteral */ || indexedAccess.index.kind === 6 /* NumericLiteral */) { var literal = indexedAccess.index; literal.text = internIdentifier(literal.text); } - parseExpected(10 /* CloseBracketToken */); + parseExpected(14 /* CloseBracketToken */); } expr = finishNode(indexedAccess); continue; } - if ((token === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */) && !inNewExpression) { - var callExpr = createNode(132 /* CallExpression */, expr.pos); + if ((token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) && !inNewExpression) { + var callExpr = createNode(137 /* CallExpression */, expr.pos); callExpr.func = expr; - if (token === 15 /* LessThanToken */) { + if (token === 19 /* LessThanToken */) { if (!(callExpr.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) return expr; } else { - parseExpected(7 /* OpenParenToken */); + parseExpected(11 /* OpenParenToken */); } callExpr.arguments = parseDelimitedList(10 /* ArgumentExpressions */, parseAssignmentExpression, 0 /* Disallow */); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); expr = finishNode(callExpr); continue; } @@ -3896,13 +4150,13 @@ var ts; } function parseTypeArgumentsAndOpenParen() { var result = parseTypeArguments(); - parseExpected(7 /* OpenParenToken */); + parseExpected(11 /* OpenParenToken */); return result; } function parseTypeArguments() { var typeArgumentListStart = scanner.getTokenPos(); var errorCountBeforeTypeParameterList = file.syntacticErrors.length; - var result = parseBracketedList(15 /* TypeArguments */, parseType, 15 /* LessThanToken */, 16 /* GreaterThanToken */); + var result = parseBracketedList(15 /* TypeArguments */, parseType, 19 /* LessThanToken */, 20 /* GreaterThanToken */); if (!result.length && file.syntacticErrors.length === errorCountBeforeTypeParameterList) { grammarErrorAtPos(typeArgumentListStart, scanner.getStartPos() - typeArgumentListStart, ts.Diagnostics.Type_argument_list_cannot_be_empty); } @@ -3910,28 +4164,28 @@ var ts; } function parsePrimaryExpression() { switch (token) { - case 83 /* ThisKeyword */: - case 81 /* SuperKeyword */: - case 79 /* NullKeyword */: - case 85 /* TrueKeyword */: - case 70 /* FalseKeyword */: + case 87 /* ThisKeyword */: + case 85 /* SuperKeyword */: + case 83 /* NullKeyword */: + case 89 /* TrueKeyword */: + case 74 /* FalseKeyword */: return parseTokenNode(); - case 2 /* NumericLiteral */: - case 3 /* StringLiteral */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: return parseLiteralNode(); - case 7 /* OpenParenToken */: + case 11 /* OpenParenToken */: return parseParenExpression(); - case 9 /* OpenBracketToken */: + case 13 /* OpenBracketToken */: return parseArrayLiteral(); - case 5 /* OpenBraceToken */: + case 9 /* OpenBraceToken */: return parseObjectLiteral(); - case 73 /* FunctionKeyword */: + case 77 /* FunctionKeyword */: return parseFunctionExpression(); - case 78 /* NewKeyword */: + case 82 /* NewKeyword */: return parseNewExpression(); - case 27 /* SlashToken */: - case 47 /* SlashEqualsToken */: - if (reScanSlashToken() === 4 /* RegularExpressionLiteral */) { + case 31 /* SlashToken */: + case 51 /* SlashEqualsToken */: + if (reScanSlashToken() === 8 /* RegularExpressionLiteral */) { return parseLiteralNode(); } break; @@ -3944,34 +4198,34 @@ var ts; return createMissingNode(); } function parseParenExpression() { - var node = createNode(135 /* ParenExpression */); - parseExpected(7 /* OpenParenToken */); + var node = createNode(140 /* ParenExpression */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); return finishNode(node); } function parseArrayLiteralElement() { - return token === 14 /* CommaToken */ ? createNode(142 /* OmittedExpression */) : parseAssignmentExpression(); + return token === 18 /* CommaToken */ ? createNode(147 /* OmittedExpression */) : parseAssignmentExpression(); } function parseArrayLiteral() { - var node = createNode(127 /* ArrayLiteral */); - parseExpected(9 /* OpenBracketToken */); + var node = createNode(132 /* ArrayLiteral */); + parseExpected(13 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) - node.flags |= 128 /* MultiLine */; + node.flags |= 256 /* MultiLine */; node.elements = parseDelimitedList(12 /* ArrayLiteralMembers */, parseArrayLiteralElement, 2 /* Preserve */); - parseExpected(10 /* CloseBracketToken */); + parseExpected(14 /* CloseBracketToken */); return finishNode(node); } function parsePropertyAssignment() { - var node = createNode(129 /* PropertyAssignment */); + var node = createNode(134 /* PropertyAssignment */); node.name = parsePropertyName(); - if (token === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */) { - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); var body = parseBody(false); - node.initializer = makeFunctionExpression(136 /* FunctionExpression */, node.pos, undefined, sig, body); + node.initializer = makeFunctionExpression(141 /* FunctionExpression */, node.pos, undefined, sig, body); } else { - parseExpected(42 /* ColonToken */); + parseExpected(46 /* ColonToken */); node.initializer = parseAssignmentExpression(false); } return finishNode(node); @@ -3979,38 +4233,38 @@ var ts; function parseObjectLiteralMember() { var initialPos = getNodePos(); var initialToken = token; - if (parseContextualModifier(105 /* GetKeyword */) || parseContextualModifier(109 /* SetKeyword */)) { - var kind = initialToken === 105 /* GetKeyword */ ? 118 /* GetAccessor */ : 119 /* SetAccessor */; + if (parseContextualModifier(109 /* GetKeyword */) || parseContextualModifier(113 /* SetKeyword */)) { + var kind = initialToken === 109 /* GetKeyword */ ? 122 /* GetAccessor */ : 123 /* SetAccessor */; return parseAndCheckMemberAccessorDeclaration(kind, initialPos, 0); } return parsePropertyAssignment(); } function parseObjectLiteral() { - var node = createNode(128 /* ObjectLiteral */); - parseExpected(5 /* OpenBraceToken */); + var node = createNode(133 /* ObjectLiteral */); + parseExpected(9 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 128 /* MultiLine */; + node.flags |= 256 /* MultiLine */; } var trailingCommaBehavior = languageVersion === 0 /* ES3 */ ? 1 /* Allow */ : 2 /* Preserve */; node.properties = parseDelimitedList(11 /* ObjectLiteralMembers */, parseObjectLiteralMember, trailingCommaBehavior); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); var seen = {}; var Property = 1; var GetAccessor = 2; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; ts.forEach(node.properties, function (p) { - if (p.kind === 142 /* OmittedExpression */) { + if (p.kind === 147 /* OmittedExpression */) { return; } var currentKind; - if (p.kind === 129 /* PropertyAssignment */) { + if (p.kind === 134 /* PropertyAssignment */) { currentKind = Property; } - else if (p.kind === 118 /* GetAccessor */) { + else if (p.kind === 122 /* GetAccessor */) { currentKind = GetAccessor; } - else if (p.kind === 119 /* SetAccessor */) { + else if (p.kind === 123 /* SetAccessor */) { currentKind = SetAccesor; } else { @@ -4043,14 +4297,14 @@ var ts; } function parseFunctionExpression() { var pos = getNodePos(); - parseExpected(73 /* FunctionKeyword */); + parseExpected(77 /* FunctionKeyword */); var name = isIdentifier() ? parseIdentifier() : undefined; - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); var body = parseBody(false); if (name && isInStrictMode && isEvalOrArgumentsIdentifier(name)) { reportInvalidUseInStrictMode(name); } - return makeFunctionExpression(136 /* FunctionExpression */, pos, name, sig, body); + return makeFunctionExpression(141 /* FunctionExpression */, pos, name, sig, body); } function makeFunctionExpression(kind, pos, name, sig, body) { var node = createNode(kind, pos); @@ -4062,20 +4316,20 @@ var ts; return finishNode(node); } function parseNewExpression() { - var node = createNode(133 /* NewExpression */); - parseExpected(78 /* NewKeyword */); + var node = createNode(138 /* NewExpression */); + parseExpected(82 /* NewKeyword */); node.func = parseCallAndAccess(parsePrimaryExpression(), true); - if (parseOptional(7 /* OpenParenToken */) || token === 15 /* LessThanToken */ && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { + if (parseOptional(11 /* OpenParenToken */) || token === 19 /* LessThanToken */ && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { node.arguments = parseDelimitedList(10 /* ArgumentExpressions */, parseAssignmentExpression, 0 /* Disallow */); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); } return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode) { - var node = createNode(143 /* Block */); - if (parseExpected(5 /* OpenBraceToken */) || ignoreMissingOpenBrace) { + var node = createNode(148 /* Block */); + if (parseExpected(9 /* OpenBraceToken */) || ignoreMissingOpenBrace) { node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatement); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -4095,7 +4349,7 @@ var ts; } labelledStatementInfo.pushFunctionBoundary(); var block = parseBlock(ignoreMissingOpenBrace, true); - block.kind = 168 /* FunctionBlock */; + block.kind = 173 /* FunctionBlock */; labelledStatementInfo.pop(); inFunctionBody = saveInFunctionBody; inSwitchStatement = saveInSwitchStatement; @@ -4103,40 +4357,40 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(145 /* EmptyStatement */); - parseExpected(13 /* SemicolonToken */); + var node = createNode(150 /* EmptyStatement */); + parseExpected(17 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(147 /* IfStatement */); - parseExpected(74 /* IfKeyword */); - parseExpected(7 /* OpenParenToken */); + var node = createNode(152 /* IfStatement */); + parseExpected(78 /* IfKeyword */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(66 /* ElseKeyword */) ? parseStatement() : undefined; + node.elseStatement = parseOptional(70 /* ElseKeyword */) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(148 /* DoStatement */); - parseExpected(65 /* DoKeyword */); + var node = createNode(153 /* DoStatement */); + parseExpected(69 /* DoKeyword */); var saveInIterationStatement = inIterationStatement; inIterationStatement = 1 /* Nested */; node.statement = parseStatement(); inIterationStatement = saveInIterationStatement; - parseExpected(90 /* WhileKeyword */); - parseExpected(7 /* OpenParenToken */); + parseExpected(94 /* WhileKeyword */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); - parseOptional(13 /* SemicolonToken */); + parseExpected(12 /* CloseParenToken */); + parseOptional(17 /* SemicolonToken */); return finishNode(node); } function parseWhileStatement() { - var node = createNode(149 /* WhileStatement */); - parseExpected(90 /* WhileKeyword */); - parseExpected(7 /* OpenParenToken */); + var node = createNode(154 /* WhileStatement */); + parseExpected(94 /* WhileKeyword */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); var saveInIterationStatement = inIterationStatement; inIterationStatement = 1 /* Nested */; node.statement = parseStatement(); @@ -4145,10 +4399,10 @@ var ts; } function parseForOrForInStatement() { var pos = getNodePos(); - parseExpected(72 /* ForKeyword */); - parseExpected(7 /* OpenParenToken */); - if (token !== 13 /* SemicolonToken */) { - if (parseOptional(88 /* VarKeyword */)) { + parseExpected(76 /* ForKeyword */); + parseExpected(11 /* OpenParenToken */); + if (token !== 17 /* SemicolonToken */) { + if (parseOptional(92 /* VarKeyword */)) { var declarations = parseVariableDeclarationList(0, true); if (!declarations.length) { error(ts.Diagnostics.Variable_declaration_list_cannot_be_empty); @@ -4159,8 +4413,8 @@ var ts; } } var forOrForInStatement; - if (parseOptional(76 /* InKeyword */)) { - var forInStatement = createNode(151 /* ForInStatement */, pos); + if (parseOptional(80 /* InKeyword */)) { + var forInStatement = createNode(156 /* ForInStatement */, pos); if (declarations) { if (declarations.length > 1) { error(ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); @@ -4171,24 +4425,24 @@ var ts; forInStatement.variable = varOrInit; } forInStatement.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); forOrForInStatement = forInStatement; } else { - var forStatement = createNode(150 /* ForStatement */, pos); + var forStatement = createNode(155 /* ForStatement */, pos); if (declarations) forStatement.declarations = declarations; if (varOrInit) forStatement.initializer = varOrInit; - parseExpected(13 /* SemicolonToken */); - if (token !== 13 /* SemicolonToken */ && token !== 8 /* CloseParenToken */) { + parseExpected(17 /* SemicolonToken */); + if (token !== 17 /* SemicolonToken */ && token !== 12 /* CloseParenToken */) { forStatement.condition = parseExpression(); } - parseExpected(13 /* SemicolonToken */); - if (token !== 8 /* CloseParenToken */) { + parseExpected(17 /* SemicolonToken */); + if (token !== 12 /* CloseParenToken */) { forStatement.iterator = parseExpression(); } - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); forOrForInStatement = forStatement; } var saveInIterationStatement = inIterationStatement; @@ -4200,7 +4454,7 @@ var ts; function parseBreakOrContinueStatement(kind) { var node = createNode(kind); var errorCountBeforeStatement = file.syntacticErrors.length; - parseExpected(kind === 153 /* BreakStatement */ ? 56 /* BreakKeyword */ : 61 /* ContinueKeyword */); + parseExpected(kind === 158 /* BreakStatement */ ? 60 /* BreakKeyword */ : 65 /* ContinueKeyword */); if (!canParseSemicolon()) node.label = parseIdentifier(); parseSemicolon(); @@ -4216,7 +4470,7 @@ var ts; return node; } function checkBareBreakOrContinueStatement(node) { - if (node.kind === 153 /* BreakStatement */) { + if (node.kind === 158 /* BreakStatement */) { if (inIterationStatement === 1 /* Nested */ || inSwitchStatement === 1 /* Nested */) { return; } @@ -4225,7 +4479,7 @@ var ts; return; } } - else if (node.kind === 152 /* ContinueStatement */) { + else if (node.kind === 157 /* ContinueStatement */) { if (inIterationStatement === 1 /* Nested */) { return; } @@ -4241,7 +4495,7 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } function checkBreakOrContinueStatementWithLabel(node) { - var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 152 /* ContinueStatement */, false); + var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 157 /* ContinueStatement */, false); if (nodeIsNestedInLabel === 1 /* Nested */) { return; } @@ -4249,10 +4503,10 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); return; } - if (node.kind === 152 /* ContinueStatement */) { + if (node.kind === 157 /* ContinueStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } - else if (node.kind === 153 /* BreakStatement */) { + else if (node.kind === 158 /* BreakStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement); } else { @@ -4260,11 +4514,11 @@ var ts; } } function parseReturnStatement() { - var node = createNode(154 /* ReturnStatement */); + var node = createNode(159 /* ReturnStatement */); var errorCountBeforeReturnStatement = file.syntacticErrors.length; var returnTokenStart = scanner.getTokenPos(); var returnTokenLength = scanner.getTextPos() - returnTokenStart; - parseExpected(80 /* ReturnKeyword */); + parseExpected(84 /* ReturnKeyword */); if (!canParseSemicolon()) node.expression = parseExpression(); parseSemicolon(); @@ -4274,13 +4528,13 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(155 /* WithStatement */); + var node = createNode(160 /* WithStatement */); var startPos = scanner.getTokenPos(); - parseExpected(91 /* WithKeyword */); + parseExpected(95 /* WithKeyword */); var endPos = scanner.getStartPos(); - parseExpected(7 /* OpenParenToken */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); node.statement = parseStatement(); node = finishNode(node); if (isInStrictMode) { @@ -4289,36 +4543,36 @@ var ts; return node; } function parseCaseClause() { - var node = createNode(157 /* CaseClause */); - parseExpected(57 /* CaseKeyword */); + var node = createNode(162 /* CaseClause */); + parseExpected(61 /* CaseKeyword */); node.expression = parseExpression(); - parseExpected(42 /* ColonToken */); + parseExpected(46 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(158 /* DefaultClause */); - parseExpected(63 /* DefaultKeyword */); - parseExpected(42 /* ColonToken */); + var node = createNode(163 /* DefaultClause */); + parseExpected(67 /* DefaultKeyword */); + parseExpected(46 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 57 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token === 61 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(156 /* SwitchStatement */); - parseExpected(82 /* SwitchKeyword */); - parseExpected(7 /* OpenParenToken */); + var node = createNode(161 /* SwitchStatement */); + parseExpected(86 /* SwitchKeyword */); + parseExpected(11 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(8 /* CloseParenToken */); - parseExpected(5 /* OpenBraceToken */); + parseExpected(12 /* CloseParenToken */); + parseExpected(9 /* OpenBraceToken */); var saveInSwitchStatement = inSwitchStatement; inSwitchStatement = 1 /* Nested */; node.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); inSwitchStatement = saveInSwitchStatement; - parseExpected(6 /* CloseBraceToken */); - var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 158 /* DefaultClause */; }); + parseExpected(10 /* CloseBraceToken */); + var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 163 /* DefaultClause */; }); for (var i = 1, n = defaultClauses.length; i < n; i++) { var clause = defaultClauses[i]; var start = ts.skipTrivia(file.text, clause.pos); @@ -4328,8 +4582,8 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(160 /* ThrowStatement */); - parseExpected(84 /* ThrowKeyword */); + var node = createNode(165 /* ThrowStatement */); + parseExpected(88 /* ThrowKeyword */); if (scanner.hasPrecedingLineBreak()) { error(ts.Diagnostics.Line_break_not_permitted_here); } @@ -4338,13 +4592,13 @@ var ts; return finishNode(node); } function parseTryStatement() { - var node = createNode(161 /* TryStatement */); - node.tryBlock = parseTokenAndBlock(86 /* TryKeyword */, 162 /* TryBlock */); - if (token === 58 /* CatchKeyword */) { + var node = createNode(166 /* TryStatement */); + node.tryBlock = parseTokenAndBlock(90 /* TryKeyword */, 167 /* TryBlock */); + if (token === 62 /* CatchKeyword */) { node.catchBlock = parseCatchBlock(); } - if (token === 71 /* FinallyKeyword */) { - node.finallyBlock = parseTokenAndBlock(71 /* FinallyKeyword */, 164 /* FinallyBlock */); + if (token === 75 /* FinallyKeyword */) { + node.finallyBlock = parseTokenAndBlock(75 /* FinallyKeyword */, 169 /* FinallyBlock */); } if (!(node.catchBlock || node.finallyBlock)) { error(ts.Diagnostics.catch_or_finally_expected); @@ -4361,15 +4615,15 @@ var ts; } function parseCatchBlock() { var pos = getNodePos(); - parseExpected(58 /* CatchKeyword */); - parseExpected(7 /* OpenParenToken */); + parseExpected(62 /* CatchKeyword */); + parseExpected(11 /* OpenParenToken */); var variable = parseIdentifier(); var typeAnnotationColonStart = scanner.getTokenPos(); var typeAnnotationColonLength = scanner.getTextPos() - typeAnnotationColonStart; var typeAnnotation = parseTypeAnnotation(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); var result = parseBlock(false, false); - result.kind = 163 /* CatchBlock */; + result.kind = 168 /* CatchBlock */; result.pos = pos; result.variable = variable; if (typeAnnotation) { @@ -4381,13 +4635,13 @@ var ts; return result; } function parseDebuggerStatement() { - var node = createNode(165 /* DebuggerStatement */); - parseExpected(62 /* DebuggerKeyword */); + var node = createNode(170 /* DebuggerStatement */); + parseExpected(66 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); } function isIterationStatementStart() { - return token === 90 /* WhileKeyword */ || token === 65 /* DoKeyword */ || token === 72 /* ForKeyword */; + return token === 94 /* WhileKeyword */ || token === 69 /* DoKeyword */ || token === 76 /* ForKeyword */; } function parseStatementWithLabelSet() { labelledStatementInfo.pushCurrentLabelSet(isIterationStatementStart()); @@ -4396,12 +4650,12 @@ var ts; return statement; } function isLabel() { - return isIdentifier() && lookAhead(function () { return nextToken() === 42 /* ColonToken */; }); + return isIdentifier() && lookAhead(function () { return nextToken() === 46 /* ColonToken */; }); } function parseLabelledStatement() { - var node = createNode(159 /* LabelledStatement */); + var node = createNode(164 /* LabeledStatement */); node.label = parseIdentifier(); - parseExpected(42 /* ColonToken */); + parseExpected(46 /* ColonToken */); if (labelledStatementInfo.nodeIsNestedInLabel(node.label, false, true)) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, getSourceTextOfNodeFromSourceText(sourceText, node.label)); } @@ -4410,44 +4664,45 @@ var ts; return finishNode(node); } function parseExpressionStatement() { - var node = createNode(146 /* ExpressionStatement */); + var node = createNode(151 /* ExpressionStatement */); node.expression = parseExpression(); parseSemicolon(); return finishNode(node); } function isStatement(inErrorRecovery) { switch (token) { - case 13 /* SemicolonToken */: + case 17 /* SemicolonToken */: return !inErrorRecovery; - case 5 /* OpenBraceToken */: - case 88 /* VarKeyword */: - case 73 /* FunctionKeyword */: - case 74 /* IfKeyword */: - case 65 /* DoKeyword */: - case 90 /* WhileKeyword */: - case 72 /* ForKeyword */: - case 61 /* ContinueKeyword */: - case 56 /* BreakKeyword */: - case 80 /* ReturnKeyword */: - case 91 /* WithKeyword */: - case 82 /* SwitchKeyword */: - case 84 /* ThrowKeyword */: - case 86 /* TryKeyword */: - case 62 /* DebuggerKeyword */: - case 58 /* CatchKeyword */: - case 71 /* FinallyKeyword */: + case 9 /* OpenBraceToken */: + case 92 /* VarKeyword */: + case 77 /* FunctionKeyword */: + case 78 /* IfKeyword */: + case 69 /* DoKeyword */: + case 94 /* WhileKeyword */: + case 76 /* ForKeyword */: + case 65 /* ContinueKeyword */: + case 60 /* BreakKeyword */: + case 84 /* ReturnKeyword */: + case 95 /* WithKeyword */: + case 86 /* SwitchKeyword */: + case 88 /* ThrowKeyword */: + case 90 /* TryKeyword */: + case 66 /* DebuggerKeyword */: + case 62 /* CatchKeyword */: + case 75 /* FinallyKeyword */: return true; - case 93 /* InterfaceKeyword */: - case 59 /* ClassKeyword */: - case 106 /* ModuleKeyword */: - case 67 /* EnumKeyword */: + case 97 /* InterfaceKeyword */: + case 63 /* ClassKeyword */: + case 110 /* ModuleKeyword */: + case 71 /* EnumKeyword */: if (isDeclaration()) { return false; } - case 98 /* PublicKeyword */: - case 96 /* PrivateKeyword */: - case 99 /* StaticKeyword */: - if (lookAhead(function () { return nextToken() >= 55 /* Identifier */; })) { + case 102 /* PublicKeyword */: + case 100 /* PrivateKeyword */: + case 101 /* ProtectedKeyword */: + case 103 /* StaticKeyword */: + if (lookAhead(function () { return nextToken() >= 59 /* Identifier */; })) { return false; } default: @@ -4456,39 +4711,39 @@ var ts; } function parseStatement() { switch (token) { - case 5 /* OpenBraceToken */: + case 9 /* OpenBraceToken */: return parseBlock(false, false); - case 88 /* VarKeyword */: + case 92 /* VarKeyword */: return parseVariableStatement(); - case 73 /* FunctionKeyword */: + case 77 /* FunctionKeyword */: return parseFunctionDeclaration(); - case 13 /* SemicolonToken */: + case 17 /* SemicolonToken */: return parseEmptyStatement(); - case 74 /* IfKeyword */: + case 78 /* IfKeyword */: return parseIfStatement(); - case 65 /* DoKeyword */: + case 69 /* DoKeyword */: return parseDoStatement(); - case 90 /* WhileKeyword */: + case 94 /* WhileKeyword */: return parseWhileStatement(); - case 72 /* ForKeyword */: + case 76 /* ForKeyword */: return parseForOrForInStatement(); - case 61 /* ContinueKeyword */: - return parseBreakOrContinueStatement(152 /* ContinueStatement */); - case 56 /* BreakKeyword */: - return parseBreakOrContinueStatement(153 /* BreakStatement */); - case 80 /* ReturnKeyword */: + case 65 /* ContinueKeyword */: + return parseBreakOrContinueStatement(157 /* ContinueStatement */); + case 60 /* BreakKeyword */: + return parseBreakOrContinueStatement(158 /* BreakStatement */); + case 84 /* ReturnKeyword */: return parseReturnStatement(); - case 91 /* WithKeyword */: + case 95 /* WithKeyword */: return parseWithStatement(); - case 82 /* SwitchKeyword */: + case 86 /* SwitchKeyword */: return parseSwitchStatement(); - case 84 /* ThrowKeyword */: + case 88 /* ThrowKeyword */: return parseThrowStatement(); - case 86 /* TryKeyword */: - case 58 /* CatchKeyword */: - case 71 /* FinallyKeyword */: + case 90 /* TryKeyword */: + case 62 /* CatchKeyword */: + case 75 /* FinallyKeyword */: return parseTryStatement(); - case 62 /* DebuggerKeyword */: + case 66 /* DebuggerKeyword */: return parseDebuggerStatement(); default: if (isLabel()) { @@ -4498,12 +4753,12 @@ var ts; } } function parseStatementOrFunction() { - return token === 73 /* FunctionKeyword */ ? parseFunctionDeclaration() : parseStatement(); + return token === 77 /* FunctionKeyword */ ? parseFunctionDeclaration() : parseStatement(); } function parseAndCheckFunctionBody(isConstructor) { var initialPosition = scanner.getTokenPos(); var errorCountBeforeBody = file.syntacticErrors.length; - if (token === 5 /* OpenBraceToken */) { + if (token === 9 /* OpenBraceToken */) { var body = parseBody(false); if (body && inAmbientContext && file.syntacticErrors.length === errorCountBeforeBody) { var diagnostic = isConstructor ? ts.Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context : ts.Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context; @@ -4518,7 +4773,7 @@ var ts; error(ts.Diagnostics.Block_or_expected); } function parseVariableDeclaration(flags, noIn) { - var node = createNode(166 /* VariableDeclaration */); + var node = createNode(171 /* VariableDeclaration */); node.flags = flags; var errorCountBeforeVariableDeclaration = file.syntacticErrors.length; node.name = parseIdentifier(); @@ -4538,11 +4793,11 @@ var ts; return parseDelimitedList(9 /* VariableDeclarations */, function () { return parseVariableDeclaration(flags, noIn); }, 0 /* Disallow */); } function parseVariableStatement(pos, flags) { - var node = createNode(144 /* VariableStatement */, pos); + var node = createNode(149 /* VariableStatement */, pos); if (flags) node.flags = flags; var errorCountBeforeVarStatement = file.syntacticErrors.length; - parseExpected(88 /* VarKeyword */); + parseExpected(92 /* VarKeyword */); node.declarations = parseVariableDeclarationList(flags, false); parseSemicolon(); finishNode(node); @@ -4552,12 +4807,12 @@ var ts; return node; } function parseFunctionDeclaration(pos, flags) { - var node = createNode(167 /* FunctionDeclaration */, pos); + var node = createNode(172 /* FunctionDeclaration */, pos); if (flags) node.flags = flags; - parseExpected(73 /* FunctionKeyword */); + parseExpected(77 /* FunctionKeyword */); node.name = parseIdentifier(); - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -4568,10 +4823,10 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, flags) { - var node = createNode(117 /* Constructor */, pos); + var node = createNode(121 /* Constructor */, pos); node.flags = flags; - parseExpected(103 /* ConstructorKeyword */); - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + parseExpected(107 /* ConstructorKeyword */); + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -4588,14 +4843,14 @@ var ts; var errorCountBeforePropertyDeclaration = file.syntacticErrors.length; var name = parsePropertyName(); var questionStart = scanner.getTokenPos(); - if (parseOptional(41 /* QuestionToken */)) { + if (parseOptional(45 /* QuestionToken */)) { errorAtPos(questionStart, scanner.getStartPos() - questionStart, ts.Diagnostics.A_class_member_cannot_be_declared_optional); } - if (token === 7 /* OpenParenToken */ || token === 15 /* LessThanToken */) { - var method = createNode(116 /* Method */, pos); + if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { + var method = createNode(120 /* Method */, pos); method.flags = flags; method.name = name; - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); method.typeParameters = sig.typeParameters; method.parameters = sig.parameters; method.type = sig.type; @@ -4603,7 +4858,7 @@ var ts; return finishNode(method); } else { - var property = createNode(115 /* Property */, pos); + var property = createNode(119 /* Property */, pos); property.flags = flags; property.name = name; property.type = parseTypeAnnotation(); @@ -4630,10 +4885,10 @@ var ts; else if (accessor.typeParameters) { grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 118 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 122 /* GetAccessor */ && accessor.parameters.length) { grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 119 /* SetAccessor */) { + else if (kind === 123 /* SetAccessor */) { if (accessor.type) { grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -4663,7 +4918,7 @@ var ts; var node = createNode(kind, pos); node.flags = flags; node.name = parsePropertyName(); - var sig = parseSignature(120 /* CallSignature */, 42 /* ColonToken */); + var sig = parseSignature(124 /* CallSignature */, 46 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -4686,19 +4941,19 @@ var ts; idToken = token; nextToken(); } - if (token === 9 /* OpenBracketToken */) { + if (token === 13 /* OpenBracketToken */) { return true; } if (idToken !== undefined) { - if (!isKeyword(idToken) || idToken === 109 /* SetKeyword */ || idToken === 105 /* GetKeyword */) { + if (!isKeyword(idToken) || idToken === 113 /* SetKeyword */ || idToken === 109 /* GetKeyword */) { return true; } switch (token) { - case 7 /* OpenParenToken */: - case 15 /* LessThanToken */: - case 42 /* ColonToken */: - case 43 /* EqualsToken */: - case 41 /* QuestionToken */: + case 11 /* OpenParenToken */: + case 19 /* LessThanToken */: + case 46 /* ColonToken */: + case 47 /* EqualsToken */: + case 45 /* QuestionToken */: return true; default: return canParseSemicolon(); @@ -4714,6 +4969,8 @@ var ts; var lastDeclareModifierLength; var lastPrivateModifierStart; var lastPrivateModifierLength; + var lastProtectedModifierStart; + var lastProtectedModifierLength; while (true) { var modifierStart = scanner.getTokenPos(); var modifierToken = token; @@ -4721,11 +4978,11 @@ var ts; break; var modifierLength = scanner.getStartPos() - modifierStart; switch (modifierToken) { - case 98 /* PublicKeyword */: - if (flags & 32 /* Private */ || flags & 16 /* Public */) { + case 102 /* PublicKeyword */: + if (flags & ts.NodeFlags.AccessibilityModifier) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 64 /* Static */) { + else if (flags & 128 /* Static */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_must_precede_1_modifier, "public", "static"); } else if (context === 1 /* ModuleElements */ || context === 0 /* SourceElements */) { @@ -4733,11 +4990,11 @@ var ts; } flags |= 16 /* Public */; break; - case 96 /* PrivateKeyword */: - if (flags & 32 /* Private */ || flags & 16 /* Public */) { + case 100 /* PrivateKeyword */: + if (flags & ts.NodeFlags.AccessibilityModifier) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 64 /* Static */) { + else if (flags & 128 /* Static */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_must_precede_1_modifier, "private", "static"); } else if (context === 1 /* ModuleElements */ || context === 0 /* SourceElements */) { @@ -4747,8 +5004,22 @@ var ts; lastPrivateModifierLength = modifierLength; flags |= 32 /* Private */; break; - case 99 /* StaticKeyword */: - if (flags & 64 /* Static */) { + case 101 /* ProtectedKeyword */: + if (flags & 16 /* Public */ || flags & 32 /* Private */ || flags & 64 /* Protected */) { + grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); + } + else if (flags & 128 /* Static */) { + grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_must_precede_1_modifier, "protected", "static"); + } + else if (context === 1 /* ModuleElements */ || context === 0 /* SourceElements */) { + grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "protected"); + } + lastProtectedModifierStart = modifierStart; + lastProtectedModifierLength = modifierLength; + flags |= 64 /* Protected */; + break; + case 103 /* StaticKeyword */: + if (flags & 128 /* Static */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (context === 1 /* ModuleElements */ || context === 0 /* SourceElements */) { @@ -4759,9 +5030,9 @@ var ts; } lastStaticModifierStart = modifierStart; lastStaticModifierLength = modifierLength; - flags |= 64 /* Static */; + flags |= 128 /* Static */; break; - case 68 /* ExportKeyword */: + case 72 /* ExportKeyword */: if (flags & 1 /* Export */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -4776,7 +5047,7 @@ var ts; } flags |= 1 /* Export */; break; - case 104 /* DeclareKeyword */: + case 108 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "declare"); } @@ -4795,23 +5066,26 @@ var ts; break; } } - if (token === 103 /* ConstructorKeyword */ && flags & 64 /* Static */) { + if (token === 107 /* ConstructorKeyword */ && flags & 128 /* Static */) { grammarErrorAtPos(lastStaticModifierStart, lastStaticModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } - else if (token === 103 /* ConstructorKeyword */ && flags & 32 /* Private */) { + else if (token === 107 /* ConstructorKeyword */ && flags & 32 /* Private */) { grammarErrorAtPos(lastPrivateModifierStart, lastPrivateModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } - else if (token === 75 /* ImportKeyword */) { + else if (token === 107 /* ConstructorKeyword */ && flags & 64 /* Protected */) { + grammarErrorAtPos(lastProtectedModifierStart, lastProtectedModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); + } + else if (token === 79 /* ImportKeyword */) { if (flags & 2 /* Ambient */) { grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } } - else if (token === 93 /* InterfaceKeyword */) { + else if (token === 97 /* InterfaceKeyword */) { if (flags & 2 /* Ambient */) { grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } } - else if (token !== 68 /* ExportKeyword */ && !(flags & 2 /* Ambient */) && inAmbientContext && context === 0 /* SourceElements */) { + else if (token !== 72 /* ExportKeyword */ && !(flags & 2 /* Ambient */) && inAmbientContext && context === 0 /* SourceElements */) { var declarationStart = scanner.getTokenPos(); var declarationFirstTokenLength = scanner.getTextPos() - declarationStart; grammarErrorAtPos(declarationStart, declarationFirstTokenLength, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -4821,19 +5095,19 @@ var ts; function parseClassMemberDeclaration() { var pos = getNodePos(); var flags = parseAndCheckModifiers(2 /* ClassMembers */); - if (parseContextualModifier(105 /* GetKeyword */)) { - return parseAndCheckMemberAccessorDeclaration(118 /* GetAccessor */, pos, flags); + if (parseContextualModifier(109 /* GetKeyword */)) { + return parseAndCheckMemberAccessorDeclaration(122 /* GetAccessor */, pos, flags); } - if (parseContextualModifier(109 /* SetKeyword */)) { - return parseAndCheckMemberAccessorDeclaration(119 /* SetAccessor */, pos, flags); + if (parseContextualModifier(113 /* SetKeyword */)) { + return parseAndCheckMemberAccessorDeclaration(123 /* SetAccessor */, pos, flags); } - if (token === 103 /* ConstructorKeyword */) { + if (token === 107 /* ConstructorKeyword */) { return parseConstructorDeclaration(pos, flags); } - if (token >= 55 /* Identifier */ || token === 3 /* StringLiteral */ || token === 2 /* NumericLiteral */) { + if (token >= 59 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { return parsePropertyMemberDeclaration(pos, flags); } - if (token === 9 /* OpenBracketToken */) { + if (token === 13 /* OpenBracketToken */) { if (flags) { var start = getTokenPos(pos); var length = getNodePos() - start; @@ -4844,23 +5118,23 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassDeclaration(pos, flags) { - var node = createNode(169 /* ClassDeclaration */, pos); + var node = createNode(174 /* ClassDeclaration */, pos); node.flags = flags; var errorCountBeforeClassDeclaration = file.syntacticErrors.length; - parseExpected(59 /* ClassKeyword */); + parseExpected(63 /* ClassKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - node.baseType = parseOptional(69 /* ExtendsKeyword */) ? parseTypeReference() : undefined; + node.baseType = parseOptional(73 /* ExtendsKeyword */) ? parseTypeReference() : undefined; var implementsKeywordStart = scanner.getTokenPos(); var implementsKeywordLength; - if (parseOptional(92 /* ImplementsKeyword */)) { + if (parseOptional(96 /* ImplementsKeyword */)) { implementsKeywordLength = scanner.getStartPos() - implementsKeywordStart; node.implementedTypes = parseDelimitedList(8 /* BaseTypeReferences */, parseTypeReference, 0 /* Disallow */); } var errorCountBeforeClassBody = file.syntacticErrors.length; - if (parseExpected(5 /* OpenBraceToken */)) { + if (parseExpected(9 /* OpenBraceToken */)) { node.members = parseList(6 /* ClassMembers */, false, parseClassMemberDeclaration); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -4871,15 +5145,15 @@ var ts; return finishNode(node); } function parseInterfaceDeclaration(pos, flags) { - var node = createNode(170 /* InterfaceDeclaration */, pos); + var node = createNode(175 /* InterfaceDeclaration */, pos); node.flags = flags; var errorCountBeforeInterfaceDeclaration = file.syntacticErrors.length; - parseExpected(93 /* InterfaceKeyword */); + parseExpected(97 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); var extendsKeywordStart = scanner.getTokenPos(); var extendsKeywordLength; - if (parseOptional(69 /* ExtendsKeyword */)) { + if (parseOptional(73 /* ExtendsKeyword */)) { extendsKeywordLength = scanner.getStartPos() - extendsKeywordStart; node.baseTypes = parseDelimitedList(8 /* BaseTypeReferences */, parseTypeReference, 0 /* Disallow */); } @@ -4895,20 +5169,20 @@ var ts; function isInteger(literalExpression) { return /^[0-9]+([eE]\+?[0-9]+)?$/.test(literalExpression.text); } - if (expression.kind === 138 /* PrefixOperator */) { + if (expression.kind === 143 /* PrefixOperator */) { var unaryExpression = expression; - if (unaryExpression.operator === 24 /* PlusToken */ || unaryExpression.operator === 25 /* MinusToken */) { + if (unaryExpression.operator === 28 /* PlusToken */ || unaryExpression.operator === 29 /* MinusToken */) { expression = unaryExpression.operand; } } - if (expression.kind === 2 /* NumericLiteral */) { + if (expression.kind === 6 /* NumericLiteral */) { return isInteger(expression); } return false; } var inConstantEnumMemberSection = true; function parseAndCheckEnumMember() { - var node = createNode(176 /* EnumMember */); + var node = createNode(181 /* EnumMember */); var errorCountBeforeEnumMember = file.syntacticErrors.length; node.name = parsePropertyName(); node.initializer = parseInitializer(false); @@ -4925,13 +5199,13 @@ var ts; } return finishNode(node); } - var node = createNode(171 /* EnumDeclaration */, pos); + var node = createNode(176 /* EnumDeclaration */, pos); node.flags = flags; - parseExpected(67 /* EnumKeyword */); + parseExpected(71 /* EnumKeyword */); node.name = parseIdentifier(); - if (parseExpected(5 /* OpenBraceToken */)) { + if (parseExpected(9 /* OpenBraceToken */)) { node.members = parseDelimitedList(7 /* EnumMembers */, parseAndCheckEnumMember, 1 /* Allow */); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -4939,10 +5213,10 @@ var ts; return finishNode(node); } function parseModuleBody() { - var node = createNode(173 /* ModuleBlock */); - if (parseExpected(5 /* OpenBraceToken */)) { + var node = createNode(178 /* ModuleBlock */); + if (parseExpected(9 /* OpenBraceToken */)) { node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); - parseExpected(6 /* CloseBraceToken */); + parseExpected(10 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -4950,19 +5224,19 @@ var ts; return finishNode(node); } function parseInternalModuleTail(pos, flags) { - var node = createNode(172 /* ModuleDeclaration */, pos); + var node = createNode(177 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseIdentifier(); - if (parseOptional(11 /* DotToken */)) { + if (parseOptional(15 /* DotToken */)) { node.body = parseInternalModuleTail(getNodePos(), 1 /* Export */); } else { node.body = parseModuleBody(); ts.forEach(node.body.statements, function (s) { - if (s.kind === 175 /* ExportAssignment */) { + if (s.kind === 180 /* ExportAssignment */) { grammarErrorOnNode(s, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } - else if (s.kind === 174 /* ImportDeclaration */ && s.externalModuleName) { + else if (s.kind === 179 /* ImportDeclaration */ && s.externalModuleName) { grammarErrorOnNode(s, ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); } }); @@ -4970,7 +5244,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(pos, flags) { - var node = createNode(172 /* ModuleDeclaration */, pos); + var node = createNode(177 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseStringLiteral(); if (!inAmbientContext) { @@ -4986,19 +5260,19 @@ var ts; return finishNode(node); } function parseModuleDeclaration(pos, flags) { - parseExpected(106 /* ModuleKeyword */); - return token === 3 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(pos, flags) : parseInternalModuleTail(pos, flags); + parseExpected(110 /* ModuleKeyword */); + return token === 7 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(pos, flags) : parseInternalModuleTail(pos, flags); } function parseImportDeclaration(pos, flags) { - var node = createNode(174 /* ImportDeclaration */, pos); + var node = createNode(179 /* ImportDeclaration */, pos); node.flags = flags; - parseExpected(75 /* ImportKeyword */); + parseExpected(79 /* ImportKeyword */); node.name = parseIdentifier(); - parseExpected(43 /* EqualsToken */); + parseExpected(47 /* EqualsToken */); var entityName = parseEntityName(false); - if (entityName.kind === 55 /* Identifier */ && entityName.text === "require" && parseOptional(7 /* OpenParenToken */)) { + if (entityName.kind === 59 /* Identifier */ && entityName.text === "require" && parseOptional(11 /* OpenParenToken */)) { node.externalModuleName = parseStringLiteral(); - parseExpected(8 /* CloseParenToken */); + parseExpected(12 /* CloseParenToken */); } else { node.entityName = entityName; @@ -5007,29 +5281,30 @@ var ts; return finishNode(node); } function parseExportAssignmentTail(pos) { - var node = createNode(175 /* ExportAssignment */, pos); + var node = createNode(180 /* ExportAssignment */, pos); node.exportName = parseIdentifier(); parseSemicolon(); return finishNode(node); } function isDeclaration() { switch (token) { - case 88 /* VarKeyword */: - case 73 /* FunctionKeyword */: + case 92 /* VarKeyword */: + case 77 /* FunctionKeyword */: return true; - case 59 /* ClassKeyword */: - case 93 /* InterfaceKeyword */: - case 67 /* EnumKeyword */: - case 75 /* ImportKeyword */: - return lookAhead(function () { return nextToken() >= 55 /* Identifier */; }); - case 106 /* ModuleKeyword */: - return lookAhead(function () { return nextToken() >= 55 /* Identifier */ || token === 3 /* StringLiteral */; }); - case 68 /* ExportKeyword */: - return lookAhead(function () { return nextToken() === 43 /* EqualsToken */ || isDeclaration(); }); - case 104 /* DeclareKeyword */: - case 98 /* PublicKeyword */: - case 96 /* PrivateKeyword */: - case 99 /* StaticKeyword */: + case 63 /* ClassKeyword */: + case 97 /* InterfaceKeyword */: + case 71 /* EnumKeyword */: + case 79 /* ImportKeyword */: + return lookAhead(function () { return nextToken() >= 59 /* Identifier */; }); + case 110 /* ModuleKeyword */: + return lookAhead(function () { return nextToken() >= 59 /* Identifier */ || token === 7 /* StringLiteral */; }); + case 72 /* ExportKeyword */: + return lookAhead(function () { return nextToken() === 47 /* EqualsToken */ || isDeclaration(); }); + case 108 /* DeclareKeyword */: + case 102 /* PublicKeyword */: + case 100 /* PrivateKeyword */: + case 101 /* ProtectedKeyword */: + case 103 /* StaticKeyword */: return lookAhead(function () { nextToken(); return isDeclaration(); @@ -5040,10 +5315,10 @@ var ts; var pos = getNodePos(); var errorCountBeforeModifiers = file.syntacticErrors.length; var flags = parseAndCheckModifiers(modifierContext); - if (token === 68 /* ExportKeyword */) { + if (token === 72 /* ExportKeyword */) { var modifiersEnd = scanner.getStartPos(); nextToken(); - if (parseOptional(43 /* EqualsToken */)) { + if (parseOptional(47 /* EqualsToken */)) { var exportAssignmentTail = parseExportAssignmentTail(pos); if (flags !== 0 && errorCountBeforeModifiers === file.syntacticErrors.length) { var modifiersStart = ts.skipTrivia(sourceText, pos); @@ -5058,25 +5333,25 @@ var ts; } var result; switch (token) { - case 88 /* VarKeyword */: + case 92 /* VarKeyword */: result = parseVariableStatement(pos, flags); break; - case 73 /* FunctionKeyword */: + case 77 /* FunctionKeyword */: result = parseFunctionDeclaration(pos, flags); break; - case 59 /* ClassKeyword */: + case 63 /* ClassKeyword */: result = parseClassDeclaration(pos, flags); break; - case 93 /* InterfaceKeyword */: + case 97 /* InterfaceKeyword */: result = parseInterfaceDeclaration(pos, flags); break; - case 67 /* EnumKeyword */: + case 71 /* EnumKeyword */: result = parseAndCheckEnumDeclaration(pos, flags); break; - case 106 /* ModuleKeyword */: + case 110 /* ModuleKeyword */: result = parseModuleDeclaration(pos, flags); break; - case 75 /* ImportKeyword */: + case 79 /* ImportKeyword */: result = parseImportDeclaration(pos, flags); break; default: @@ -5152,15 +5427,15 @@ var ts; }; } function getExternalModuleIndicator() { - return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 174 /* ImportDeclaration */ && node.externalModuleName || node.kind === 175 /* ExportAssignment */ ? node : undefined; }); + return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 179 /* ImportDeclaration */ && node.externalModuleName || node.kind === 180 /* ExportAssignment */ ? node : undefined; }); } - scanner = ts.createScanner(languageVersion, sourceText, scanError, onComment); + scanner = ts.createScanner(languageVersion, true, sourceText, scanError, onComment); var rootNodeFlags = 0; if (ts.fileExtensionIs(filename, ".d.ts")) { - rootNodeFlags = 512 /* DeclarationFile */; + rootNodeFlags = 1024 /* DeclarationFile */; inAmbientContext = true; } - file = createRootNode(177 /* SourceFile */, 0, sourceText.length, rootNodeFlags); + file = createRootNode(182 /* SourceFile */, 0, sourceText.length, rootNodeFlags); file.filename = ts.normalizePath(filename); file.text = sourceText; file.getLineAndCharacterFromPosition = getLineAndCharacterlFromSourcePosition; @@ -5226,17 +5501,27 @@ var ts; var start = refPos; var length = refEnd - refPos; } + var diagnostic; if (hasExtension(filename)) { if (!ts.fileExtensionIs(filename, ".ts")) { - errors.push(ts.createFileDiagnostic(refFile, start, length, ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts, filename)); + diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; } else if (!findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { - errors.push(ts.createFileDiagnostic(refFile, start, length, ts.Diagnostics.File_0_not_found, filename)); + diagnostic = ts.Diagnostics.File_0_not_found; } } else { if (!(findSourceFile(filename + ".ts", isDefaultLib, refFile, refPos, refEnd) || findSourceFile(filename + ".d.ts", isDefaultLib, refFile, refPos, refEnd))) { - errors.push(ts.createFileDiagnostic(refFile, start, length, ts.Diagnostics.File_0_not_found, filename + ".ts")); + diagnostic = ts.Diagnostics.File_0_not_found; + filename += ".ts"; + } + } + if (diagnostic) { + if (refFile) { + errors.push(ts.createFileDiagnostic(refFile, start, length, diagnostic, filename)); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnostic, filename)); } } } @@ -5279,7 +5564,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 174 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 179 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -5297,9 +5582,9 @@ var ts; } } } - else if (node.kind === 172 /* ModuleDeclaration */ && node.name.kind === 3 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || file.flags & 512 /* DeclarationFile */)) { + else if (node.kind === 177 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || file.flags & 1024 /* DeclarationFile */)) { forEachChild(node.body, function (node) { - if (node.kind === 174 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 179 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -5337,12 +5622,12 @@ var ts; if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModule !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 512 /* DeclarationFile */) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { - var sourcePathCompoments = ts.getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory()); - sourcePathCompoments.pop(); + if (!(sourceFile.flags & 1024 /* DeclarationFile */) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory()); + sourcePathComponents.pop(); if (commonPathComponents) { - for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathCompoments.length); i++) { - if (commonPathComponents[i] !== sourcePathCompoments[i]) { + for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); return; @@ -5351,16 +5636,16 @@ var ts; break; } } - if (sourcePathCompoments.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathCompoments.length; + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; } } else { - commonPathComponents = sourcePathCompoments; + commonPathComponents = sourcePathComponents; } } }); - commonSourceDirectory = ts.getNormalizedPathFromPathCompoments(commonPathComponents); + commonSourceDirectory = ts.getNormalizedPathFromPathComponents(commonPathComponents); if (commonSourceDirectory) { commonSourceDirectory += ts.directorySeparator; } @@ -5372,16 +5657,16 @@ var ts; var ts; (function (ts) { function isInstantiated(node) { - if (node.kind === 170 /* InterfaceDeclaration */) { + if (node.kind === 175 /* InterfaceDeclaration */) { return false; } - else if (node.kind === 174 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { + else if (node.kind === 179 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { return false; } - else if (node.kind === 173 /* ModuleBlock */ && !ts.forEachChild(node, isInstantiated)) { + else if (node.kind === 178 /* ModuleBlock */ && !ts.forEachChild(node, isInstantiated)) { return false; } - else if (node.kind === 172 /* ModuleDeclaration */ && !isInstantiated(node.body)) { + else if (node.kind === 177 /* ModuleDeclaration */ && !isInstantiated(node.body)) { return false; } else { @@ -5420,19 +5705,19 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 172 /* ModuleDeclaration */ && node.name.kind === 3 /* StringLiteral */) { + if (node.kind === 177 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { return '"' + node.name.text + '"'; } return node.name.text; } switch (node.kind) { - case 117 /* Constructor */: + case 121 /* Constructor */: return "__constructor"; - case 120 /* CallSignature */: + case 124 /* CallSignature */: return "__call"; - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: return "__new"; - case 122 /* IndexSignature */: + case 126 /* IndexSignature */: return "__index"; } } @@ -5456,7 +5741,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 169 /* ClassDeclaration */ && symbol.exports) { + if (node.kind === 174 /* ClassDeclaration */ && symbol.exports) { var prototypeSymbol = createSymbol(2 /* Property */ | 67108864 /* Prototype */, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -5488,7 +5773,7 @@ var ts; if (symbolKind & ts.SymbolFlags.Namespace) { exportKind |= 2097152 /* ExportNamespace */; } - if (node.flags & 1 /* Export */ || (node.kind !== 174 /* ImportDeclaration */ && isAmbientContext(container))) { + if (node.flags & 1 /* Export */ || (node.kind !== 179 /* ImportDeclaration */ && isAmbientContext(container))) { if (exportKind) { var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -5524,37 +5809,37 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes) { switch (container.kind) { - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 177 /* SourceFile */: + case 182 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } - case 120 /* CallSignature */: - case 121 /* ConstructSignature */: - case 122 /* IndexSignature */: - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + case 126 /* IndexSignature */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 169 /* ClassDeclaration */: - if (node.flags & 64 /* Static */) { + case 174 /* ClassDeclaration */: + if (node.flags & 128 /* Static */) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 125 /* TypeLiteral */: - case 128 /* ObjectLiteral */: - case 170 /* InterfaceDeclaration */: + case 129 /* TypeLiteral */: + case 133 /* ObjectLiteral */: + case 175 /* InterfaceDeclaration */: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -5563,13 +5848,13 @@ var ts; function bindConstructorDeclaration(node) { bindDeclaration(node, 4096 /* Constructor */, 0); ts.forEach(node.parameters, function (p) { - if (p.flags & (16 /* Public */ | 32 /* Private */)) { + if (p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */)) { bindDeclaration(p, 2 /* Property */, ts.SymbolFlags.PropertyExcludes); } }); } function bindModuleDeclaration(node) { - if (node.name.kind === 3 /* StringLiteral */) { + if (node.name.kind === 7 /* StringLiteral */) { bindDeclaration(node, 128 /* ValueModule */, ts.SymbolFlags.ValueModuleExcludes); } else if (isInstantiated(node)) { @@ -5595,75 +5880,75 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 113 /* TypeParameter */: + case 117 /* TypeParameter */: bindDeclaration(node, 262144 /* TypeParameter */, ts.SymbolFlags.TypeParameterExcludes); break; - case 114 /* Parameter */: + case 118 /* Parameter */: bindDeclaration(node, 1 /* Variable */, ts.SymbolFlags.ParameterExcludes); break; - case 166 /* VariableDeclaration */: + case 171 /* VariableDeclaration */: bindDeclaration(node, 1 /* Variable */, ts.SymbolFlags.VariableExcludes); break; - case 115 /* Property */: - case 129 /* PropertyAssignment */: + case 119 /* Property */: + case 134 /* PropertyAssignment */: bindDeclaration(node, 2 /* Property */, ts.SymbolFlags.PropertyExcludes); break; - case 176 /* EnumMember */: + case 181 /* EnumMember */: bindDeclaration(node, 4 /* EnumMember */, ts.SymbolFlags.EnumMemberExcludes); break; - case 120 /* CallSignature */: + case 124 /* CallSignature */: bindDeclaration(node, 32768 /* CallSignature */, 0); break; - case 116 /* Method */: + case 120 /* Method */: bindDeclaration(node, 2048 /* Method */, ts.SymbolFlags.MethodExcludes); break; - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: bindDeclaration(node, 65536 /* ConstructSignature */, 0); break; - case 122 /* IndexSignature */: + case 126 /* IndexSignature */: bindDeclaration(node, 131072 /* IndexSignature */, 0); break; - case 167 /* FunctionDeclaration */: + case 172 /* FunctionDeclaration */: bindDeclaration(node, 8 /* Function */, ts.SymbolFlags.FunctionExcludes); break; - case 117 /* Constructor */: + case 121 /* Constructor */: bindConstructorDeclaration(node); break; - case 118 /* GetAccessor */: + case 122 /* GetAccessor */: bindDeclaration(node, 8192 /* GetAccessor */, ts.SymbolFlags.GetAccessorExcludes); break; - case 119 /* SetAccessor */: + case 123 /* SetAccessor */: bindDeclaration(node, 16384 /* SetAccessor */, ts.SymbolFlags.SetAccessorExcludes); break; - case 125 /* TypeLiteral */: + case 129 /* TypeLiteral */: bindAnonymousDeclaration(node, 512 /* TypeLiteral */, "__type"); break; - case 128 /* ObjectLiteral */: + case 133 /* ObjectLiteral */: bindAnonymousDeclaration(node, 1024 /* ObjectLiteral */, "__object"); break; - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: bindAnonymousDeclaration(node, 8 /* Function */, "__function"); break; - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: bindCatchVariableDeclaration(node); break; - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: bindDeclaration(node, 16 /* Class */, ts.SymbolFlags.ClassExcludes); break; - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: bindDeclaration(node, 32 /* Interface */, ts.SymbolFlags.InterfaceExcludes); break; - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: bindDeclaration(node, 64 /* Enum */, ts.SymbolFlags.EnumExcludes); break; - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: bindModuleDeclaration(node); break; - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: bindDeclaration(node, 4194304 /* Import */, ts.SymbolFlags.ImportExcludes); break; - case 177 /* SourceFile */: + case 182 /* SourceFile */: if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 128 /* ValueModule */, '"' + ts.getModuleNameFromFilename(node.filename) + '"'); break; @@ -5690,7 +5975,21 @@ var ts; function getIndentSize() { return indentStrings[1].length; } - function emitFiles(resolver) { + function shouldEmitToOwnFile(sourceFile, compilerOptions) { + if (!(sourceFile.flags & 1024 /* DeclarationFile */)) { + if ((ts.isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { + return true; + } + return false; + } + return false; + } + ts.shouldEmitToOwnFile = shouldEmitToOwnFile; + function isExternalModuleOrDeclarationFile(sourceFile) { + return ts.isExternalModule(sourceFile) || (sourceFile.flags & 1024 /* DeclarationFile */) !== 0; + } + ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + function emitFiles(resolver, targetSourceFile) { var program = resolver.getProgram(); var compilerHost = program.getCompilerHost(); var compilerOptions = program.getCompilerOptions(); @@ -5698,32 +5997,22 @@ var ts; var diagnostics = []; var newLine = program.getCompilerHost().getNewLine(); function getSourceFilePathInNewDir(newDirPath, sourceFile) { - var sourceFilePath = ts.getNormalizedPathFromPathCompoments(ts.getNormalizedPathComponents(sourceFile.filename, compilerHost.getCurrentDirectory())); + var sourceFilePath = ts.getNormalizedPathFromPathComponents(ts.getNormalizedPathComponents(sourceFile.filename, compilerHost.getCurrentDirectory())); sourceFilePath = sourceFilePath.replace(program.getCommonSourceDirectory(), ""); return ts.combinePaths(newDirPath, sourceFilePath); } - function shouldEmitToOwnFile(sourceFile) { - if (!(sourceFile.flags & 512 /* DeclarationFile */)) { - if ((ts.isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.filename, ".js")) { - return true; - } - } - } function getOwnEmitOutputFilePath(sourceFile, extension) { - if (program.getCompilerOptions().outDir) { - var emitOutputFilePathWithoutExtension = ts.getModuleNameFromFilename(getSourceFilePathInNewDir(program.getCompilerOptions().outDir, sourceFile)); + if (compilerOptions.outDir) { + var emitOutputFilePathWithoutExtension = ts.getModuleNameFromFilename(getSourceFilePathInNewDir(compilerOptions.outDir, sourceFile)); } else { var emitOutputFilePathWithoutExtension = ts.getModuleNameFromFilename(sourceFile.filename); } return emitOutputFilePathWithoutExtension + extension; } - function isExternalModuleOrDeclarationFile(sourceFile) { - return ts.isExternalModule(sourceFile) || (sourceFile.flags & 512 /* DeclarationFile */) !== 0; - } function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 117 /* Constructor */ && member.body) { + if (member.kind === 121 /* Constructor */ && member.body) { return member; } }); @@ -5733,14 +6022,14 @@ var ts; var getAccessor; var setAccessor; ts.forEach(node.members, function (member) { - if ((member.kind === 118 /* GetAccessor */ || member.kind === 119 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 64 /* Static */) === (accessor.flags & 64 /* Static */)) { + if ((member.kind === 122 /* GetAccessor */ || member.kind === 123 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { if (!firstAccessor) { firstAccessor = member; } - if (member.kind === 118 /* GetAccessor */ && !getAccessor) { + if (member.kind === 122 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 119 /* SetAccessor */ && !setAccessor) { + if (member.kind === 123 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6066,7 +6355,7 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 167 /* FunctionDeclaration */ || node.kind === 136 /* FunctionExpression */ || node.kind === 116 /* Method */ || node.kind === 118 /* GetAccessor */ || node.kind === 119 /* SetAccessor */ || node.kind === 172 /* ModuleDeclaration */ || node.kind === 169 /* ClassDeclaration */ || node.kind === 171 /* EnumDeclaration */) { + else if (node.kind === 172 /* FunctionDeclaration */ || node.kind === 141 /* FunctionExpression */ || node.kind === 120 /* Method */ || node.kind === 122 /* GetAccessor */ || node.kind === 123 /* SetAccessor */ || node.kind === 177 /* ModuleDeclaration */ || node.kind === 174 /* ClassDeclaration */ || node.kind === 176 /* EnumDeclaration */) { if (node.name) { scopeName = node.name.text; } @@ -6085,16 +6374,51 @@ var ts; writeCommentRange(comment, writer); recordSourceMapSpan(comment.end); } + var escapedCharsRegExp = /[\t\v\f\b\0\r\n\"\u2028\u2029\u0085]/g; + var escapedCharsMap = { + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\0": "\\0", + "\r": "\\r", + "\n": "\\n", + "\"": "\\\"", + "\u2028": "\\u2028", + "\u2029": "\\u2029", + "\u0085": "\\u0085" + }; + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings) { + if (typeof JSON !== "undefined") { + return JSON.stringify({ + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }); + } + return "{\"version\":" + version + ",\"file\":\"" + escapeString(file) + "\",\"sourceRoot\":\"" + escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + escapeString(mappings) + "\"}"; + function escapeString(s) { + return escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, function (c) { + return escapedCharsMap[c] || c; + }) : s; + } + function serializeStringArray(list) { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + escapeString(list[i]) + "\""; + } + return output; + } + } function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { encodeLastRecordedSourceMapSpan(); - writeFile(sourceMapData.sourceMapFilePath, JSON.stringify({ - version: 3, - file: sourceMapData.sourceMapFile, - sourceRoot: sourceMapData.sourceMapSourceRoot, - sources: sourceMapData.sourceMapSources, - names: sourceMapData.sourceMapNames, - mappings: sourceMapData.sourceMapMappings - }), false); + writeFile(sourceMapData.sourceMapFilePath, serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings), false); sourceMapDataList.push(sourceMapData); writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); } @@ -6132,7 +6456,7 @@ var ts; } function emitNodeWithMap(node) { if (node) { - if (node.kind != 177 /* SourceFile */) { + if (node.kind != 182 /* SourceFile */) { recordEmitNodeStartSpan(node); emitNode(node); recordEmitNodeEndSpan(node); @@ -6203,7 +6527,7 @@ var ts; } function emitLiteral(node) { var text = getSourceTextOfLocalNode(node); - if (node.kind === 3 /* StringLiteral */ && compilerOptions.sourceMap) { + if (node.kind === 7 /* StringLiteral */ && compilerOptions.sourceMap) { writer.writeLiteral(text); } else { @@ -6211,12 +6535,12 @@ var ts; } } function emitQuotedIdentifier(node) { - if (node.kind === 3 /* StringLiteral */) { + if (node.kind === 7 /* StringLiteral */) { emitLiteral(node); } else { write("\""); - if (node.kind === 2 /* NumericLiteral */) { + if (node.kind === 6 /* NumericLiteral */) { write(node.text); } else { @@ -6228,29 +6552,29 @@ var ts; function isNonExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 114 /* Parameter */: - case 166 /* VariableDeclaration */: - case 115 /* Property */: - case 129 /* PropertyAssignment */: - case 176 /* EnumMember */: - case 116 /* Method */: - case 167 /* FunctionDeclaration */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 136 /* FunctionExpression */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 171 /* EnumDeclaration */: - case 172 /* ModuleDeclaration */: - case 174 /* ImportDeclaration */: + case 118 /* Parameter */: + case 171 /* VariableDeclaration */: + case 119 /* Property */: + case 134 /* PropertyAssignment */: + case 181 /* EnumMember */: + case 120 /* Method */: + case 172 /* FunctionDeclaration */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 141 /* FunctionExpression */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: + case 177 /* ModuleDeclaration */: + case 179 /* ImportDeclaration */: return parent.name === node; - case 153 /* BreakStatement */: - case 152 /* ContinueStatement */: - case 175 /* ExportAssignment */: + case 158 /* BreakStatement */: + case 157 /* ContinueStatement */: + case 180 /* ExportAssignment */: return false; - case 159 /* LabelledStatement */: + case 164 /* LabeledStatement */: return node.parent.label === node; - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: return node.parent.variable === node; } } @@ -6285,7 +6609,7 @@ var ts; } } function emitArrayLiteral(node) { - if (node.flags & 128 /* MultiLine */) { + if (node.flags & 256 /* MultiLine */) { write("["); increaseIndent(); emitMultiLineList(node.elements); @@ -6303,7 +6627,7 @@ var ts; if (!node.properties.length) { write("{}"); } - else if (node.flags & 128 /* MultiLine */) { + else if (node.flags & 256 /* MultiLine */) { write("{"); increaseIndent(); emitMultiLineList(node.properties); @@ -6342,13 +6666,13 @@ var ts; } function emitCallExpression(node) { var superCall = false; - if (node.func.kind === 81 /* SuperKeyword */) { + if (node.func.kind === 85 /* SuperKeyword */) { write("_super"); superCall = true; } else { emit(node.func); - superCall = node.func.kind === 130 /* PropertyAccess */ && node.func.left.kind === 81 /* SuperKeyword */; + superCall = node.func.kind === 135 /* PropertyAccess */ && node.func.left.kind === 85 /* SuperKeyword */; } if (superCall) { write(".call("); @@ -6375,12 +6699,12 @@ var ts; } } function emitParenExpression(node) { - if (node.expression.kind === 134 /* TypeAssertion */) { + if (node.expression.kind === 139 /* TypeAssertion */) { var operand = node.expression.operand; - while (operand.kind == 134 /* TypeAssertion */) { + while (operand.kind == 139 /* TypeAssertion */) { operand = operand.operand; } - if (operand.kind !== 138 /* PrefixOperator */ && operand.kind !== 139 /* PostfixOperator */ && operand.kind !== 133 /* NewExpression */ && !(operand.kind === 132 /* CallExpression */ && node.parent.kind === 133 /* NewExpression */) && !(operand.kind === 136 /* FunctionExpression */ && node.parent.kind === 132 /* CallExpression */)) { + if (operand.kind !== 143 /* PrefixOperator */ && operand.kind !== 144 /* PostfixOperator */ && operand.kind !== 138 /* NewExpression */ && !(operand.kind === 137 /* CallExpression */ && node.parent.kind === 138 /* NewExpression */) && !(operand.kind === 141 /* FunctionExpression */ && node.parent.kind === 137 /* CallExpression */)) { emit(operand); return; } @@ -6390,29 +6714,29 @@ var ts; write(")"); } function emitUnaryExpression(node) { - if (node.kind === 138 /* PrefixOperator */) { + if (node.kind === 143 /* PrefixOperator */) { write(ts.tokenToString(node.operator)); } - if (node.operator >= 55 /* Identifier */) { + if (node.operator >= 59 /* Identifier */) { write(" "); } - else if (node.kind === 138 /* PrefixOperator */ && node.operand.kind === 138 /* PrefixOperator */) { + else if (node.kind === 143 /* PrefixOperator */ && node.operand.kind === 143 /* PrefixOperator */) { var operand = node.operand; - if (node.operator === 24 /* PlusToken */ && (operand.operator === 24 /* PlusToken */ || operand.operator === 29 /* PlusPlusToken */)) { + if (node.operator === 28 /* PlusToken */ && (operand.operator === 28 /* PlusToken */ || operand.operator === 33 /* PlusPlusToken */)) { write(" "); } - else if (node.operator === 25 /* MinusToken */ && (operand.operator === 25 /* MinusToken */ || operand.operator === 30 /* MinusMinusToken */)) { + else if (node.operator === 29 /* MinusToken */ && (operand.operator === 29 /* MinusToken */ || operand.operator === 34 /* MinusMinusToken */)) { write(" "); } } emit(node.operand); - if (node.kind === 139 /* PostfixOperator */) { + if (node.kind === 144 /* PostfixOperator */) { write(ts.tokenToString(node.operator)); } } function emitBinaryExpression(node) { emit(node.left); - if (node.operator !== 14 /* CommaToken */) + if (node.operator !== 18 /* CommaToken */) write(" "); write(ts.tokenToString(node.operator)); write(" "); @@ -6426,21 +6750,21 @@ var ts; emit(node.whenFalse); } function emitBlock(node) { - emitToken(5 /* OpenBraceToken */, node.pos); + emitToken(9 /* OpenBraceToken */, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 173 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 172 /* ModuleDeclaration */); + if (node.kind === 178 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 177 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); decreaseIndent(); writeLine(); - emitToken(6 /* CloseBraceToken */, node.statements.end); + emitToken(10 /* CloseBraceToken */, node.statements.end); scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 143 /* Block */) { + if (node.kind === 148 /* Block */) { write(" "); emit(node); } @@ -6452,7 +6776,7 @@ var ts; } } function emitExpressionStatement(node) { - var isArrowExpression = node.expression.kind === 137 /* ArrowFunction */; + var isArrowExpression = node.expression.kind === 142 /* ArrowFunction */; emitLeadingComments(node); if (isArrowExpression) write("("); @@ -6464,16 +6788,16 @@ var ts; } function emitIfStatement(node) { emitLeadingComments(node); - var endPos = emitToken(74 /* IfKeyword */, node.pos); + var endPos = emitToken(78 /* IfKeyword */, node.pos); write(" "); - endPos = emitToken(7 /* OpenParenToken */, endPos); + endPos = emitToken(11 /* OpenParenToken */, endPos); emit(node.expression); - emitToken(8 /* CloseParenToken */, node.expression.end); + emitToken(12 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { writeLine(); - emitToken(66 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 147 /* IfStatement */) { + emitToken(70 /* ElseKeyword */, node.thenStatement.end); + if (node.elseStatement.kind === 152 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -6486,7 +6810,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 143 /* Block */) { + if (node.statement.kind === 148 /* Block */) { write(" "); } else { @@ -6503,11 +6827,11 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForStatement(node) { - var endPos = emitToken(72 /* ForKeyword */, node.pos); + var endPos = emitToken(76 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(7 /* OpenParenToken */, endPos); + endPos = emitToken(11 /* OpenParenToken */, endPos); if (node.declarations) { - emitToken(88 /* VarKeyword */, endPos); + emitToken(92 /* VarKeyword */, endPos); write(" "); emitCommaList(node.declarations); } @@ -6522,11 +6846,11 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInStatement(node) { - var endPos = emitToken(72 /* ForKeyword */, node.pos); + var endPos = emitToken(76 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(7 /* OpenParenToken */, endPos); + endPos = emitToken(11 /* OpenParenToken */, endPos); if (node.declaration) { - emitToken(88 /* VarKeyword */, endPos); + emitToken(92 /* VarKeyword */, endPos); write(" "); emit(node.declaration); } @@ -6535,17 +6859,17 @@ var ts; } write(" in "); emit(node.expression); - emitToken(8 /* CloseParenToken */, node.expression.end); + emitToken(12 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.statement); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 153 /* BreakStatement */ ? 56 /* BreakKeyword */ : 61 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 158 /* BreakStatement */ ? 60 /* BreakKeyword */ : 65 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } function emitReturnStatement(node) { emitLeadingComments(node); - emitToken(80 /* ReturnKeyword */, node.pos); + emitToken(84 /* ReturnKeyword */, node.pos); emitOptional(" ", node.expression); write(";"); emitTrailingComments(node); @@ -6557,21 +6881,21 @@ var ts; emitEmbeddedStatement(node.statement); } function emitSwitchStatement(node) { - var endPos = emitToken(82 /* SwitchKeyword */, node.pos); + var endPos = emitToken(86 /* SwitchKeyword */, node.pos); write(" "); - emitToken(7 /* OpenParenToken */, endPos); + emitToken(11 /* OpenParenToken */, endPos); emit(node.expression); - endPos = emitToken(8 /* CloseParenToken */, node.expression.end); + endPos = emitToken(12 /* CloseParenToken */, node.expression.end); write(" "); - emitToken(5 /* OpenBraceToken */, endPos); + emitToken(9 /* OpenBraceToken */, endPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); writeLine(); - emitToken(6 /* CloseBraceToken */, node.clauses.end); + emitToken(10 /* CloseBraceToken */, node.clauses.end); } function emitCaseOrDefaultClause(node) { - if (node.kind === 157 /* CaseClause */) { + if (node.kind === 162 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -6600,16 +6924,16 @@ var ts; } function emitCatchBlock(node) { writeLine(); - var endPos = emitToken(58 /* CatchKeyword */, node.pos); + var endPos = emitToken(62 /* CatchKeyword */, node.pos); write(" "); - emitToken(7 /* OpenParenToken */, endPos); + emitToken(11 /* OpenParenToken */, endPos); emit(node.variable); - emitToken(8 /* CloseParenToken */, node.variable.end); + emitToken(12 /* CloseParenToken */, node.variable.end); write(" "); emitBlock(node); } function emitDebuggerStatement(node) { - emitToken(62 /* DebuggerKeyword */, node.pos); + emitToken(66 /* DebuggerKeyword */, node.pos); write(";"); } function emitLabelledStatement(node) { @@ -6620,7 +6944,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 172 /* ModuleDeclaration */); + } while (node && node.kind !== 177 /* ModuleDeclaration */); return node; } function emitModuleMemberName(node) { @@ -6710,7 +7034,7 @@ var ts; } function emitAccessor(node) { emitLeadingComments(node); - write(node.kind === 118 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 122 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); emitTrailingComments(node); @@ -6719,15 +7043,15 @@ var ts; if (!node.body) { return emitPinnedOrTripleSlashComments(node); } - if (node.kind !== 116 /* Method */) { + if (node.kind !== 120 /* Method */) { emitLeadingComments(node); } write("function "); - if (node.kind === 167 /* FunctionDeclaration */ || (node.kind === 136 /* FunctionExpression */ && node.name)) { + if (node.kind === 172 /* FunctionDeclaration */ || (node.kind === 141 /* FunctionExpression */ && node.name)) { emit(node.name); } emitSignatureAndBody(node); - if (node.kind !== 116 /* Method */) { + if (node.kind !== 120 /* Method */) { emitTrailingComments(node); } } @@ -6753,16 +7077,16 @@ var ts; write(" {"); scopeEmitStart(node); increaseIndent(); - emitDetachedComments(node.body.kind === 168 /* FunctionBlock */ ? node.body.statements : node.body); + emitDetachedComments(node.body.kind === 173 /* FunctionBlock */ ? node.body.statements : node.body); var startIndex = 0; - if (node.body.kind === 168 /* FunctionBlock */) { + if (node.body.kind === 173 /* FunctionBlock */) { startIndex = emitDirectivePrologues(node.body.statements, true); } var outPos = writer.getTextPos(); emitCaptureThisForNodeIfNecessary(node); emitDefaultValueAssignments(node); emitRestParameter(node); - if (node.body.kind !== 168 /* FunctionBlock */ && outPos === writer.getTextPos()) { + if (node.body.kind !== 173 /* FunctionBlock */ && outPos === writer.getTextPos()) { decreaseIndent(); write(" "); emitStart(node.body); @@ -6775,7 +7099,7 @@ var ts; emitEnd(node.body); } else { - if (node.body.kind === 168 /* FunctionBlock */) { + if (node.body.kind === 173 /* FunctionBlock */) { emitLinesStartingAt(node.body.statements, startIndex); } else { @@ -6787,10 +7111,10 @@ var ts; emitTrailingComments(node.body); } writeLine(); - if (node.body.kind === 168 /* FunctionBlock */) { + if (node.body.kind === 173 /* FunctionBlock */) { emitLeadingCommentsOfPosition(node.body.statements.end); decreaseIndent(); - emitToken(6 /* CloseBraceToken */, node.body.statements.end); + emitToken(10 /* CloseBraceToken */, node.body.statements.end); } else { decreaseIndent(); @@ -6813,11 +7137,11 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 146 /* ExpressionStatement */) { + if (statement && statement.kind === 151 /* ExpressionStatement */) { var expr = statement.expression; - if (expr && expr.kind === 132 /* CallExpression */) { + if (expr && expr.kind === 137 /* CallExpression */) { var func = expr.func; - if (func && func.kind === 81 /* SuperKeyword */) { + if (func && func.kind === 85 /* SuperKeyword */) { return statement; } } @@ -6826,7 +7150,7 @@ var ts; } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & (16 /* Public */ | 32 /* Private */)) { + if (param.flags & ts.NodeFlags.AccessibilityModifier) { writeLine(); emitStart(param); emitStart(param.name); @@ -6841,7 +7165,7 @@ var ts; }); } function emitMemberAccess(memberName) { - if (memberName.kind === 3 /* StringLiteral */ || memberName.kind === 2 /* NumericLiteral */) { + if (memberName.kind === 7 /* StringLiteral */ || memberName.kind === 6 /* NumericLiteral */) { write("["); emitNode(memberName); write("]"); @@ -6853,7 +7177,7 @@ var ts; } function emitMemberAssignments(node, staticFlag) { ts.forEach(node.members, function (member) { - if (member.kind === 115 /* Property */ && (member.flags & 64 /* Static */) === staticFlag && member.initializer) { + if (member.kind === 119 /* Property */ && (member.flags & 128 /* Static */) === staticFlag && member.initializer) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -6876,7 +7200,7 @@ var ts; } function emitMemberFunctions(node) { ts.forEach(node.members, function (member) { - if (member.kind === 116 /* Method */) { + if (member.kind === 120 /* Method */) { if (!member.body) { return emitPinnedOrTripleSlashComments(member); } @@ -6885,7 +7209,7 @@ var ts; emitStart(member); emitStart(member.name); emitNode(node.name); - if (!(member.flags & 64 /* Static */)) { + if (!(member.flags & 128 /* Static */)) { write(".prototype"); } emitMemberAccess(member.name); @@ -6898,7 +7222,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 118 /* GetAccessor */ || member.kind === 119 /* SetAccessor */) { + else if (member.kind === 122 /* GetAccessor */ || member.kind === 123 /* SetAccessor */) { var accessors = getAllAccessorDeclarations(node, member); if (member === accessors.firstAccessor) { writeLine(); @@ -6906,7 +7230,7 @@ var ts; write("Object.defineProperty("); emitStart(member.name); emitNode(node.name); - if (!(member.flags & 64 /* Static */)) { + if (!(member.flags & 128 /* Static */)) { write(".prototype"); } write(", "); @@ -6970,17 +7294,17 @@ var ts; writeLine(); emitConstructorOfClass(); emitMemberFunctions(node); - emitMemberAssignments(node, 64 /* Static */); + emitMemberAssignments(node, 128 /* Static */); writeLine(); function emitClassReturnStatement() { write("return "); emitNode(node.name); } - emitToken(6 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); + emitToken(10 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); write(";"); decreaseIndent(); writeLine(); - emitToken(6 /* CloseBraceToken */, node.members.end); + emitToken(10 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); emitStart(node); write(")("); @@ -7001,7 +7325,7 @@ var ts; emitTrailingComments(node); function emitConstructorOfClass() { ts.forEach(node.members, function (member) { - if (member.kind === 117 /* Constructor */ && !member.body) { + if (member.kind === 121 /* Constructor */ && !member.body) { emitPinnedOrTripleSlashComments(member); } }); @@ -7052,7 +7376,7 @@ var ts; emitLeadingCommentsOfPosition(ctor.body.statements.end); } decreaseIndent(); - emitToken(6 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + emitToken(10 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { @@ -7084,7 +7408,7 @@ var ts; emitEnumMemberDeclarations(); decreaseIndent(); writeLine(); - emitToken(6 /* CloseBraceToken */, node.members.end); + emitToken(10 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); write(")("); emitModuleMemberName(node); @@ -7129,7 +7453,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 172 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 177 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -7151,7 +7475,7 @@ var ts; write(resolver.getLocalNameOfContainer(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 173 /* ModuleBlock */) { + if (node.body.kind === 178 /* ModuleBlock */) { emit(node.body); } else { @@ -7164,7 +7488,7 @@ var ts; decreaseIndent(); writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(6 /* CloseBraceToken */, moduleBlock.statements.end); + emitToken(10 /* CloseBraceToken */, moduleBlock.statements.end); scopeEmitEnd(); } write(")("); @@ -7185,7 +7509,7 @@ var ts; emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportedViaEntityName(node); } if (emitImportDeclaration) { - if (node.externalModuleName && node.parent.kind === 177 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { + if (node.externalModuleName && node.parent.kind === 182 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { if (node.flags & 1 /* Export */) { writeLine(); emitLeadingComments(node); @@ -7214,7 +7538,7 @@ var ts; emitStart(node.externalModuleName); emitLiteral(node.externalModuleName); emitEnd(node.externalModuleName); - emitToken(8 /* CloseParenToken */, node.externalModuleName.end); + emitToken(12 /* CloseParenToken */, node.externalModuleName.end); } write(";"); emitEnd(node); @@ -7225,7 +7549,7 @@ var ts; function getExternalImportDeclarations(node) { var result = []; ts.forEach(node.statements, function (stat) { - if (stat.kind === 174 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { + if (stat.kind === 179 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { result.push(stat); } }); @@ -7233,7 +7557,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 175 /* ExportAssignment */) { + if (node.kind === 180 /* ExportAssignment */) { return node; } }); @@ -7349,117 +7673,117 @@ var ts; return emitPinnedOrTripleSlashComments(node); } switch (node.kind) { - case 55 /* Identifier */: + case 59 /* Identifier */: return emitIdentifier(node); - case 114 /* Parameter */: + case 118 /* Parameter */: return emitParameter(node); - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: return emitAccessor(node); - case 83 /* ThisKeyword */: + case 87 /* ThisKeyword */: return emitThis(node); - case 81 /* SuperKeyword */: + case 85 /* SuperKeyword */: return emitSuper(node); - case 79 /* NullKeyword */: + case 83 /* NullKeyword */: return write("null"); - case 85 /* TrueKeyword */: + case 89 /* TrueKeyword */: return write("true"); - case 70 /* FalseKeyword */: + case 74 /* FalseKeyword */: return write("false"); - case 2 /* NumericLiteral */: - case 3 /* StringLiteral */: - case 4 /* RegularExpressionLiteral */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 8 /* RegularExpressionLiteral */: return emitLiteral(node); - case 112 /* QualifiedName */: + case 116 /* QualifiedName */: return emitPropertyAccess(node); - case 127 /* ArrayLiteral */: + case 132 /* ArrayLiteral */: return emitArrayLiteral(node); - case 128 /* ObjectLiteral */: + case 133 /* ObjectLiteral */: return emitObjectLiteral(node); - case 129 /* PropertyAssignment */: + case 134 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 130 /* PropertyAccess */: + case 135 /* PropertyAccess */: return emitPropertyAccess(node); - case 131 /* IndexedAccess */: + case 136 /* IndexedAccess */: return emitIndexedAccess(node); - case 132 /* CallExpression */: + case 137 /* CallExpression */: return emitCallExpression(node); - case 133 /* NewExpression */: + case 138 /* NewExpression */: return emitNewExpression(node); - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return emit(node.operand); - case 135 /* ParenExpression */: + case 140 /* ParenExpression */: return emitParenExpression(node); - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 138 /* PrefixOperator */: - case 139 /* PostfixOperator */: + case 143 /* PrefixOperator */: + case 144 /* PostfixOperator */: return emitUnaryExpression(node); - case 140 /* BinaryExpression */: + case 145 /* BinaryExpression */: return emitBinaryExpression(node); - case 141 /* ConditionalExpression */: + case 146 /* ConditionalExpression */: return emitConditionalExpression(node); - case 142 /* OmittedExpression */: + case 147 /* OmittedExpression */: return; - case 143 /* Block */: - case 162 /* TryBlock */: - case 164 /* FinallyBlock */: - case 168 /* FunctionBlock */: - case 173 /* ModuleBlock */: + case 148 /* Block */: + case 167 /* TryBlock */: + case 169 /* FinallyBlock */: + case 173 /* FunctionBlock */: + case 178 /* ModuleBlock */: return emitBlock(node); - case 144 /* VariableStatement */: + case 149 /* VariableStatement */: return emitVariableStatement(node); - case 145 /* EmptyStatement */: + case 150 /* EmptyStatement */: return write(";"); - case 146 /* ExpressionStatement */: + case 151 /* ExpressionStatement */: return emitExpressionStatement(node); - case 147 /* IfStatement */: + case 152 /* IfStatement */: return emitIfStatement(node); - case 148 /* DoStatement */: + case 153 /* DoStatement */: return emitDoStatement(node); - case 149 /* WhileStatement */: + case 154 /* WhileStatement */: return emitWhileStatement(node); - case 150 /* ForStatement */: + case 155 /* ForStatement */: return emitForStatement(node); - case 151 /* ForInStatement */: + case 156 /* ForInStatement */: return emitForInStatement(node); - case 152 /* ContinueStatement */: - case 153 /* BreakStatement */: + case 157 /* ContinueStatement */: + case 158 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 154 /* ReturnStatement */: + case 159 /* ReturnStatement */: return emitReturnStatement(node); - case 155 /* WithStatement */: + case 160 /* WithStatement */: return emitWithStatement(node); - case 156 /* SwitchStatement */: + case 161 /* SwitchStatement */: return emitSwitchStatement(node); - case 157 /* CaseClause */: - case 158 /* DefaultClause */: + case 162 /* CaseClause */: + case 163 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 159 /* LabelledStatement */: + case 164 /* LabeledStatement */: return emitLabelledStatement(node); - case 160 /* ThrowStatement */: + case 165 /* ThrowStatement */: return emitThrowStatement(node); - case 161 /* TryStatement */: + case 166 /* TryStatement */: return emitTryStatement(node); - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: return emitCatchBlock(node); - case 165 /* DebuggerStatement */: + case 170 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 166 /* VariableDeclaration */: + case 171 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: return emitClassDeclaration(node); - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: return emitImportDeclaration(node); - case 177 /* SourceFile */: + case 182 /* SourceFile */: return emitSourceFile(node); } } @@ -7477,7 +7801,7 @@ var ts; return leadingComments; } function getLeadingCommentsToEmit(node) { - if (node.parent.kind === 177 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 182 /* SourceFile */ || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -7494,7 +7818,7 @@ var ts; emitComments(leadingComments, true, writer, writeComment); } function emitTrailingDeclarationComments(node) { - if (node.parent.kind === 177 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 182 /* SourceFile */ || node.end !== node.parent.end) { var trailingComments = ts.getTrailingComments(currentSourceFile.text, node.end); emitComments(trailingComments, false, writer, writeComment); } @@ -7655,21 +7979,27 @@ var ts; writeLine(); } function emitDeclarationFlags(node) { - if (node.flags & 64 /* Static */) { + if (node.flags & 128 /* Static */) { if (node.flags & 32 /* Private */) { write("private "); } + else if (node.flags & 64 /* Protected */) { + write("protected "); + } write("static "); } else { if (node.flags & 32 /* Private */) { write("private "); } + else if (node.flags & 64 /* Protected */) { + write("protected "); + } else if (node.parent === currentSourceFile) { if (node.flags & 1 /* Export */) { write("export "); } - if (node.kind !== 170 /* InterfaceDeclaration */) { + if (node.kind !== 175 /* InterfaceDeclaration */) { write("declare "); } } @@ -7725,7 +8055,7 @@ var ts; emitDeclarationFlags(node); write("module "); emitSourceTextOfNode(node.name); - while (node.body.kind !== 173 /* ModuleBlock */) { + while (node.body.kind !== 178 /* ModuleBlock */) { node = node.body; write("."); emitSourceTextOfNode(node.name); @@ -7773,30 +8103,30 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 120 /* CallSignature */: + case 124 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 116 /* Method */: - if (node.parent.flags & 64 /* Static */) { + case 120 /* Method */: + if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 169 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 174 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 167 /* FunctionDeclaration */: + case 172 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -7812,7 +8142,7 @@ var ts; emitJsDocComments(node); decreaseIndent(); emitSourceTextOfNode(node.name); - if (node.constraint && (node.parent.kind !== 116 /* Method */ || !(node.parent.flags & 32 /* Private */))) { + if (node.constraint && (node.parent.kind !== 120 /* Method */ || !(node.parent.flags & 32 /* Private */))) { write(" extends "); getSymbolVisibilityDiagnosticMessage = getTypeParameterConstraintVisibilityError; resolver.writeTypeAtLocation(node.constraint, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); @@ -7834,7 +8164,7 @@ var ts; resolver.writeTypeAtLocation(node, enclosingDeclaration, 1 /* WriteArrayAsGenericType */ | 2 /* UseTypeOfFunction */, writer); function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.kind === 169 /* ClassDeclaration */) { + if (node.parent.kind === 174 /* ClassDeclaration */) { if (symbolAccesibilityResult.errorModuleName) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2; } @@ -7862,7 +8192,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & (16 /* Public */ | 32 /* Private */)) { + if (param.flags & ts.NodeFlags.AccessibilityModifier) { emitPropertyDeclaration(param); } }); @@ -7919,9 +8249,9 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 166 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 171 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { emitSourceTextOfNode(node.name); - if (node.kind === 115 /* Property */ && (node.flags & 4 /* QuestionMark */)) { + if (node.kind === 119 /* Property */ && (node.flags & 4 /* QuestionMark */)) { write("?"); } if (!(node.flags & 32 /* Private */)) { @@ -7932,14 +8262,14 @@ var ts; } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 166 /* VariableDeclaration */) { + if (node.kind === 171 /* VariableDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 115 /* Property */) { - if (node.flags & 64 /* Static */) { + else if (node.kind === 119 /* Property */) { + if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 169 /* ClassDeclaration */) { + else if (node.parent.kind === 174 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { @@ -7981,8 +8311,8 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 119 /* SetAccessor */) { - if (node.parent.flags & 64 /* Static */) { + if (node.kind === 123 /* SetAccessor */) { + if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { @@ -7995,7 +8325,7 @@ var ts; }; } else { - if (node.flags & 64 /* Static */) { + if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { @@ -8010,14 +8340,14 @@ var ts; } } function emitFunctionDeclaration(node) { - if ((node.kind !== 167 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 172 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); emitDeclarationFlags(node); - if (node.kind === 167 /* FunctionDeclaration */) { + if (node.kind === 172 /* FunctionDeclaration */) { write("function "); emitSourceTextOfNode(node.name); } - else if (node.kind === 117 /* Constructor */) { + else if (node.kind === 121 /* Constructor */) { write("constructor"); } else { @@ -8035,24 +8365,24 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 120 /* CallSignature */ || node.kind === 122 /* IndexSignature */) { + if (node.kind === 124 /* CallSignature */ || node.kind === 126 /* IndexSignature */) { emitJsDocComments(node); } emitTypeParameters(node.typeParameters); - if (node.kind === 122 /* IndexSignature */) { + if (node.kind === 126 /* IndexSignature */) { write("["); } else { write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 122 /* IndexSignature */) { + if (node.kind === 126 /* IndexSignature */) { write("]"); } else { write(")"); } - if (node.kind !== 117 /* Constructor */ && !(node.flags & 32 /* Private */)) { + if (node.kind !== 121 /* Constructor */ && !(node.flags & 32 /* Private */)) { write(": "); getSymbolVisibilityDiagnosticMessage = getReturnTypeVisibilityError; resolver.writeReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); @@ -8062,27 +8392,27 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 120 /* CallSignature */: + case 124 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 122 /* IndexSignature */: + case 126 /* IndexSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 116 /* Method */: - if (node.flags & 64 /* Static */) { + case 120 /* Method */: + if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 169 /* ClassDeclaration */) { + else if (node.parent.kind === 174 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 167 /* FunctionDeclaration */: + case 172 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -8113,27 +8443,27 @@ var ts; function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 117 /* Constructor */: + case 121 /* Constructor */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 120 /* CallSignature */: + case 124 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 116 /* Method */: - if (node.parent.flags & 64 /* Static */) { + case 120 /* Method */: + if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 169 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 174 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 167 /* FunctionDeclaration */: + case 172 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -8148,37 +8478,37 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 117 /* Constructor */: - case 167 /* FunctionDeclaration */: - case 116 /* Method */: + case 121 /* Constructor */: + case 172 /* FunctionDeclaration */: + case 120 /* Method */: return emitFunctionDeclaration(node); - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: return emitConstructSignatureDeclaration(node); - case 120 /* CallSignature */: - case 122 /* IndexSignature */: + case 124 /* CallSignature */: + case 126 /* IndexSignature */: return emitSignatureDeclaration(node); - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: return emitAccessorDeclaration(node); - case 144 /* VariableStatement */: + case 149 /* VariableStatement */: return emitVariableStatement(node); - case 115 /* Property */: + case 119 /* Property */: return emitPropertyDeclaration(node); - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: return emitClassDeclaration(node); - case 176 /* EnumMember */: + case 181 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: return emitImportDeclaration(node); - case 175 /* ExportAssignment */: + case 180 /* ExportAssignment */: return emitExportAssignment(node); - case 177 /* SourceFile */: + case 182 /* SourceFile */: return emitSourceFile(node); } } @@ -8188,7 +8518,7 @@ var ts; } var referencePathsOutput = ""; function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 512 /* DeclarationFile */ ? referencedFile.filename : shouldEmitToOwnFile(referencedFile) ? getOwnEmitOutputFilePath(referencedFile, ".d.ts") : ts.getModuleNameFromFilename(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 1024 /* DeclarationFile */ ? referencedFile.filename : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, ".d.ts") : ts.getModuleNameFromFilename(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, compilerHost.getCurrentDirectory(), false); referencePathsOutput += "/// " + newLine; } @@ -8197,7 +8527,7 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = resolveScriptReference(root, fileReference); - if ((referencedFile.flags & 512 /* DeclarationFile */) || shouldEmitToOwnFile(referencedFile) || !addedGlobalFileReference) { + if ((referencedFile.flags & 1024 /* DeclarationFile */) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -8239,25 +8569,46 @@ var ts; writeFile(ts.getModuleNameFromFilename(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); } } - var shouldEmitDeclarations = resolver.shouldEmitDeclarations(); + var hasSemanticErrors = resolver.hasSemanticErrors(); function emitFile(jsFilePath, sourceFile) { emitJavaScript(jsFilePath, sourceFile); - if (shouldEmitDeclarations) { + if (!hasSemanticErrors && compilerOptions.declaration) { emitDeclarations(jsFilePath, sourceFile); } } - ts.forEach(program.getSourceFiles(), function (sourceFile) { - if (shouldEmitToOwnFile(sourceFile)) { - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, ".js"); - emitFile(jsFilePath, sourceFile); - } - }); + if (targetSourceFile === undefined) { + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + } + else { + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, ".js"); + emitFile(jsFilePath, targetSourceFile); + } if (compilerOptions.out) { emitFile(compilerOptions.out); } diagnostics.sort(ts.compareDiagnostics); diagnostics = ts.deduplicateSortedDiagnostics(diagnostics); + var hasEmitterError = ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1 /* Error */; }); + var returnCode; + if (hasEmitterError) { + returnCode = 4 /* EmitErrorsEncountered */; + } + else if (hasSemanticErrors && compilerOptions.declaration) { + returnCode = 3 /* DeclarationGenerationSkipped */; + } + else if (hasSemanticErrors && !compilerOptions.declaration) { + returnCode = 2 /* JSGeneratedWithSemanticErrors */; + } + else { + returnCode = 0 /* Succeeded */; + } return { + emitResultStatus: returnCode, errors: diagnostics, sourceMaps: sourceMapDataList }; @@ -8313,7 +8664,8 @@ var ts; symbolToString: symbolToString, getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType, getRootSymbol: getRootSymbol, - getContextualType: getContextualType + getContextualType: getContextualType, + getFullyQualifiedName: getFullyQualifiedName }; var undefinedSymbol = createSymbol(2 /* Property */ | 33554432 /* Transient */, "undefined"); var argumentsSymbol = createSymbol(2 /* Property */ | 33554432 /* Transient */, "arguments"); @@ -8342,6 +8694,7 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; + var tupleTypes = {}; var stringLiteralTypes = {}; var emitExtends = false; var mergedSymbols = []; @@ -8473,10 +8826,10 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return getAncestor(node, 177 /* SourceFile */); + return ts.getAncestor(node, 182 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 177 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 182 /* SourceFile */ && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -8516,21 +8869,21 @@ var ts; } } switch (location.kind) { - case 177 /* SourceFile */: + case 182 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & ts.SymbolFlags.ModuleMember)) { return returnResolvedSymbol(result); } break; - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 4 /* EnumMember */)) { return returnResolvedSymbol(result); } break; - case 115 /* Property */: - if (location.parent.kind === 169 /* ClassDeclaration */ && !(location.flags & 64 /* Static */)) { + case 119 /* Property */: + if (location.parent.kind === 174 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & ts.SymbolFlags.Value)) { @@ -8539,10 +8892,10 @@ var ts; } } break; - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & ts.SymbolFlags.Type)) { - if (lastLocation && lastLocation.flags & 64 /* Static */) { + if (lastLocation && lastLocation.flags & 128 /* Static */) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } @@ -8551,17 +8904,17 @@ var ts; } } break; - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 167 /* FunctionDeclaration */: - case 137 /* ArrowFunction */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 172 /* FunctionDeclaration */: + case 142 /* ArrowFunction */: if (name === "arguments") { return returnResolvedSymbol(argumentsSymbol); } break; - case 136 /* FunctionExpression */: + case 141 /* FunctionExpression */: if (name === "arguments") { return returnResolvedSymbol(argumentsSymbol); } @@ -8570,7 +8923,7 @@ var ts; return returnResolvedSymbol(location.symbol); } break; - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: var id = location.variable; if (name === id.text) { return returnResolvedSymbol(location.symbol); @@ -8590,7 +8943,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = getDeclarationOfKind(symbol, 174 /* ImportDeclaration */); + var node = getDeclarationOfKind(symbol, 179 /* ImportDeclaration */); var target = node.externalModuleName ? resolveExternalModuleName(node, node.externalModuleName) : getSymbolOfPartOfRightHandSideOfImport(node.entityName, node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; @@ -8606,17 +8959,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = getAncestor(entityName, 174 /* ImportDeclaration */); + importDeclaration = ts.getAncestor(entityName, 179 /* ImportDeclaration */); ts.Debug.assert(importDeclaration); } - if (entityName.kind === 55 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 59 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 55 /* Identifier */ || entityName.parent.kind === 112 /* QualifiedName */) { + if (entityName.kind === 59 /* Identifier */ || entityName.parent.kind === 116 /* QualifiedName */) { return resolveEntityName(importDeclaration, entityName, ts.SymbolFlags.Namespace); } else { - ts.Debug.assert(entityName.parent.kind === 174 /* ImportDeclaration */); + ts.Debug.assert(entityName.parent.kind === 179 /* ImportDeclaration */); return resolveEntityName(importDeclaration, entityName, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace); } } @@ -8624,15 +8977,15 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(location, name, meaning) { - if (name.kind === 55 /* Identifier */) { + if (name.kind === 59 /* Identifier */) { var symbol = resolveName(location, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, ts.identifierToString(name)); if (!symbol) { return; } } - else if (name.kind === 112 /* QualifiedName */) { + else if (name.kind === 116 /* QualifiedName */) { var namespace = resolveEntityName(location, name.left, ts.SymbolFlags.Namespace); - if (!namespace || namespace === unknownSymbol || name.right.kind === 111 /* Missing */) + if (!namespace || namespace === unknownSymbol || name.right.kind === 115 /* Missing */) return; var symbol = getSymbol(namespace.exports, name.right.text, meaning); if (!symbol) { @@ -8721,9 +9074,9 @@ var ts; var seenExportedMember = false; var result = []; ts.forEach(symbol.declarations, function (declaration) { - var block = (declaration.kind === 177 /* SourceFile */ ? declaration : declaration.body); + var block = (declaration.kind === 182 /* SourceFile */ ? declaration : declaration.body); ts.forEach(block.statements, function (node) { - if (node.kind === 175 /* ExportAssignment */) { + if (node.kind === 180 /* ExportAssignment */) { result.push(node); } else { @@ -8765,7 +9118,7 @@ var ts; var members = node.members; for (var i = 0; i < members.length; i++) { var member = members[i]; - if (member.kind === 117 /* Constructor */ && member.body) { + if (member.kind === 121 /* Constructor */ && member.body) { return member; } } @@ -8816,13 +9169,10 @@ var ts; return type; } function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { - return setObjectTypeMembers(createObjectType(8192 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + return setObjectTypeMembers(createObjectType(16384 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function isOptionalProperty(propertySymbol) { - if (propertySymbol.flags & 67108864 /* Prototype */) { - return false; - } - return (propertySymbol.valueDeclaration.flags & 4 /* QuestionMark */) && propertySymbol.valueDeclaration.kind !== 114 /* Parameter */; + return propertySymbol.valueDeclaration && propertySymbol.valueDeclaration.flags & 4 /* QuestionMark */ && propertySymbol.valueDeclaration.kind !== 118 /* Parameter */; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; @@ -8833,17 +9183,17 @@ var ts; } } switch (location.kind) { - case 177 /* SourceFile */: + case 182 /* SourceFile */: if (!ts.isExternalModule(location)) { break; } - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location).members)) { return result; } @@ -8954,7 +9304,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 172 /* ModuleDeclaration */ && declaration.name.kind === 3 /* StringLiteral */) || (declaration.kind === 177 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 177 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 182 /* SourceFile */ && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -8964,7 +9314,7 @@ var ts; return { aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 174 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 179 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -9075,7 +9425,10 @@ var ts; else if (type.flags & (1024 /* Class */ | 2048 /* Interface */ | 128 /* Enum */ | 512 /* TypeParameter */)) { writer.writeSymbol(type.symbol, enclosingDeclaration, ts.SymbolFlags.Type); } - else if (type.flags & 8192 /* Anonymous */) { + else if (type.flags & 8192 /* Tuple */) { + writeTupleType(type); + } + else if (type.flags & 16384 /* Anonymous */) { writeAnonymousType(type, allowFunctionOrConstructorTypeLiteral); } else if (type.flags & 256 /* StringLiteral */) { @@ -9085,6 +9438,14 @@ var ts; writer.write("{ ... }"); } } + function writeTypeList(types) { + for (var i = 0; i < types.length; i++) { + if (i > 0) { + writer.write(", "); + } + writeType(types[i], true); + } + } function writeTypeReference(type) { if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { writeType(type.typeArguments[0], false); @@ -9093,15 +9454,15 @@ var ts; else { writer.writeSymbol(type.target.symbol, enclosingDeclaration, ts.SymbolFlags.Type); writer.write("<"); - for (var i = 0; i < type.typeArguments.length; i++) { - if (i > 0) { - writer.write(", "); - } - writeType(type.typeArguments[i], true); - } + writeTypeList(type.typeArguments); writer.write(">"); } } + function writeTupleType(type) { + writer.write("["); + writeTypeList(type.elementTypes); + writer.write("]"); + } function writeAnonymousType(type, allowFunctionOrConstructorTypeLiteral) { if (type.symbol && type.symbol.flags & (16 /* Class */ | 64 /* Enum */ | 128 /* ValueModule */)) { writeTypeofSymbol(type); @@ -9122,8 +9483,8 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 2048 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 64 /* Static */; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 8 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 177 /* SourceFile */ || declaration.parent.kind === 173 /* ModuleBlock */; })); + var isStaticMethodSymbol = !!(type.symbol.flags & 2048 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 8 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 182 /* SourceFile */ || declaration.parent.kind === 178 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2 /* UseTypeOfFunction */) || (typeStack && ts.contains(typeStack, type)); } @@ -9248,12 +9609,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 172 /* ModuleDeclaration */) { - if (node.name.kind === 3 /* StringLiteral */) { + if (node.kind === 177 /* ModuleDeclaration */) { + if (node.name.kind === 7 /* StringLiteral */) { return node; } } - else if (node.kind === 177 /* SourceFile */) { + else if (node.kind === 182 /* SourceFile */) { return ts.isExternalModule(node) ? node : undefined; } } @@ -9295,31 +9656,31 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 166 /* VariableDeclaration */: - case 172 /* ModuleDeclaration */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 167 /* FunctionDeclaration */: - case 171 /* EnumDeclaration */: - case 174 /* ImportDeclaration */: - var parent = node.kind === 166 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (!(node.flags & 1 /* Export */) && !(node.kind !== 174 /* ImportDeclaration */ && parent.kind !== 177 /* SourceFile */ && ts.isInAmbientContext(parent))) { + case 171 /* VariableDeclaration */: + case 177 /* ModuleDeclaration */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 172 /* FunctionDeclaration */: + case 176 /* EnumDeclaration */: + case 179 /* ImportDeclaration */: + var parent = node.kind === 171 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (!(node.flags & 1 /* Export */) && !(node.kind !== 179 /* ImportDeclaration */ && parent.kind !== 182 /* SourceFile */ && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); - case 115 /* Property */: - case 116 /* Method */: - if (node.flags & 32 /* Private */) { + case 119 /* Property */: + case 120 /* Method */: + if (node.flags & (32 /* Private */ | 64 /* Protected */)) { return false; } - case 117 /* Constructor */: - case 121 /* ConstructSignature */: - case 120 /* CallSignature */: - case 122 /* IndexSignature */: - case 114 /* Parameter */: - case 173 /* ModuleBlock */: + case 121 /* Constructor */: + case 125 /* ConstructSignature */: + case 124 /* CallSignature */: + case 126 /* IndexSignature */: + case 118 /* Parameter */: + case 178 /* ModuleBlock */: return isDeclarationVisible(node.parent); - case 177 /* SourceFile */: + case 182 /* SourceFile */: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + ts.SyntaxKind[node.kind]); @@ -9357,16 +9718,16 @@ var ts; return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } function getTypeOfVariableDeclaration(declaration) { - if (declaration.parent.kind === 151 /* ForInStatement */) { + if (declaration.parent.kind === 156 /* ForInStatement */) { return anyType; } if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 114 /* Parameter */) { + if (declaration.kind === 118 /* Parameter */) { var func = declaration.parent; - if (func.kind === 119 /* SetAccessor */) { - var getter = getDeclarationOfKind(declaration.parent.symbol, 118 /* GetAccessor */); + if (func.kind === 123 /* SetAccessor */) { + var getter = getDeclarationOfKind(declaration.parent.symbol, 122 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -9377,10 +9738,13 @@ var ts; } } if (declaration.initializer) { - var unwidenedType = checkAndMarkExpression(declaration.initializer); - var type = getWidenedType(unwidenedType); - if (type !== unwidenedType) { - checkImplicitAny(type); + var type = checkAndMarkExpression(declaration.initializer); + if (declaration.kind !== 134 /* PropertyAssignment */) { + var unwidenedType = type; + type = getWidenedType(type); + if (type !== unwidenedType) { + checkImplicitAny(type); + } } return type; } @@ -9394,14 +9758,14 @@ var ts; if (getInnermostTypeOfNestedArrayTypes(type) !== anyType) { return; } - if (isPrivateWithinAmbient(declaration) || (declaration.kind === 114 /* Parameter */ && isPrivateWithinAmbient(declaration.parent))) { + if (isPrivateWithinAmbient(declaration) || (declaration.kind === 118 /* Parameter */ && isPrivateWithinAmbient(declaration.parent))) { return; } switch (declaration.kind) { - case 115 /* Property */: + case 119 /* Property */: var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 114 /* Parameter */: + case 118 /* Parameter */: var diagnostic = declaration.flags & 8 /* Rest */ ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; default: @@ -9417,7 +9781,7 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.kind === 163 /* CatchBlock */) { + if (declaration.kind === 168 /* CatchBlock */) { return links.type = anyType; } links.type = resolvingType; @@ -9428,6 +9792,10 @@ var ts; } else if (links.type === resolvingType) { links.type = anyType; + if (compilerOptions.noImplicitAny) { + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + } } return links.type; } @@ -9436,7 +9804,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 118 /* GetAccessor */) { + if (accessor.kind === 122 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -9455,8 +9823,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = getDeclarationOfKind(symbol, 118 /* GetAccessor */); - var setter = getDeclarationOfKind(symbol, 119 /* SetAccessor */); + var getter = getDeclarationOfKind(symbol, 122 /* GetAccessor */); + var setter = getDeclarationOfKind(symbol, 123 /* SetAccessor */); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -9473,7 +9841,7 @@ var ts; } else { if (compilerOptions.noImplicitAny) { - error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbol.name); + error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol)); } type = anyType; } @@ -9485,12 +9853,16 @@ var ts; } else if (links.type === resolvingType) { links.type = anyType; + if (compilerOptions.noImplicitAny) { + var getter = getDeclarationOfKind(symbol, 122 /* GetAccessor */); + error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = createObjectType(8192 /* Anonymous */, symbol); + links.type = createObjectType(16384 /* Anonymous */, symbol); } return links.type; } @@ -9549,7 +9921,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 170 /* InterfaceDeclaration */ || node.kind === 169 /* ClassDeclaration */) { + if (node.kind === 175 /* InterfaceDeclaration */ || node.kind === 174 /* ClassDeclaration */) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -9580,7 +9952,7 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = getDeclarationOfKind(symbol, 169 /* ClassDeclaration */); + var declaration = getDeclarationOfKind(symbol, 174 /* ClassDeclaration */); if (declaration.baseType) { var baseType = getTypeFromTypeReferenceNode(declaration.baseType); if (baseType !== unknownType) { @@ -9620,7 +9992,7 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 170 /* InterfaceDeclaration */ && declaration.baseTypes) { + if (declaration.kind === 175 /* InterfaceDeclaration */ && declaration.baseTypes) { ts.forEach(declaration.baseTypes, function (node) { var baseType = getTypeFromTypeReferenceNode(node); if (baseType !== unknownType) { @@ -9661,7 +10033,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!getDeclarationOfKind(symbol, 113 /* TypeParameter */).constraint) { + if (!getDeclarationOfKind(symbol, 117 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -9788,6 +10160,21 @@ var ts; } return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; } + function createTupleTypeMemberSymbols(memberTypes) { + var members = {}; + for (var i = 0; i < memberTypes.length; i++) { + var symbol = createSymbol(2 /* Property */ | 33554432 /* Transient */, "" + i); + symbol.type = memberTypes[i]; + members[i] = symbol; + } + return members; + } + function resolveTupleTypeMembers(type) { + var arrayType = resolveObjectTypeMembers(createArrayType(getBestCommonType(type.elementTypes))); + var members = createTupleTypeMemberSymbols(type.elementTypes); + addInheritedMembers(members, arrayType.properties); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; if (symbol.flags & 512 /* TypeLiteral */) { @@ -9828,9 +10215,12 @@ var ts; if (type.flags & (1024 /* Class */ | 2048 /* Interface */)) { resolveClassOrInterfaceMembers(type); } - else if (type.flags & 8192 /* Anonymous */) { + else if (type.flags & 16384 /* Anonymous */) { resolveAnonymousTypeMembers(type); } + else if (type.flags & 8192 /* Tuple */) { + resolveTupleTypeMembers(type); + } else { resolveTypeReferenceMembers(type); } @@ -9897,7 +10287,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 117 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 121 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; @@ -9905,7 +10295,7 @@ var ts; for (var i = 0, n = declaration.parameters.length; i < n; i++) { var param = declaration.parameters[i]; parameters.push(param.symbol); - if (param.type && param.type.kind === 3 /* StringLiteral */) { + if (param.type && param.type.kind === 7 /* StringLiteral */) { hasStringLiterals = true; } if (minArgumentCount < 0) { @@ -9925,8 +10315,8 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 118 /* GetAccessor */) { - var setter = getDeclarationOfKind(declaration.symbol, 119 /* SetAccessor */); + if (declaration.kind === 122 /* GetAccessor */) { + var setter = getDeclarationOfKind(declaration.symbol, 123 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && !declaration.body) { @@ -9944,16 +10334,16 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 167 /* FunctionDeclaration */: - case 116 /* Method */: - case 117 /* Constructor */: - case 120 /* CallSignature */: - case 121 /* ConstructSignature */: - case 122 /* IndexSignature */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 172 /* FunctionDeclaration */: + case 120 /* Method */: + case 121 /* Constructor */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + case 126 /* IndexSignature */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -9980,6 +10370,15 @@ var ts; } else if (signature.resolvedReturnType === resolvingType) { signature.resolvedReturnType = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.identifierToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } + } } return signature.resolvedReturnType; } @@ -10010,8 +10409,8 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 117 /* Constructor */ || signature.declaration.kind === 121 /* ConstructSignature */; - var type = createObjectType(8192 /* Anonymous */ | 16384 /* FromSignature */); + var isConstructor = signature.declaration.kind === 121 /* Constructor */ || signature.declaration.kind === 125 /* ConstructSignature */; + var type = createObjectType(16384 /* Anonymous */ | 32768 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; type.callSignatures = !isConstructor ? [signature] : emptyArray; @@ -10024,7 +10423,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 108 /* NumberKeyword */ : 110 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 112 /* NumberKeyword */ : 114 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; @@ -10051,7 +10450,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(getDeclarationOfKind(type.symbol, 113 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(getDeclarationOfKind(type.symbol, 117 /* TypeParameter */).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -10091,13 +10490,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 113 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 117 /* TypeParameter */; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 123 /* TypeReference */ && n.typeName.kind === 55 /* Identifier */) { + if (n.kind === 127 /* TypeReference */ && n.typeName.kind === 59 /* Identifier */) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, ts.SymbolFlags.Type, undefined, undefined); @@ -10130,7 +10529,7 @@ var ts; if (type.flags & (1024 /* Class */ | 2048 /* Interface */) && type.flags & 4096 /* Reference */) { var typeParameters = type.typeParameters; if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, ts.map(node.typeArguments, function (t) { return getTypeFromTypeNode(t); })); + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); } else { error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */), typeParameters.length); @@ -10162,9 +10561,9 @@ var ts; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; switch (declaration.kind) { - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 171 /* EnumDeclaration */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: return declaration; } } @@ -10200,10 +10599,26 @@ var ts; } return links.resolvedType; } + function createTupleType(elementTypes) { + var id = getTypeListId(elementTypes); + var type = tupleTypes[id]; + if (!type) { + type = tupleTypes[id] = createObjectType(8192 /* Tuple */); + type.elementTypes = elementTypes; + } + return type; + } + function getTypeFromTupleTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + } + return links.resolvedType; + } function getTypeFromTypeLiteralNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createObjectType(8192 /* Anonymous */, node.symbol); + links.resolvedType = createObjectType(16384 /* Anonymous */, node.symbol); } return links.resolvedType; } @@ -10223,30 +10638,32 @@ var ts; } function getTypeFromTypeNode(node) { switch (node.kind) { - case 101 /* AnyKeyword */: + case 105 /* AnyKeyword */: return anyType; - case 110 /* StringKeyword */: + case 114 /* StringKeyword */: return stringType; - case 108 /* NumberKeyword */: + case 112 /* NumberKeyword */: return numberType; - case 102 /* BooleanKeyword */: + case 106 /* BooleanKeyword */: return booleanType; - case 89 /* VoidKeyword */: + case 93 /* VoidKeyword */: return voidType; - case 3 /* StringLiteral */: + case 7 /* StringLiteral */: return getTypeFromStringLiteral(node); - case 123 /* TypeReference */: + case 127 /* TypeReference */: return getTypeFromTypeReferenceNode(node); - case 124 /* TypeQuery */: + case 128 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 126 /* ArrayType */: + case 130 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 125 /* TypeLiteral */: + case 131 /* TupleType */: + return getTypeFromTupleTypeNode(node); + case 129 /* TypeLiteral */: return getTypeFromTypeLiteralNode(node); - case 55 /* Identifier */: - case 112 /* QualifiedName */: + case 59 /* Identifier */: + case 116 /* QualifiedName */: var symbol = getSymbolInfo(node); - return getDeclaredTypeOfSymbol(symbol); + return symbol && getDeclaredTypeOfSymbol(symbol); default: return unknownType; } @@ -10358,7 +10775,7 @@ var ts; return result; } function instantiateAnonymousType(type, mapper) { - var result = createObjectType(8192 /* Anonymous */, type.symbol); + var result = createObjectType(16384 /* Anonymous */, type.symbol); result.properties = instantiateList(getPropertiesOfType(type), mapper, instantiateSymbol); result.members = createSymbolTable(result.properties); result.callSignatures = instantiateList(getSignaturesOfType(type, 0 /* Call */), mapper, instantiateSignature); @@ -10376,28 +10793,31 @@ var ts; if (type.flags & 512 /* TypeParameter */) { return mapper(type); } - if (type.flags & 8192 /* Anonymous */) { + if (type.flags & 16384 /* Anonymous */) { return type.symbol && type.symbol.flags & (8 /* Function */ | 2048 /* Method */ | 512 /* TypeLiteral */ | 1024 /* ObjectLiteral */) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096 /* Reference */) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); } + if (type.flags & 8192 /* Tuple */) { + return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); + } } return type; } function isContextSensitiveExpression(node) { switch (node.kind) { - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: return !node.typeParameters && !ts.forEach(node.parameters, function (p) { return p.type; }); - case 128 /* ObjectLiteral */: - return ts.forEach(node.properties, function (p) { return p.kind === 129 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); - case 127 /* ArrayLiteral */: + case 133 /* ObjectLiteral */: + return ts.forEach(node.properties, function (p) { return p.kind === 134 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); + case 132 /* ArrayLiteral */: return ts.forEach(node.elements, function (e) { return isContextSensitiveExpression(e); }); - case 141 /* ConditionalExpression */: + case 146 /* ConditionalExpression */: return isContextSensitiveExpression(node.whenTrue) || isContextSensitiveExpression(node.whenFalse); - case 140 /* BinaryExpression */: - return node.operator === 40 /* BarBarToken */ && (isContextSensitiveExpression(node.left) || isContextSensitiveExpression(node.right)); + case 145 /* BinaryExpression */: + return node.operator === 44 /* BarBarToken */ && (isContextSensitiveExpression(node.left) || isContextSensitiveExpression(node.right)); } return false; } @@ -10405,7 +10825,7 @@ var ts; if (type.flags & ts.TypeFlags.ObjectType) { var resolved = resolveObjectTypeMembers(type); if (resolved.constructSignatures.length) { - var result = createObjectType(8192 /* Anonymous */, type.symbol); + var result = createObjectType(16384 /* Anonymous */, type.symbol); result.members = resolved.members; result.properties = resolved.properties; result.callSignatures = resolved.callSignatures; @@ -10478,17 +10898,16 @@ var ts; return ok; } function isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, relate) { - ts.Debug.assert(sourceProp); - if (!targetProp) { + if (sourceProp === targetProp) { + return true; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); + if (sourcePropAccessibility !== targetPropAccessibility) { return false; } - var sourcePropIsPrivate = getDeclarationFlagsFromSymbol(sourceProp) & 32 /* Private */; - var targetPropIsPrivate = getDeclarationFlagsFromSymbol(targetProp) & 32 /* Private */; - if (sourcePropIsPrivate !== targetPropIsPrivate) { - return false; - } - if (sourcePropIsPrivate) { - return (getTargetSymbol(sourceProp).parent === getTargetSymbol(targetProp).parent) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (sourcePropAccessibility) { + return getTargetSymbol(sourceProp) === getTargetSymbol(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); } else { return isOptionalProperty(sourceProp) === isOptionalProperty(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); @@ -10510,8 +10929,8 @@ var ts; addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, program.getCompilerHost().getNewLine())); } return result; - function reportError(message, arg0, arg1) { - errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1); + function reportError(message, arg0, arg1, arg2) { + errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } function isRelatedTo(source, target, reportErrors) { return isRelatedToWithCustomErrors(source, target, reportErrors, undefined, undefined); @@ -10663,9 +11082,6 @@ var ts; } } function propertiesAreIdenticalTo(source, target, reportErrors) { - if (source === target) { - return true; - } var sourceProperties = getPropertiesOfType(source); var targetProperties = getPropertiesOfType(target); if (sourceProperties.length !== targetProperties.length) { @@ -10674,7 +11090,7 @@ var ts; for (var i = 0, len = sourceProperties.length; i < len; ++i) { var sourceProp = sourceProperties[i]; var targetProp = getPropertyOfType(target, sourceProp.name); - if (!isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, isRelatedTo)) { + if (!targetProp || !isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, isRelatedTo)) { return false; } } @@ -10685,39 +11101,60 @@ var ts; for (var i = 0; i < properties.length; i++) { var targetProp = properties[i]; var sourceProp = getPropertyOfApparentType(source, targetProp.name); - if (sourceProp === targetProp) { - continue; - } - var targetPropIsOptional = isOptionalProperty(targetProp); - if (!sourceProp) { - if (!targetPropIsOptional) { - if (reportErrors) { - reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); + if (sourceProp !== targetProp) { + if (!sourceProp) { + if (!isOptionalProperty(targetProp)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); + } + return false; } - return false; } - } - else if (sourceProp !== targetProp) { - if (targetProp.flags & 67108864 /* Prototype */) { - continue; - } - if (getDeclarationFlagsFromSymbol(sourceProp) & 32 /* Private */ || getDeclarationFlagsFromSymbol(targetProp) & 32 /* Private */) { - if (reportErrors) { - reportError(ts.Diagnostics.Private_property_0_cannot_be_reimplemented, symbolToString(targetProp)); + else if (!(targetProp.flags & 67108864 /* Prototype */)) { + var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); + var targetFlags = getDeclarationFlagsFromSymbol(targetProp); + if (sourceFlags & 32 /* Private */ || targetFlags & 32 /* Private */) { + if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (reportErrors) { + if (sourceFlags & 32 /* Private */ && targetFlags & 32 /* Private */) { + reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } + else { + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourceFlags & 32 /* Private */ ? source : target), typeToString(sourceFlags & 32 /* Private */ ? target : source)); + } + } + return false; + } } - return false; - } - if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) { - if (reportErrors) { - reportError(ts.Diagnostics.Types_of_property_0_are_incompatible_Colon, symbolToString(targetProp)); + else if (targetFlags & 64 /* Protected */) { + var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 16 /* Class */; + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; + var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + } + return false; + } } - return false; - } - else if (isOptionalProperty(sourceProp) && !targetPropIsOptional) { - if (reportErrors) { - reportError(ts.Diagnostics.Required_property_0_cannot_be_reimplemented_with_optional_property_in_1, targetProp.name, typeToString(source)); + else if (sourceFlags & 64 /* Protected */) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return false; + } + if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_property_0_are_incompatible_Colon, symbolToString(targetProp)); + } + return false; + } + if (isOptionalProperty(sourceProp) && !isOptionalProperty(targetProp)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return false; } - return false; } } } @@ -10791,11 +11228,11 @@ var ts; var saveErrorInfo = errorInfo; outer: for (var i = 0; i < targetSignatures.length; i++) { var t = targetSignatures[i]; - if (!t.hasStringLiterals || target.flags & 16384 /* FromSignature */) { + if (!t.hasStringLiterals || target.flags & 32768 /* FromSignature */) { var localErrors = reportErrors; for (var j = 0; j < sourceSignatures.length; j++) { var s = sourceSignatures[j]; - if (!s.hasStringLiterals || source.flags & 16384 /* FromSignature */) { + if (!s.hasStringLiterals || source.flags & 32768 /* FromSignature */) { if (isSignatureSubtypeOrAssignableTo(s, t, localErrors)) { errorInfo = saveErrorInfo; continue outer; @@ -10930,7 +11367,7 @@ var ts; return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }) || (candidatesOnly ? undefined : emptyObjectType); } function isTypeOfObjectLiteral(type) { - return (type.flags & 8192 /* Anonymous */) && type.symbol && (type.symbol.flags & 1024 /* ObjectLiteral */) ? true : false; + return (type.flags & 16384 /* Anonymous */) && type.symbol && (type.symbol.flags & 1024 /* ObjectLiteral */) ? true : false; } function isArrayType(type) { return type.flags & 4096 /* Reference */ && type.target === globalArrayType; @@ -11079,7 +11516,7 @@ var ts; inferFromTypes(sourceTypes[i], targetTypes[i]); } } - else if (source.flags & ts.TypeFlags.ObjectType && (target.flags & 4096 /* Reference */ || (target.flags & 8192 /* Anonymous */) && target.symbol && target.symbol.flags & (2048 /* Method */ | 512 /* TypeLiteral */))) { + else if (source.flags & ts.TypeFlags.ObjectType && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || (target.flags & 16384 /* Anonymous */) && target.symbol && target.symbol.flags & (2048 /* Method */ | 512 /* TypeLiteral */))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -11150,47 +11587,16 @@ var ts; return context.inferredTypes; } function hasAncestor(node, kind) { - return getAncestor(node, kind) !== undefined; - } - function getAncestor(node, kind) { - switch (kind) { - case 169 /* ClassDeclaration */: - while (node) { - switch (node.kind) { - case 169 /* ClassDeclaration */: - return node; - case 171 /* EnumDeclaration */: - case 170 /* InterfaceDeclaration */: - case 172 /* ModuleDeclaration */: - case 174 /* ImportDeclaration */: - return undefined; - default: - node = node.parent; - continue; - } - } - break; - default: - while (node) { - if (node.kind === kind) { - return node; - } - else { - node = node.parent; - } - } - break; - } - return undefined; + return ts.getAncestor(node, kind) !== undefined; } function checkIdentifier(node) { function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 124 /* TypeQuery */: + case 128 /* TypeQuery */: return true; - case 55 /* Identifier */: - case 112 /* QualifiedName */: + case 59 /* Identifier */: + case 116 /* QualifiedName */: node = node.parent; continue; default: @@ -11212,32 +11618,10 @@ var ts; checkCollisionWithIndexVariableInGeneratedCode(node, node); return getTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol)); } - function getThisContainer(node) { - while (true) { - node = node.parent; - if (!node) { - return node; - } - switch (node.kind) { - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 172 /* ModuleDeclaration */: - case 115 /* Property */: - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 171 /* EnumDeclaration */: - case 177 /* SourceFile */: - case 137 /* ArrowFunction */: - return node; - } - } - } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 169 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 174 /* ClassDeclaration */ ? container.parent : undefined; getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 115 /* Property */ || container.kind === 117 /* Constructor */) { + if (container.kind === 119 /* Property */ || container.kind === 121 /* Constructor */) { getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } else { @@ -11245,26 +11629,26 @@ var ts; } } function checkThisExpression(node) { - var container = getThisContainer(node); + var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - while (container.kind === 137 /* ArrowFunction */) { - container = getThisContainer(container); + if (container.kind === 142 /* ArrowFunction */) { + container = ts.getThisContainer(container, false); needToCaptureLexicalThis = true; } switch (container.kind) { - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 117 /* Constructor */: + case 121 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 115 /* Property */: - if (container.flags & 64 /* Static */) { + case 119 /* Property */: + if (container.flags & 128 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; @@ -11272,10 +11656,10 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 169 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 174 /* ClassDeclaration */ ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); - return container.flags & 64 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); } return anyType; } @@ -11285,29 +11669,29 @@ var ts; if (!node) return node; switch (node.kind) { - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: - case 115 /* Property */: - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: + case 119 /* Property */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: return node; } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 114 /* Parameter */) { + if (n.kind === 118 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 132 /* CallExpression */ && node.parent.func === node; - var enclosingClass = getAncestor(node, 169 /* ClassDeclaration */); + var isCallExpression = node.parent.kind === 137 /* CallExpression */ && node.parent.func === node; + var enclosingClass = ts.getAncestor(node, 174 /* ClassDeclaration */); var baseClass; if (enclosingClass && enclosingClass.baseType) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -11321,26 +11705,26 @@ var ts; if (container) { var canUseSuperExpression = false; if (isCallExpression) { - canUseSuperExpression = container.kind === 117 /* Constructor */; + canUseSuperExpression = container.kind === 121 /* Constructor */; } else { var needToCaptureLexicalThis = false; - while (container && container.kind === 137 /* ArrowFunction */) { + while (container && container.kind === 142 /* ArrowFunction */) { container = getSuperContainer(container); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 169 /* ClassDeclaration */) { - if (container.flags & 64 /* Static */) { - canUseSuperExpression = container.kind === 116 /* Method */ || container.kind === 118 /* GetAccessor */ || container.kind === 119 /* SetAccessor */; + if (container && container.parent && container.parent.kind === 174 /* ClassDeclaration */) { + if (container.flags & 128 /* Static */) { + canUseSuperExpression = container.kind === 120 /* Method */ || container.kind === 122 /* GetAccessor */ || container.kind === 123 /* SetAccessor */; } else { - canUseSuperExpression = container.kind === 116 /* Method */ || container.kind === 118 /* GetAccessor */ || container.kind === 119 /* SetAccessor */ || container.kind === 115 /* Property */ || container.kind === 117 /* Constructor */; + canUseSuperExpression = container.kind === 120 /* Method */ || container.kind === 122 /* GetAccessor */ || container.kind === 123 /* SetAccessor */ || container.kind === 119 /* Property */ || container.kind === 121 /* Constructor */; } } } if (canUseSuperExpression) { var returnType; - if ((container.flags & 64 /* Static */) || isCallExpression) { + if ((container.flags & 128 /* Static */) || isCallExpression) { getNodeLinks(node).flags |= 32 /* SuperStatic */; returnType = getTypeOfSymbol(baseClass.symbol); } @@ -11348,7 +11732,7 @@ var ts; getNodeLinks(node).flags |= 16 /* SuperInstance */; returnType = baseClass; } - if (container.kind === 117 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 121 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; } @@ -11368,7 +11752,7 @@ var ts; } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; - if (func.kind === 136 /* FunctionExpression */ || func.kind === 137 /* ArrowFunction */) { + if (func.kind === 141 /* FunctionExpression */ || func.kind === 142 /* ArrowFunction */) { if (isContextSensitiveExpression(func)) { var signature = getContextualSignature(func); if (signature) { @@ -11384,16 +11768,16 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 114 /* Parameter */) { + if (declaration.kind === 118 /* Parameter */) { return getContextuallyTypedParameterType(declaration); } } return undefined; } function getContextualTypeForReturnExpression(node) { - var func = getContainingFunction(node); + var func = ts.getContainingFunction(node); if (func) { - if (func.type || func.kind === 117 /* Constructor */ || func.kind === 118 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 119 /* SetAccessor */))) { + if (func.type || func.kind === 121 /* Constructor */ || func.kind === 122 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 123 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } var signature = getContextualSignature(func); @@ -11420,7 +11804,7 @@ var ts; return checkExpression(binaryExpression.left); } } - else if (operator === 40 /* BarBarToken */) { + else if (operator === 44 /* BarBarToken */) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -11446,37 +11830,48 @@ var ts; function getContextualTypeForElementExpression(node) { var arrayLiteral = node.parent; var type = getContextualType(arrayLiteral); - return type ? getIndexTypeOfType(type, 1 /* Number */) : undefined; + if (type) { + var index = ts.indexOf(arrayLiteral.elements, node); + var prop = getPropertyOfType(type, "" + index); + if (prop) { + return getTypeOfSymbol(prop); + } + return getIndexTypeOfType(type, 1 /* Number */); + } + return undefined; } function getContextualTypeForConditionalOperand(node) { var conditional = node.parent; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualType(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } if (node.contextualType) { return node.contextualType; } var parent = node.parent; switch (parent.kind) { - case 166 /* VariableDeclaration */: - case 114 /* Parameter */: - case 115 /* Property */: + case 171 /* VariableDeclaration */: + case 118 /* Parameter */: + case 119 /* Property */: return getContextualTypeForInitializerExpression(node); - case 137 /* ArrowFunction */: - case 154 /* ReturnStatement */: + case 142 /* ArrowFunction */: + case 159 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 132 /* CallExpression */: - case 133 /* NewExpression */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: return getContextualTypeForArgument(node); - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return getTypeFromTypeNode(parent.type); - case 140 /* BinaryExpression */: + case 145 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 129 /* PropertyAssignment */: + case 134 /* PropertyAssignment */: return getContextualTypeForPropertyExpression(node); - case 127 /* ArrayLiteral */: + case 132 /* ArrayLiteral */: return getContextualTypeForElementExpression(node); - case 141 /* ConditionalExpression */: + case 146 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); } return undefined; @@ -11498,19 +11893,26 @@ var ts; return mapper && mapper !== identityMapper; } function checkArrayLiteral(node, contextualMapper) { + var contextualType = getContextualType(node); + var elements = node.elements; var elementTypes = []; - ts.forEach(node.elements, function (element) { - if (element.kind !== 142 /* OmittedExpression */) { - var type = checkExpression(element, contextualMapper); - if (!ts.contains(elementTypes, type)) - elementTypes.push(type); + var isTupleLiteral = false; + for (var i = 0; i < elements.length; i++) { + if (contextualType && getPropertyOfType(contextualType, "" + i)) { + isTupleLiteral = true; } - }); - var contextualType = isInferentialContext(contextualMapper) ? undefined : getContextualType(node); - var contextualElementType = contextualType && getIndexTypeOfType(contextualType, 1 /* Number */); - var elementType = getBestCommonType(elementTypes, contextualElementType, true); - if (!elementType) - elementType = elementTypes.length ? emptyObjectType : undefinedType; + var element = elements[i]; + var type = element.kind !== 147 /* OmittedExpression */ ? checkExpression(element, contextualMapper) : undefinedType; + elementTypes.push(type); + } + if (isTupleLiteral) { + return createTupleType(elementTypes); + } + var contextualElementType = contextualType && !isInferentialContext(contextualMapper) ? getIndexTypeOfType(contextualType, 1 /* Number */) : undefined; + var elementType = getBestCommonType(ts.uniqueElements(elementTypes), contextualElementType, true); + if (!elementType) { + elementType = elements.length ? emptyObjectType : undefinedType; + } return createArrayType(elementType); } function isNumericName(name) { @@ -11535,11 +11937,11 @@ var ts; member = prop; } else { - var getAccessor = getDeclarationOfKind(member, 118 /* GetAccessor */); + var getAccessor = getDeclarationOfKind(member, 122 /* GetAccessor */); if (getAccessor) { checkAccessorDeclaration(getAccessor); } - var setAccessor = getDeclarationOfKind(member, 119 /* SetAccessor */); + var setAccessor = getDeclarationOfKind(member, 123 /* SetAccessor */); if (setAccessor) { checkAccessorDeclaration(setAccessor); } @@ -11570,10 +11972,38 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.flags & 67108864 /* Prototype */ ? 115 /* Property */ : s.valueDeclaration.kind; + return s.valueDeclaration ? s.valueDeclaration.kind : 119 /* Property */; } function getDeclarationFlagsFromSymbol(s) { - return s.flags & 67108864 /* Prototype */ ? 16 /* Public */ | 64 /* Static */ : s.valueDeclaration.flags; + return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & 67108864 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; + } + function checkClassPropertyAccess(node, type, prop) { + var flags = getDeclarationFlagsFromSymbol(prop); + if (!(flags & (32 /* Private */ | 64 /* Protected */))) { + return; + } + var enclosingClassDeclaration = ts.getAncestor(node, 174 /* ClassDeclaration */); + var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; + var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + if (flags & 32 /* Private */) { + if (declaringClass !== enclosingClass) { + error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + } + return; + } + if (node.left.kind === 85 /* SuperKeyword */) { + return; + } + if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + return; + } + if (flags & 128 /* Static */) { + return; + } + if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + } } function checkPropertyAccess(node) { var type = checkExpression(node.left); @@ -11593,14 +12023,11 @@ var ts; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 16 /* Class */) { - if (node.left.kind === 81 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 116 /* Method */) { - error(node.right, ts.Diagnostics.Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword); + if (node.left.kind === 85 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 120 /* Method */) { + error(node.right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } - else if (getDeclarationFlagsFromSymbol(prop) & 32 /* Private */) { - var classDeclaration = getAncestor(node, 169 /* ClassDeclaration */); - if (!classDeclaration || !ts.contains(prop.parent.declarations, classDeclaration)) { - error(node, ts.Diagnostics.Property_0_is_inaccessible, getFullyQualifiedName(prop)); - } + else { + checkClassPropertyAccess(node, type, prop); } } return getTypeOfSymbol(prop); @@ -11616,7 +12043,7 @@ var ts; if (apparentType === unknownType) { return unknownType; } - if (node.index.kind === 3 /* StringLiteral */ || node.index.kind === 2 /* NumericLiteral */) { + if (node.index.kind === 7 /* StringLiteral */ || node.index.kind === 6 /* NumericLiteral */) { var name = node.index.text; var prop = getPropertyOfApparentType(apparentType, name); if (prop) { @@ -11744,7 +12171,7 @@ var ts; for (var i = 0; i < node.arguments.length; i++) { var arg = node.arguments[i]; var paramType = getTypeAtPosition(signature, i); - var argType = arg.kind === 3 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = arg.kind === 7 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); if (!isValidArgument) { return false; @@ -11797,7 +12224,7 @@ var ts; return resolveErrorCall(node); } function resolveCallExpression(node) { - if (node.func.kind === 81 /* SuperKeyword */) { + if (node.func.kind === 85 /* SuperKeyword */) { var superType = checkSuperExpression(node.func); if (superType !== unknownType) { return resolveCall(node, getSignaturesOfType(superType, 1 /* Construct */)); @@ -11865,18 +12292,18 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature) { links.resolvedSignature = anySignature; - links.resolvedSignature = node.kind === 132 /* CallExpression */ ? resolveCallExpression(node) : resolveNewExpression(node); + links.resolvedSignature = node.kind === 137 /* CallExpression */ ? resolveCallExpression(node) : resolveNewExpression(node); } return links.resolvedSignature; } function checkCallExpression(node) { var signature = getResolvedSignature(node); - if (node.func.kind === 81 /* SuperKeyword */) { + if (node.func.kind === 85 /* SuperKeyword */) { return voidType; } - if (node.kind === 133 /* NewExpression */) { + if (node.kind === 138 /* NewExpression */) { var declaration = signature.declaration; - if (declaration && (declaration.kind !== 117 /* Constructor */ && declaration.kind !== 121 /* ConstructSignature */)) { + if (declaration && (declaration.kind !== 121 /* Constructor */ && declaration.kind !== 125 /* ConstructSignature */)) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -11913,7 +12340,7 @@ var ts; } } function getReturnTypeFromBody(func, contextualMapper) { - if (func.body.kind !== 168 /* FunctionBlock */) { + if (func.body.kind !== 173 /* FunctionBlock */) { var unwidenedType = checkAndMarkExpression(func.body, contextualMapper); var widenedType = getWidenedType(unwidenedType); if (fullTypeCheck && compilerOptions.noImplicitAny && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { @@ -11942,35 +12369,9 @@ var ts; } return voidType; } - function forEachReturnStatement(body, visitor) { - return traverse(body); - function traverse(node) { - switch (node.kind) { - case 154 /* ReturnStatement */: - return visitor(node); - case 143 /* Block */: - case 168 /* FunctionBlock */: - case 147 /* IfStatement */: - case 148 /* DoStatement */: - case 149 /* WhileStatement */: - case 150 /* ForStatement */: - case 151 /* ForInStatement */: - case 155 /* WithStatement */: - case 156 /* SwitchStatement */: - case 157 /* CaseClause */: - case 158 /* DefaultClause */: - case 159 /* LabelledStatement */: - case 161 /* TryStatement */: - case 162 /* TryBlock */: - case 163 /* CatchBlock */: - case 164 /* FinallyBlock */: - return ts.forEachChild(node, traverse); - } - } - } function checkAndAggregateReturnExpressionTypes(body, contextualMapper) { var aggregatedTypes = []; - forEachReturnStatement(body, function (returnStatement) { + ts.forEachReturnStatement(body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { var type = checkAndMarkExpression(expr, contextualMapper); @@ -11982,12 +12383,12 @@ var ts; return aggregatedTypes; } function bodyContainsAReturnStatement(funcBody) { - return forEachReturnStatement(funcBody, function (returnStatement) { + return ts.forEachReturnStatement(funcBody, function (returnStatement) { return true; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 160 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 165 /* ThrowStatement */); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!fullTypeCheck) { @@ -11996,7 +12397,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (!func.body || func.body.kind !== 168 /* FunctionBlock */) { + if (!func.body || func.body.kind !== 173 /* FunctionBlock */) { return; } var bodyBlock = func.body; @@ -12040,7 +12441,7 @@ var ts; if (node.type) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } - if (node.body.kind === 168 /* FunctionBlock */) { + if (node.body.kind === 173 /* FunctionBlock */) { checkSourceElement(node.body); } else { @@ -12065,15 +12466,15 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 55 /* Identifier */: + case 59 /* Identifier */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 1 /* Variable */) !== 0; - case 130 /* PropertyAccess */: + case 135 /* PropertyAccess */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~4 /* EnumMember */) !== 0; - case 131 /* IndexedAccess */: + case 136 /* IndexedAccess */: return true; - case 135 /* ParenExpression */: + case 140 /* ParenExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -12088,19 +12489,19 @@ var ts; function checkPrefixExpression(node) { var operandType = checkExpression(node.operand); switch (node.operator) { - case 24 /* PlusToken */: - case 25 /* MinusToken */: - case 38 /* TildeToken */: + case 28 /* PlusToken */: + case 29 /* MinusToken */: + case 42 /* TildeToken */: return numberType; - case 37 /* ExclamationToken */: - case 64 /* DeleteKeyword */: + case 41 /* ExclamationToken */: + case 68 /* DeleteKeyword */: return booleanType; - case 87 /* TypeOfKeyword */: + case 91 /* TypeOfKeyword */: return stringType; - case 89 /* VoidKeyword */: + case 93 /* VoidKeyword */: return undefinedType; - case 29 /* PlusPlusToken */: - case 30 /* MinusMinusToken */: + case 33 /* PlusPlusToken */: + case 34 /* MinusMinusToken */: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer); @@ -12143,26 +12544,26 @@ var ts; var leftType = checkExpression(node.left, contextualMapper); var rightType = checkExpression(node.right, contextualMapper); switch (operator) { - case 26 /* AsteriskToken */: - case 46 /* AsteriskEqualsToken */: - case 27 /* SlashToken */: - case 47 /* SlashEqualsToken */: - case 28 /* PercentToken */: - case 48 /* PercentEqualsToken */: - case 25 /* MinusToken */: - case 45 /* MinusEqualsToken */: - case 31 /* LessThanLessThanToken */: - case 49 /* LessThanLessThanEqualsToken */: - case 32 /* GreaterThanGreaterThanToken */: - case 50 /* GreaterThanGreaterThanEqualsToken */: - case 33 /* GreaterThanGreaterThanGreaterThanToken */: - case 51 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 35 /* BarToken */: - case 53 /* BarEqualsToken */: - case 36 /* CaretToken */: - case 54 /* CaretEqualsToken */: - case 34 /* AmpersandToken */: - case 52 /* AmpersandEqualsToken */: + case 30 /* AsteriskToken */: + case 50 /* AsteriskEqualsToken */: + case 31 /* SlashToken */: + case 51 /* SlashEqualsToken */: + case 32 /* PercentToken */: + case 52 /* PercentEqualsToken */: + case 29 /* MinusToken */: + case 49 /* MinusEqualsToken */: + case 35 /* LessThanLessThanToken */: + case 53 /* LessThanLessThanEqualsToken */: + case 36 /* GreaterThanGreaterThanToken */: + case 54 /* GreaterThanGreaterThanEqualsToken */: + case 37 /* GreaterThanGreaterThanGreaterThanToken */: + case 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 39 /* BarToken */: + case 57 /* BarEqualsToken */: + case 40 /* CaretToken */: + case 58 /* CaretEqualsToken */: + case 38 /* AmpersandToken */: + case 56 /* AmpersandEqualsToken */: if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) leftType = rightType; if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) @@ -12173,8 +12574,8 @@ var ts; checkAssignmentOperator(numberType); } return numberType; - case 24 /* PlusToken */: - case 44 /* PlusEqualsToken */: + case 28 /* PlusToken */: + case 48 /* PlusEqualsToken */: if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) leftType = rightType; if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) @@ -12193,34 +12594,34 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 44 /* PlusEqualsToken */) { + if (operator === 48 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; - case 19 /* EqualsEqualsToken */: - case 20 /* ExclamationEqualsToken */: - case 21 /* EqualsEqualsEqualsToken */: - case 22 /* ExclamationEqualsEqualsToken */: - case 15 /* LessThanToken */: - case 16 /* GreaterThanToken */: - case 17 /* LessThanEqualsToken */: - case 18 /* GreaterThanEqualsToken */: + case 23 /* EqualsEqualsToken */: + case 24 /* ExclamationEqualsToken */: + case 25 /* EqualsEqualsEqualsToken */: + case 26 /* ExclamationEqualsEqualsToken */: + case 19 /* LessThanToken */: + case 20 /* GreaterThanToken */: + case 21 /* LessThanEqualsToken */: + case 22 /* GreaterThanEqualsToken */: if (!isTypeSubtypeOf(leftType, rightType) && !isTypeSubtypeOf(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 77 /* InstanceOfKeyword */: + case 81 /* InstanceOfKeyword */: return checkInstanceOfExpression(node, leftType, rightType); - case 76 /* InKeyword */: + case 80 /* InKeyword */: return checkInExpression(node, leftType, rightType); - case 39 /* AmpersandAmpersandToken */: + case 43 /* AmpersandAmpersandToken */: return rightType; - case 40 /* BarBarToken */: + case 44 /* BarBarToken */: return getBestCommonType([leftType, rightType], isInferentialContext(contextualMapper) ? undefined : getContextualType(node)); - case 43 /* EqualsToken */: + case 47 /* EqualsToken */: checkAssignmentOperator(rightType); return rightType; - case 14 /* CommaToken */: + case 18 /* CommaToken */: return rightType; } function checkAssignmentOperator(valueType) { @@ -12282,50 +12683,50 @@ var ts; } function checkExpressionNode(node, contextualMapper) { switch (node.kind) { - case 55 /* Identifier */: + case 59 /* Identifier */: return checkIdentifier(node); - case 83 /* ThisKeyword */: + case 87 /* ThisKeyword */: return checkThisExpression(node); - case 81 /* SuperKeyword */: + case 85 /* SuperKeyword */: return checkSuperExpression(node); - case 79 /* NullKeyword */: + case 83 /* NullKeyword */: return nullType; - case 85 /* TrueKeyword */: - case 70 /* FalseKeyword */: + case 89 /* TrueKeyword */: + case 74 /* FalseKeyword */: return booleanType; - case 2 /* NumericLiteral */: + case 6 /* NumericLiteral */: return numberType; - case 3 /* StringLiteral */: + case 7 /* StringLiteral */: return stringType; - case 4 /* RegularExpressionLiteral */: + case 8 /* RegularExpressionLiteral */: return globalRegExpType; - case 112 /* QualifiedName */: + case 116 /* QualifiedName */: return checkPropertyAccess(node); - case 127 /* ArrayLiteral */: + case 132 /* ArrayLiteral */: return checkArrayLiteral(node, contextualMapper); - case 128 /* ObjectLiteral */: + case 133 /* ObjectLiteral */: return checkObjectLiteral(node, contextualMapper); - case 130 /* PropertyAccess */: + case 135 /* PropertyAccess */: return checkPropertyAccess(node); - case 131 /* IndexedAccess */: + case 136 /* IndexedAccess */: return checkIndexedAccess(node); - case 132 /* CallExpression */: - case 133 /* NewExpression */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: return checkCallExpression(node); - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return checkTypeAssertion(node); - case 135 /* ParenExpression */: + case 140 /* ParenExpression */: return checkExpression(node.expression); - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: return checkFunctionExpression(node, contextualMapper); - case 138 /* PrefixOperator */: + case 143 /* PrefixOperator */: return checkPrefixExpression(node); - case 139 /* PostfixOperator */: + case 144 /* PostfixOperator */: return checkPostfixExpression(node); - case 140 /* BinaryExpression */: + case 145 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 141 /* ConditionalExpression */: + case 146 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); } return unknownType; @@ -12341,7 +12742,7 @@ var ts; checkVariableDeclaration(parameterDeclaration); if (fullTypeCheck) { checkCollisionWithIndexVariableInGeneratedCode(parameterDeclaration, parameterDeclaration.name); - if (parameterDeclaration.flags & (16 /* Public */ | 32 /* Private */) && !(parameterDeclaration.parent.kind === 117 /* Constructor */ && parameterDeclaration.parent.body)) { + if (parameterDeclaration.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */) && !(parameterDeclaration.parent.kind === 121 /* Constructor */ && parameterDeclaration.parent.body)) { error(parameterDeclaration, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } if (parameterDeclaration.flags & 8 /* Rest */) { @@ -12356,10 +12757,10 @@ var ts; } } function checkReferencesInInitializer(n) { - if (n.kind === 55 /* Identifier */) { + if (n.kind === 59 /* Identifier */) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(parameterDeclaration.parent.locals, referencedSymbol.name, ts.SymbolFlags.Value) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 114 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 118 /* Parameter */) { if (referencedSymbol.valueDeclaration === parameterDeclaration) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.identifierToString(parameterDeclaration.name)); return; @@ -12393,10 +12794,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 121 /* ConstructSignature */: + case 125 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 120 /* CallSignature */: + case 124 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -12405,7 +12806,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 170 /* InterfaceDeclaration */) { + if (node.kind === 175 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -12419,7 +12820,7 @@ var ts; var declaration = indexSymbol.declarations[i]; if (declaration.parameters.length == 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 110 /* StringKeyword */: + case 114 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -12427,7 +12828,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 108 /* NumberKeyword */: + case 112 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -12461,39 +12862,39 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 132 /* CallExpression */ && n.func.kind === 81 /* SuperKeyword */; + return n.kind === 137 /* CallExpression */ && n.func.kind === 85 /* SuperKeyword */; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 136 /* FunctionExpression */: - case 167 /* FunctionDeclaration */: - case 137 /* ArrowFunction */: - case 128 /* ObjectLiteral */: + case 141 /* FunctionExpression */: + case 172 /* FunctionDeclaration */: + case 142 /* ArrowFunction */: + case 133 /* ObjectLiteral */: return false; default: return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { - if (n.kind === 83 /* ThisKeyword */) { + if (n.kind === 87 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 136 /* FunctionExpression */ && n.kind !== 167 /* FunctionDeclaration */) { + else if (n.kind !== 141 /* FunctionExpression */ && n.kind !== 172 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 115 /* Property */ && !(n.flags & 64 /* Static */) && !!n.initializer; + return n.kind === 119 /* Property */ && !(n.flags & 128 /* Static */) && !!n.initializer; } if (node.parent.baseType) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 146 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 151 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -12508,16 +12909,15 @@ var ts; } function checkAccessorDeclaration(node) { if (fullTypeCheck) { - if (node.kind === 118 /* GetAccessor */) { + if (node.kind === 122 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && node.body && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } - var otherKind = node.kind === 118 /* GetAccessor */ ? 119 /* SetAccessor */ : 118 /* GetAccessor */; + var otherKind = node.kind === 122 /* GetAccessor */ ? 123 /* SetAccessor */ : 122 /* GetAccessor */; var otherAccessor = getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - var visibilityFlags = 32 /* Private */ | 16 /* Public */; - if (((node.flags & visibilityFlags) !== (otherAccessor.flags & visibilityFlags))) { + if (((node.flags & ts.NodeFlags.AccessibilityModifier) !== (otherAccessor.flags & ts.NodeFlags.AccessibilityModifier))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } var thisType = getAnnotatedAccessorType(node); @@ -12558,7 +12958,10 @@ var ts; } } function checkArrayType(node) { - getTypeFromArrayTypeNode(node); + checkSourceElement(node.elementType); + } + function checkTupleType(node) { + ts.forEach(node.elementTypes, checkSourceElement); } function isPrivateWithinAmbient(node) { return (node.flags & 32 /* Private */) && ts.isInAmbientContext(node); @@ -12577,9 +12980,9 @@ var ts; } var symbol = getSymbolOfNode(signatureDeclarationNode); var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 170 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 120 /* CallSignature */ || signatureDeclarationNode.kind === 121 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 120 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 175 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 124 /* CallSignature */ || signatureDeclarationNode.kind === 125 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 124 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -12597,7 +13000,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = n.flags; - if (n.parent.kind !== 170 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 175 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { flags |= 1 /* Export */; } @@ -12622,8 +13025,8 @@ var ts; else if (deviation & 2 /* Ambient */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & 32 /* Private */) { - error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_or_private); + else if (deviation & (32 /* Private */ | 64 /* Protected */)) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } else if (deviation & 4 /* QuestionMark */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); @@ -12631,7 +13034,7 @@ var ts; }); } } - var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 32 /* Private */ | 4 /* QuestionMark */; + var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 32 /* Private */ | 64 /* Protected */ | 4 /* QuestionMark */; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var hasOverloads = false; @@ -12654,9 +13057,9 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 116 /* Method */); - ts.Debug.assert((node.flags & 64 /* Static */) !== (subsequentNode.flags & 64 /* Static */)); - var diagnostic = node.flags & 64 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + ts.Debug.assert(node.kind === 120 /* Method */); + ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); + var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode, diagnostic); return; } @@ -12678,11 +13081,11 @@ var ts; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 170 /* InterfaceDeclaration */ || node.parent.kind === 125 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 175 /* InterfaceDeclaration */ || node.parent.kind === 129 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 167 /* FunctionDeclaration */ || node.kind === 116 /* Method */ || node.kind === 117 /* Constructor */) { + if (node.kind === 172 /* FunctionDeclaration */ || node.kind === 120 /* Method */ || node.kind === 121 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -12766,14 +13169,14 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: return 1048576 /* ExportType */; - case 172 /* ModuleDeclaration */: - return d.name.kind === 3 /* StringLiteral */ || ts.isInstantiated(d) ? 2097152 /* ExportNamespace */ | 524288 /* ExportValue */ : 2097152 /* ExportNamespace */; - case 169 /* ClassDeclaration */: - case 171 /* EnumDeclaration */: + case 177 /* ModuleDeclaration */: + return d.name.kind === 7 /* StringLiteral */ || ts.isInstantiated(d) ? 2097152 /* ExportNamespace */ | 524288 /* ExportValue */ : 2097152 /* ExportNamespace */; + case 174 /* ClassDeclaration */: + case 176 /* EnumDeclaration */: return 1048576 /* ExportType */ | 524288 /* ExportValue */; - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: var result = 0; var target = resolveImport(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { @@ -12831,7 +13234,7 @@ var ts; if (!(name && name.text === "_i")) { return; } - if (node.kind === 114 /* Parameter */) { + if (node.kind === 118 /* Parameter */) { if (node.parent.body && ts.hasRestParameters(node.parent) && !ts.isInAmbientContext(node)) { error(node, ts.Diagnostics.Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter); } @@ -12848,11 +13251,11 @@ var ts; return; } switch (current.kind) { - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 116 /* Method */: - case 137 /* ArrowFunction */: - case 117 /* Constructor */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 120 /* Method */: + case 142 /* ArrowFunction */: + case 121 /* Constructor */: if (ts.hasRestParameters(current)) { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter); return; @@ -12866,13 +13269,13 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 115 /* Property */ || node.kind === 116 /* Method */ || node.kind === 118 /* GetAccessor */ || node.kind === 119 /* SetAccessor */) { + if (node.kind === 119 /* Property */ || node.kind === 120 /* Method */ || node.kind === 122 /* GetAccessor */ || node.kind === 123 /* SetAccessor */) { return false; } if (ts.isInAmbientContext(node)) { return false; } - if (node.kind === 114 /* Parameter */ && !node.parent.body) { + if (node.kind === 118 /* Parameter */ && !node.parent.body) { return false; } return true; @@ -12887,7 +13290,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration = node.kind !== 55 /* Identifier */; + var isDeclaration = node.kind !== 59 /* Identifier */; if (isDeclaration) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -12903,12 +13306,12 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = getAncestor(node, 169 /* ClassDeclaration */); + var enclosingClass = ts.getAncestor(node, 174 /* ClassDeclaration */); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } if (enclosingClass.baseType) { - var isDeclaration = node.kind !== 55 /* Identifier */; + var isDeclaration = node.kind !== 59 /* Identifier */; if (isDeclaration) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -12921,11 +13324,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 172 /* ModuleDeclaration */ && !ts.isInstantiated(node)) { + if (node.kind === 177 /* ModuleDeclaration */ && !ts.isInstantiated(node)) { return; } - var parent = node.kind === 166 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (parent.kind === 177 /* SourceFile */ && ts.isExternalModule(parent)) { + var parent = node.kind === 171 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (parent.kind === 182 /* SourceFile */ && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, name.text, name.text); } } @@ -13012,30 +13415,22 @@ var ts; } function checkBreakOrContinueStatement(node) { } - function getContainingFunction(node) { - while (true) { - node = node.parent; - if (!node || node.kind === 167 /* FunctionDeclaration */ || node.kind === 136 /* FunctionExpression */ || node.kind === 137 /* ArrowFunction */ || node.kind === 116 /* Method */ || node.kind === 117 /* Constructor */ || node.kind === 118 /* GetAccessor */ || node.kind === 119 /* SetAccessor */) { - return node; - } - } - } function checkReturnStatement(node) { if (node.expression && !(getNodeLinks(node.expression).flags & 1 /* TypeChecked */)) { - var func = getContainingFunction(node); + var func = ts.getContainingFunction(node); if (func) { - if (func.kind === 119 /* SetAccessor */) { + if (func.kind === 123 /* SetAccessor */) { if (node.expression) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } } else { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); - var checkAssignability = func.type || (func.kind === 118 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 119 /* SetAccessor */))); + var checkAssignability = func.type || (func.kind === 122 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 123 /* SetAccessor */))); if (checkAssignability) { checkTypeAssignableTo(checkExpression(node.expression), returnType, node.expression, undefined, undefined); } - else if (func.kind == 117 /* Constructor */) { + else if (func.kind == 121 /* Constructor */) { if (!isTypeAssignableTo(checkExpression(node.expression), returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -13060,7 +13455,7 @@ var ts; checkBlock(clause); }); } - function checkLabelledStatement(node) { + function checkLabeledStatement(node) { checkSourceElement(node.statement); } function checkThrowStatement(node) { @@ -13211,7 +13606,7 @@ var ts; if ((baseDeclarationFlags & 32 /* Private */) || (derivedDeclarationFlags & 32 /* Private */)) { continue; } - if ((baseDeclarationFlags & 64 /* Static */) !== (derivedDeclarationFlags & 64 /* Static */)) { + if ((baseDeclarationFlags & 128 /* Static */) !== (derivedDeclarationFlags & 128 /* Static */)) { continue; } if ((base.flags & derived.flags & 2048 /* Method */) || ((base.flags & ts.SymbolFlags.PropertyOrAccessor) && (derived.flags & ts.SymbolFlags.PropertyOrAccessor))) { @@ -13241,7 +13636,7 @@ var ts; } } function isAccessor(kind) { - return kind === 118 /* GetAccessor */ || kind === 119 /* SetAccessor */; + return kind === 122 /* GetAccessor */ || kind === 123 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -13274,7 +13669,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = getDeclarationOfKind(symbol, 170 /* InterfaceDeclaration */); + var firstInterfaceDecl = getDeclarationOfKind(symbol, 175 /* InterfaceDeclaration */); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -13298,14 +13693,14 @@ var ts; } function getConstantValue(node) { var isNegative = false; - if (node.kind === 138 /* PrefixOperator */) { + if (node.kind === 143 /* PrefixOperator */) { var unaryExpression = node; - if (unaryExpression.operator === 25 /* MinusToken */ || unaryExpression.operator === 24 /* PlusToken */) { + if (unaryExpression.operator === 29 /* MinusToken */ || unaryExpression.operator === 28 /* PlusToken */) { node = unaryExpression.operand; - isNegative = unaryExpression.operator === 25 /* MinusToken */; + isNegative = unaryExpression.operator === 29 /* MinusToken */; } } - if (node.kind === 2 /* NumericLiteral */) { + if (node.kind === 6 /* NumericLiteral */) { var literalText = node.text; return isNegative ? -literalText : +literalText; } @@ -13342,7 +13737,7 @@ var ts; if (node === firstDeclaration) { var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 171 /* EnumDeclaration */) { + if (declaration.kind !== 176 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -13365,7 +13760,7 @@ var ts; var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; - if ((declaration.kind === 169 /* ClassDeclaration */ || (declaration.kind === 167 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 174 /* ClassDeclaration */ || (declaration.kind === 172 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -13388,7 +13783,7 @@ var ts; } } } - if (node.name.kind === 3 /* StringLiteral */) { + if (node.name.kind === 7 /* StringLiteral */) { if (!isGlobalSourceFile(node.parent)) { error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); } @@ -13400,7 +13795,7 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 112 /* QualifiedName */) { + while (node.kind === 116 /* QualifiedName */) { node = node.left; } return node; @@ -13428,10 +13823,10 @@ var ts; } } else { - if (node.parent.kind === 177 /* SourceFile */) { + if (node.parent.kind === 182 /* SourceFile */) { target = resolveImport(symbol); } - else if (node.parent.kind === 173 /* ModuleBlock */ && node.parent.parent.name.kind === 3 /* StringLiteral */) { + else if (node.parent.kind === 178 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { if (isExternalModuleNameRelative(node.externalModuleName.text)) { error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); target = unknownSymbol; @@ -13453,7 +13848,7 @@ var ts; } function checkExportAssignment(node) { var container = node.parent; - if (container.kind !== 177 /* SourceFile */) { + if (container.kind !== 182 /* SourceFile */) { container = container.parent; } checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); @@ -13462,142 +13857,144 @@ var ts; if (!node) return; switch (node.kind) { - case 113 /* TypeParameter */: + case 117 /* TypeParameter */: return checkTypeParameter(node); - case 114 /* Parameter */: + case 118 /* Parameter */: return checkParameter(node); - case 115 /* Property */: + case 119 /* Property */: return checkPropertyDeclaration(node); - case 120 /* CallSignature */: - case 121 /* ConstructSignature */: - case 122 /* IndexSignature */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + case 126 /* IndexSignature */: return checkSignatureDeclaration(node); - case 116 /* Method */: + case 120 /* Method */: return checkMethodDeclaration(node); - case 117 /* Constructor */: + case 121 /* Constructor */: return checkConstructorDeclaration(node); - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: return checkAccessorDeclaration(node); - case 123 /* TypeReference */: + case 127 /* TypeReference */: return checkTypeReference(node); - case 124 /* TypeQuery */: + case 128 /* TypeQuery */: return checkTypeQuery(node); - case 125 /* TypeLiteral */: + case 129 /* TypeLiteral */: return checkTypeLiteral(node); - case 126 /* ArrayType */: + case 130 /* ArrayType */: return checkArrayType(node); - case 167 /* FunctionDeclaration */: + case 131 /* TupleType */: + return checkTupleType(node); + case 172 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 143 /* Block */: + case 148 /* Block */: return checkBlock(node); - case 168 /* FunctionBlock */: - case 173 /* ModuleBlock */: + case 173 /* FunctionBlock */: + case 178 /* ModuleBlock */: return checkBody(node); - case 144 /* VariableStatement */: + case 149 /* VariableStatement */: return checkVariableStatement(node); - case 146 /* ExpressionStatement */: + case 151 /* ExpressionStatement */: return checkExpressionStatement(node); - case 147 /* IfStatement */: + case 152 /* IfStatement */: return checkIfStatement(node); - case 148 /* DoStatement */: + case 153 /* DoStatement */: return checkDoStatement(node); - case 149 /* WhileStatement */: + case 154 /* WhileStatement */: return checkWhileStatement(node); - case 150 /* ForStatement */: + case 155 /* ForStatement */: return checkForStatement(node); - case 151 /* ForInStatement */: + case 156 /* ForInStatement */: return checkForInStatement(node); - case 152 /* ContinueStatement */: - case 153 /* BreakStatement */: + case 157 /* ContinueStatement */: + case 158 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 154 /* ReturnStatement */: + case 159 /* ReturnStatement */: return checkReturnStatement(node); - case 155 /* WithStatement */: + case 160 /* WithStatement */: return checkWithStatement(node); - case 156 /* SwitchStatement */: + case 161 /* SwitchStatement */: return checkSwitchStatement(node); - case 159 /* LabelledStatement */: - return checkLabelledStatement(node); - case 160 /* ThrowStatement */: + case 164 /* LabeledStatement */: + return checkLabeledStatement(node); + case 165 /* ThrowStatement */: return checkThrowStatement(node); - case 161 /* TryStatement */: + case 166 /* TryStatement */: return checkTryStatement(node); - case 166 /* VariableDeclaration */: + case 171 /* VariableDeclaration */: return ts.Debug.fail("Checker encountered variable declaration"); - case 169 /* ClassDeclaration */: + case 174 /* ClassDeclaration */: return checkClassDeclaration(node); - case 170 /* InterfaceDeclaration */: + case 175 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: return checkImportDeclaration(node); - case 175 /* ExportAssignment */: + case 180 /* ExportAssignment */: return checkExportAssignment(node); } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionBody(node); break; - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 167 /* FunctionDeclaration */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 172 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 155 /* WithStatement */: + case 160 /* WithStatement */: checkFunctionExpressionBodies(node.expression); break; - case 114 /* Parameter */: - case 115 /* Property */: - case 127 /* ArrayLiteral */: - case 128 /* ObjectLiteral */: - case 129 /* PropertyAssignment */: - case 130 /* PropertyAccess */: - case 131 /* IndexedAccess */: - case 132 /* CallExpression */: - case 133 /* NewExpression */: - case 134 /* TypeAssertion */: - case 135 /* ParenExpression */: - case 138 /* PrefixOperator */: - case 139 /* PostfixOperator */: - case 140 /* BinaryExpression */: - case 141 /* ConditionalExpression */: - case 143 /* Block */: - case 168 /* FunctionBlock */: - case 173 /* ModuleBlock */: - case 144 /* VariableStatement */: - case 146 /* ExpressionStatement */: - case 147 /* IfStatement */: - case 148 /* DoStatement */: - case 149 /* WhileStatement */: - case 150 /* ForStatement */: - case 151 /* ForInStatement */: - case 152 /* ContinueStatement */: - case 153 /* BreakStatement */: - case 154 /* ReturnStatement */: - case 156 /* SwitchStatement */: - case 157 /* CaseClause */: - case 158 /* DefaultClause */: - case 159 /* LabelledStatement */: - case 160 /* ThrowStatement */: - case 161 /* TryStatement */: - case 162 /* TryBlock */: - case 163 /* CatchBlock */: - case 164 /* FinallyBlock */: - case 166 /* VariableDeclaration */: - case 169 /* ClassDeclaration */: - case 171 /* EnumDeclaration */: - case 176 /* EnumMember */: - case 177 /* SourceFile */: + case 118 /* Parameter */: + case 119 /* Property */: + case 132 /* ArrayLiteral */: + case 133 /* ObjectLiteral */: + case 134 /* PropertyAssignment */: + case 135 /* PropertyAccess */: + case 136 /* IndexedAccess */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: + case 139 /* TypeAssertion */: + case 140 /* ParenExpression */: + case 143 /* PrefixOperator */: + case 144 /* PostfixOperator */: + case 145 /* BinaryExpression */: + case 146 /* ConditionalExpression */: + case 148 /* Block */: + case 173 /* FunctionBlock */: + case 178 /* ModuleBlock */: + case 149 /* VariableStatement */: + case 151 /* ExpressionStatement */: + case 152 /* IfStatement */: + case 153 /* DoStatement */: + case 154 /* WhileStatement */: + case 155 /* ForStatement */: + case 156 /* ForInStatement */: + case 157 /* ContinueStatement */: + case 158 /* BreakStatement */: + case 159 /* ReturnStatement */: + case 161 /* SwitchStatement */: + case 162 /* CaseClause */: + case 163 /* DefaultClause */: + case 164 /* LabeledStatement */: + case 165 /* ThrowStatement */: + case 166 /* TryStatement */: + case 167 /* TryBlock */: + case 168 /* CatchBlock */: + case 169 /* FinallyBlock */: + case 171 /* VariableDeclaration */: + case 174 /* ClassDeclaration */: + case 176 /* EnumDeclaration */: + case 181 /* EnumMember */: + case 182 /* SourceFile */: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -13665,6 +14062,17 @@ var ts; position = sourceFile.end; return findChildAtPosition(sourceFile); } + function isInsideWithStatementBody(node) { + if (node) { + while (node.parent) { + if (node.parent.kind === 160 /* WithStatement */ && node.parent.statement === node) { + return true; + } + node = node.parent; + } + } + return false; + } function getSymbolsInScope(location, meaning) { var symbols = {}; var memberFlags = 0; @@ -13685,32 +14093,35 @@ var ts; } } } + if (isInsideWithStatementBody(location)) { + return []; + } while (location) { if (location.locals && !isGlobalSourceFile(location)) { copySymbols(location.locals, meaning); } switch (location.kind) { - case 177 /* SourceFile */: + case 182 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 172 /* ModuleDeclaration */: + case 177 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & ts.SymbolFlags.ModuleMember); break; - case 171 /* EnumDeclaration */: + case 176 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 4 /* EnumMember */); break; - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - if (!(memberFlags & 64 /* Static */)) { + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & ts.SymbolFlags.Type); } break; - case 136 /* FunctionExpression */: + case 141 /* FunctionExpression */: if (location.name) { copySymbol(location.symbol, meaning); } break; - case 163 /* CatchBlock */: + case 168 /* CatchBlock */: if (location.variable.text) { copySymbol(location.symbol, meaning); } @@ -13723,81 +14134,81 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 55 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 59 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 113 /* TypeParameter */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 171 /* EnumDeclaration */: + case 117 /* TypeParameter */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 112 /* QualifiedName */) + while (node.parent && node.parent.kind === 116 /* QualifiedName */) node = node.parent; - return node.parent && node.parent.kind === 123 /* TypeReference */; + return node.parent && node.parent.kind === 127 /* TypeReference */; } function isExpression(node) { switch (node.kind) { - case 83 /* ThisKeyword */: - case 81 /* SuperKeyword */: - case 79 /* NullKeyword */: - case 85 /* TrueKeyword */: - case 70 /* FalseKeyword */: - case 4 /* RegularExpressionLiteral */: - case 127 /* ArrayLiteral */: - case 128 /* ObjectLiteral */: - case 130 /* PropertyAccess */: - case 131 /* IndexedAccess */: - case 132 /* CallExpression */: - case 133 /* NewExpression */: - case 134 /* TypeAssertion */: - case 135 /* ParenExpression */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: - case 138 /* PrefixOperator */: - case 139 /* PostfixOperator */: - case 140 /* BinaryExpression */: - case 141 /* ConditionalExpression */: - case 142 /* OmittedExpression */: + case 87 /* ThisKeyword */: + case 85 /* SuperKeyword */: + case 83 /* NullKeyword */: + case 89 /* TrueKeyword */: + case 74 /* FalseKeyword */: + case 8 /* RegularExpressionLiteral */: + case 132 /* ArrayLiteral */: + case 133 /* ObjectLiteral */: + case 135 /* PropertyAccess */: + case 136 /* IndexedAccess */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: + case 139 /* TypeAssertion */: + case 140 /* ParenExpression */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: + case 143 /* PrefixOperator */: + case 144 /* PostfixOperator */: + case 145 /* BinaryExpression */: + case 146 /* ConditionalExpression */: + case 147 /* OmittedExpression */: return true; - case 112 /* QualifiedName */: - while (node.parent.kind === 112 /* QualifiedName */) + case 116 /* QualifiedName */: + while (node.parent.kind === 116 /* QualifiedName */) node = node.parent; - return node.parent.kind === 124 /* TypeQuery */; - case 55 /* Identifier */: - if (node.parent.kind === 124 /* TypeQuery */) { + return node.parent.kind === 128 /* TypeQuery */; + case 59 /* Identifier */: + if (node.parent.kind === 128 /* TypeQuery */) { return true; } - case 2 /* NumericLiteral */: - case 3 /* StringLiteral */: + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: var parent = node.parent; switch (parent.kind) { - case 166 /* VariableDeclaration */: - case 114 /* Parameter */: - case 115 /* Property */: - case 176 /* EnumMember */: - case 129 /* PropertyAssignment */: + case 171 /* VariableDeclaration */: + case 118 /* Parameter */: + case 119 /* Property */: + case 181 /* EnumMember */: + case 134 /* PropertyAssignment */: return parent.initializer === node; - case 146 /* ExpressionStatement */: - case 147 /* IfStatement */: - case 148 /* DoStatement */: - case 149 /* WhileStatement */: - case 154 /* ReturnStatement */: - case 155 /* WithStatement */: - case 156 /* SwitchStatement */: - case 157 /* CaseClause */: - case 160 /* ThrowStatement */: - case 156 /* SwitchStatement */: + case 151 /* ExpressionStatement */: + case 152 /* IfStatement */: + case 153 /* DoStatement */: + case 154 /* WhileStatement */: + case 159 /* ReturnStatement */: + case 160 /* WithStatement */: + case 161 /* SwitchStatement */: + case 162 /* CaseClause */: + case 165 /* ThrowStatement */: + case 161 /* SwitchStatement */: return parent.expression === node; - case 150 /* ForStatement */: + case 155 /* ForStatement */: return parent.initializer === node || parent.condition === node || parent.iterator === node; - case 151 /* ForInStatement */: + case 156 /* ForInStatement */: return parent.variable === node || parent.expression === node; - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return node === parent.operand; default: if (isExpression(parent)) { @@ -13812,75 +14223,75 @@ var ts; return true; } switch (node.kind) { - case 101 /* AnyKeyword */: - case 108 /* NumberKeyword */: - case 110 /* StringKeyword */: - case 102 /* BooleanKeyword */: + case 105 /* AnyKeyword */: + case 112 /* NumberKeyword */: + case 114 /* StringKeyword */: + case 106 /* BooleanKeyword */: return true; - case 89 /* VoidKeyword */: - return node.parent.kind !== 138 /* PrefixOperator */; - case 3 /* StringLiteral */: - return node.parent.kind === 114 /* Parameter */; - case 55 /* Identifier */: - if (node.parent.kind === 112 /* QualifiedName */) { + case 93 /* VoidKeyword */: + return node.parent.kind !== 143 /* PrefixOperator */; + case 7 /* StringLiteral */: + return node.parent.kind === 118 /* Parameter */; + case 59 /* Identifier */: + if (node.parent.kind === 116 /* QualifiedName */) { node = node.parent; } - case 112 /* QualifiedName */: + case 116 /* QualifiedName */: var parent = node.parent; - if (parent.kind === 124 /* TypeQuery */) { + if (parent.kind === 128 /* TypeQuery */) { return false; } if (parent.kind >= ts.SyntaxKind.FirstTypeNode && parent.kind <= ts.SyntaxKind.LastTypeNode) { return true; } switch (parent.kind) { - case 113 /* TypeParameter */: + case 117 /* TypeParameter */: return node === parent.constraint; - case 115 /* Property */: - case 114 /* Parameter */: - case 166 /* VariableDeclaration */: + case 119 /* Property */: + case 118 /* Parameter */: + case 171 /* VariableDeclaration */: return node === parent.type; - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: - case 117 /* Constructor */: - case 116 /* Method */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: + case 121 /* Constructor */: + case 120 /* Method */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: return node === parent.type; - case 120 /* CallSignature */: - case 121 /* ConstructSignature */: - case 122 /* IndexSignature */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + case 126 /* IndexSignature */: return node === parent.type; - case 134 /* TypeAssertion */: + case 139 /* TypeAssertion */: return node === parent.type; - case 132 /* CallExpression */: - case 133 /* NewExpression */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: return parent.typeArguments.indexOf(node) >= 0; } } return false; } function isInRightSideOfImportOrExportAssignment(node) { - while (node.parent.kind === 112 /* QualifiedName */) { + while (node.parent.kind === 116 /* QualifiedName */) { node = node.parent; } - if (node.parent.kind === 174 /* ImportDeclaration */) { + if (node.parent.kind === 179 /* ImportDeclaration */) { return node.parent.entityName === node; } - if (node.parent.kind === 175 /* ExportAssignment */) { + if (node.parent.kind === 180 /* ExportAssignment */) { return node.parent.exportName === node; } return false; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 112 /* QualifiedName */ || node.parent.kind === 130 /* PropertyAccess */) && node.parent.right === node; + return (node.parent.kind === 116 /* QualifiedName */ || node.parent.kind === 135 /* PropertyAccess */) && node.parent.right === node; } function getSymbolOfEntityName(entityName) { if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 175 /* ExportAssignment */) { + if (entityName.parent.kind === 180 /* ExportAssignment */) { return resolveEntityName(entityName.parent.parent, entityName, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace | 4194304 /* Import */); } if (isInRightSideOfImportOrExportAssignment(entityName)) { @@ -13890,11 +14301,11 @@ var ts; entityName = entityName.parent; } if (isExpression(entityName)) { - if (entityName.kind === 55 /* Identifier */) { + if (entityName.kind === 59 /* Identifier */) { var meaning = ts.SymbolFlags.Value | 4194304 /* Import */; return resolveEntityName(entityName, entityName, meaning); } - else if (entityName.kind === 112 /* QualifiedName */ || entityName.kind === 130 /* PropertyAccess */) { + else if (entityName.kind === 116 /* QualifiedName */ || entityName.kind === 135 /* PropertyAccess */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccess(entityName); @@ -13906,42 +14317,45 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 123 /* TypeReference */ ? ts.SymbolFlags.Type : ts.SymbolFlags.Namespace; + var meaning = entityName.parent.kind === 127 /* TypeReference */ ? ts.SymbolFlags.Type : ts.SymbolFlags.Namespace; meaning |= 4194304 /* Import */; return resolveEntityName(entityName, entityName, meaning); } return undefined; } function getSymbolInfo(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { return getSymbolOfNode(node.parent); } - if (node.kind === 55 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 175 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); + if (node.kind === 59 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 180 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); } switch (node.kind) { - case 55 /* Identifier */: - case 130 /* PropertyAccess */: - case 112 /* QualifiedName */: + case 59 /* Identifier */: + case 135 /* PropertyAccess */: + case 116 /* QualifiedName */: return getSymbolOfEntityName(node); - case 83 /* ThisKeyword */: - case 81 /* SuperKeyword */: + case 87 /* ThisKeyword */: + case 85 /* SuperKeyword */: var type = checkExpression(node); return type.symbol; - case 103 /* ConstructorKeyword */: + case 107 /* ConstructorKeyword */: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 117 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 121 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; - case 3 /* StringLiteral */: - if (node.parent.kind === 174 /* ImportDeclaration */ && node.parent.externalModuleName === node) { + case 7 /* StringLiteral */: + if (node.parent.kind === 179 /* ImportDeclaration */ && node.parent.externalModuleName === node) { var importSymbol = getSymbolOfNode(node.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; } - case 2 /* NumericLiteral */: - if (node.parent.kind == 131 /* IndexedAccess */ && node.parent.index === node) { + case 6 /* NumericLiteral */: + if (node.parent.kind == 136 /* IndexedAccess */ && node.parent.index === node) { var objectType = checkExpression(node.parent.object); if (objectType === unknownType) return undefined; @@ -13955,6 +14369,9 @@ var ts; return undefined; } function getTypeOfNode(node) { + if (isInsideWithStatementBody(node)) { + return unknownType; + } if (isExpression(node)) { return getTypeOfExpression(node); } @@ -13967,7 +14384,7 @@ var ts; } if (isTypeDeclarationName(node)) { var symbol = getSymbolInfo(node); - return getDeclaredTypeOfSymbol(symbol); + return symbol && getDeclaredTypeOfSymbol(symbol); } if (ts.isDeclaration(node)) { var symbol = getSymbolOfNode(node); @@ -13975,11 +14392,11 @@ var ts; } if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { var symbol = getSymbolInfo(node); - return getTypeOfSymbol(symbol); + return symbol && getTypeOfSymbol(symbol); } if (isInRightSideOfImportOrExportAssignment(node)) { var symbol = getSymbolInfo(node); - var declaredType = getDeclaredTypeOfSymbol(symbol); + var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); } return unknownType; @@ -14021,10 +14438,10 @@ var ts; } } function getRootSymbol(symbol) { - return (symbol.flags & 33554432 /* Transient */) ? getSymbolLinks(symbol).target : symbol; + return ((symbol.flags & 33554432 /* Transient */) && getSymbolLinks(symbol).target) || symbol; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 128 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 177 /* SourceFile */; + return symbol.flags & 128 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 182 /* SourceFile */; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -14057,7 +14474,7 @@ var ts; function getLocalNameForSymbol(symbol, location) { var node = location; while (node) { - if ((node.kind === 172 /* ModuleDeclaration */ || node.kind === 171 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { + if ((node.kind === 177 /* ModuleDeclaration */ || node.kind === 176 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { return getLocalNameOfContainer(node); } node = node.parent; @@ -14081,7 +14498,7 @@ var ts; if (symbol && (symbol.flags & 4 /* EnumMember */)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 176 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { + if (declaration.kind === 181 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { return constantValue.toString() + " /* " + ts.identifierToString(declaration.name) + " */"; } } @@ -14091,15 +14508,15 @@ var ts; return symbol && symbolIsValue(symbol) ? symbolToString(symbol) : undefined; } function isTopLevelValueImportedViaEntityName(node) { - if (node.parent.kind !== 177 /* SourceFile */ || !node.entityName) { + if (node.parent.kind !== 182 /* SourceFile */ || !node.entityName) { return false; } var symbol = getSymbolOfNode(node); var target = resolveImport(symbol); return target !== unknownSymbol && ((target.flags & ts.SymbolFlags.Value) !== 0); } - function shouldEmitDeclarations() { - return compilerOptions.declaration && !program.getDiagnostics().length && !getDiagnostics().length; + function hasSemanticErrors() { + return getDiagnostics().length > 0 || getGlobalDiagnostics().length > 0; } function isReferencedImportDeclaration(node) { var symbol = getSymbolOfNode(node); @@ -14137,7 +14554,7 @@ var ts; var signature = getSignatureFromDeclaration(signatureDeclaration); writeTypeToTextWriter(getReturnTypeOfSignature(signature), enclosingDeclaration, flags, writer); } - function invokeEmitter() { + function invokeEmitter(targetSourceFile) { var resolver = { getProgram: function () { return program; }, getLocalNameOfContainer: getLocalNameOfContainer, @@ -14148,7 +14565,7 @@ var ts; getNodeCheckFlags: getNodeCheckFlags, getEnumMemberValue: getEnumMemberValue, isTopLevelValueImportedViaEntityName: isTopLevelValueImportedViaEntityName, - shouldEmitDeclarations: shouldEmitDeclarations, + hasSemanticErrors: hasSemanticErrors, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, writeTypeAtLocation: writeTypeAtLocation, @@ -14158,7 +14575,7 @@ var ts; isImportDeclarationEntityNameReferenceDeclarationVisibile: isImportDeclarationEntityNameReferenceDeclarationVisibile }; checkProgram(); - return ts.emitFiles(resolver); + return ts.emitFiles(resolver, targetSourceFile); } function initializeTypeChecker() { ts.forEach(program.getSourceFiles(), function (file) { @@ -16242,125 +16659,126 @@ var TypeScript; SyntaxKind[SyntaxKind["ConstructorType"] = 125] = "ConstructorType"; SyntaxKind[SyntaxKind["GenericType"] = 126] = "GenericType"; SyntaxKind[SyntaxKind["TypeQuery"] = 127] = "TypeQuery"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 128] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 129] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 130] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 131] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 132] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 133] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 134] = "ExportAssignment"; - SyntaxKind[SyntaxKind["MemberFunctionDeclaration"] = 135] = "MemberFunctionDeclaration"; - SyntaxKind[SyntaxKind["MemberVariableDeclaration"] = 136] = "MemberVariableDeclaration"; - SyntaxKind[SyntaxKind["ConstructorDeclaration"] = 137] = "ConstructorDeclaration"; - SyntaxKind[SyntaxKind["IndexMemberDeclaration"] = 138] = "IndexMemberDeclaration"; - SyntaxKind[SyntaxKind["GetAccessor"] = 139] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 140] = "SetAccessor"; - SyntaxKind[SyntaxKind["PropertySignature"] = 141] = "PropertySignature"; - SyntaxKind[SyntaxKind["CallSignature"] = 142] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 143] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 144] = "IndexSignature"; - SyntaxKind[SyntaxKind["MethodSignature"] = 145] = "MethodSignature"; - SyntaxKind[SyntaxKind["Block"] = 146] = "Block"; - SyntaxKind[SyntaxKind["IfStatement"] = 147] = "IfStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 148] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 149] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 150] = "ReturnStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 151] = "SwitchStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 152] = "BreakStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 153] = "ContinueStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 154] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 155] = "ForInStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 156] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 157] = "ThrowStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 158] = "WhileStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 159] = "TryStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 160] = "LabeledStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 161] = "DoStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 162] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 163] = "WithStatement"; - SyntaxKind[SyntaxKind["PlusExpression"] = 164] = "PlusExpression"; - SyntaxKind[SyntaxKind["NegateExpression"] = 165] = "NegateExpression"; - SyntaxKind[SyntaxKind["BitwiseNotExpression"] = 166] = "BitwiseNotExpression"; - SyntaxKind[SyntaxKind["LogicalNotExpression"] = 167] = "LogicalNotExpression"; - SyntaxKind[SyntaxKind["PreIncrementExpression"] = 168] = "PreIncrementExpression"; - SyntaxKind[SyntaxKind["PreDecrementExpression"] = 169] = "PreDecrementExpression"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 170] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 171] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 172] = "VoidExpression"; - SyntaxKind[SyntaxKind["CommaExpression"] = 173] = "CommaExpression"; - SyntaxKind[SyntaxKind["AssignmentExpression"] = 174] = "AssignmentExpression"; - SyntaxKind[SyntaxKind["AddAssignmentExpression"] = 175] = "AddAssignmentExpression"; - SyntaxKind[SyntaxKind["SubtractAssignmentExpression"] = 176] = "SubtractAssignmentExpression"; - SyntaxKind[SyntaxKind["MultiplyAssignmentExpression"] = 177] = "MultiplyAssignmentExpression"; - SyntaxKind[SyntaxKind["DivideAssignmentExpression"] = 178] = "DivideAssignmentExpression"; - SyntaxKind[SyntaxKind["ModuloAssignmentExpression"] = 179] = "ModuloAssignmentExpression"; - SyntaxKind[SyntaxKind["AndAssignmentExpression"] = 180] = "AndAssignmentExpression"; - SyntaxKind[SyntaxKind["ExclusiveOrAssignmentExpression"] = 181] = "ExclusiveOrAssignmentExpression"; - SyntaxKind[SyntaxKind["OrAssignmentExpression"] = 182] = "OrAssignmentExpression"; - SyntaxKind[SyntaxKind["LeftShiftAssignmentExpression"] = 183] = "LeftShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["SignedRightShiftAssignmentExpression"] = 184] = "SignedRightShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["UnsignedRightShiftAssignmentExpression"] = 185] = "UnsignedRightShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 186] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["LogicalOrExpression"] = 187] = "LogicalOrExpression"; - SyntaxKind[SyntaxKind["LogicalAndExpression"] = 188] = "LogicalAndExpression"; - SyntaxKind[SyntaxKind["BitwiseOrExpression"] = 189] = "BitwiseOrExpression"; - SyntaxKind[SyntaxKind["BitwiseExclusiveOrExpression"] = 190] = "BitwiseExclusiveOrExpression"; - SyntaxKind[SyntaxKind["BitwiseAndExpression"] = 191] = "BitwiseAndExpression"; - SyntaxKind[SyntaxKind["EqualsWithTypeConversionExpression"] = 192] = "EqualsWithTypeConversionExpression"; - SyntaxKind[SyntaxKind["NotEqualsWithTypeConversionExpression"] = 193] = "NotEqualsWithTypeConversionExpression"; - SyntaxKind[SyntaxKind["EqualsExpression"] = 194] = "EqualsExpression"; - SyntaxKind[SyntaxKind["NotEqualsExpression"] = 195] = "NotEqualsExpression"; - SyntaxKind[SyntaxKind["LessThanExpression"] = 196] = "LessThanExpression"; - SyntaxKind[SyntaxKind["GreaterThanExpression"] = 197] = "GreaterThanExpression"; - SyntaxKind[SyntaxKind["LessThanOrEqualExpression"] = 198] = "LessThanOrEqualExpression"; - SyntaxKind[SyntaxKind["GreaterThanOrEqualExpression"] = 199] = "GreaterThanOrEqualExpression"; - SyntaxKind[SyntaxKind["InstanceOfExpression"] = 200] = "InstanceOfExpression"; - SyntaxKind[SyntaxKind["InExpression"] = 201] = "InExpression"; - SyntaxKind[SyntaxKind["LeftShiftExpression"] = 202] = "LeftShiftExpression"; - SyntaxKind[SyntaxKind["SignedRightShiftExpression"] = 203] = "SignedRightShiftExpression"; - SyntaxKind[SyntaxKind["UnsignedRightShiftExpression"] = 204] = "UnsignedRightShiftExpression"; - SyntaxKind[SyntaxKind["MultiplyExpression"] = 205] = "MultiplyExpression"; - SyntaxKind[SyntaxKind["DivideExpression"] = 206] = "DivideExpression"; - SyntaxKind[SyntaxKind["ModuloExpression"] = 207] = "ModuloExpression"; - SyntaxKind[SyntaxKind["AddExpression"] = 208] = "AddExpression"; - SyntaxKind[SyntaxKind["SubtractExpression"] = 209] = "SubtractExpression"; - SyntaxKind[SyntaxKind["PostIncrementExpression"] = 210] = "PostIncrementExpression"; - SyntaxKind[SyntaxKind["PostDecrementExpression"] = 211] = "PostDecrementExpression"; - SyntaxKind[SyntaxKind["MemberAccessExpression"] = 212] = "MemberAccessExpression"; - SyntaxKind[SyntaxKind["InvocationExpression"] = 213] = "InvocationExpression"; - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 214] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 215] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectCreationExpression"] = 216] = "ObjectCreationExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 217] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["ParenthesizedArrowFunctionExpression"] = 218] = "ParenthesizedArrowFunctionExpression"; - SyntaxKind[SyntaxKind["SimpleArrowFunctionExpression"] = 219] = "SimpleArrowFunctionExpression"; - SyntaxKind[SyntaxKind["CastExpression"] = 220] = "CastExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 221] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 222] = "FunctionExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 223] = "OmittedExpression"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 224] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarator"] = 225] = "VariableDeclarator"; - SyntaxKind[SyntaxKind["ArgumentList"] = 226] = "ArgumentList"; - SyntaxKind[SyntaxKind["ParameterList"] = 227] = "ParameterList"; - SyntaxKind[SyntaxKind["TypeArgumentList"] = 228] = "TypeArgumentList"; - SyntaxKind[SyntaxKind["TypeParameterList"] = 229] = "TypeParameterList"; - SyntaxKind[SyntaxKind["ExtendsHeritageClause"] = 230] = "ExtendsHeritageClause"; - SyntaxKind[SyntaxKind["ImplementsHeritageClause"] = 231] = "ImplementsHeritageClause"; - SyntaxKind[SyntaxKind["EqualsValueClause"] = 232] = "EqualsValueClause"; - SyntaxKind[SyntaxKind["CaseSwitchClause"] = 233] = "CaseSwitchClause"; - SyntaxKind[SyntaxKind["DefaultSwitchClause"] = 234] = "DefaultSwitchClause"; - SyntaxKind[SyntaxKind["ElseClause"] = 235] = "ElseClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 236] = "CatchClause"; - SyntaxKind[SyntaxKind["FinallyClause"] = 237] = "FinallyClause"; - SyntaxKind[SyntaxKind["TypeParameter"] = 238] = "TypeParameter"; - SyntaxKind[SyntaxKind["Constraint"] = 239] = "Constraint"; - SyntaxKind[SyntaxKind["SimplePropertyAssignment"] = 240] = "SimplePropertyAssignment"; - SyntaxKind[SyntaxKind["FunctionPropertyAssignment"] = 241] = "FunctionPropertyAssignment"; - SyntaxKind[SyntaxKind["Parameter"] = 242] = "Parameter"; - SyntaxKind[SyntaxKind["EnumElement"] = 243] = "EnumElement"; - SyntaxKind[SyntaxKind["TypeAnnotation"] = 244] = "TypeAnnotation"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 245] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 246] = "ModuleNameModuleReference"; + SyntaxKind[SyntaxKind["TupleType"] = 128] = "TupleType"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 129] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 130] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 131] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 132] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 133] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 134] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 135] = "ExportAssignment"; + SyntaxKind[SyntaxKind["MemberFunctionDeclaration"] = 136] = "MemberFunctionDeclaration"; + SyntaxKind[SyntaxKind["MemberVariableDeclaration"] = 137] = "MemberVariableDeclaration"; + SyntaxKind[SyntaxKind["ConstructorDeclaration"] = 138] = "ConstructorDeclaration"; + SyntaxKind[SyntaxKind["IndexMemberDeclaration"] = 139] = "IndexMemberDeclaration"; + SyntaxKind[SyntaxKind["GetAccessor"] = 140] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 141] = "SetAccessor"; + SyntaxKind[SyntaxKind["PropertySignature"] = 142] = "PropertySignature"; + SyntaxKind[SyntaxKind["CallSignature"] = 143] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 144] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 145] = "IndexSignature"; + SyntaxKind[SyntaxKind["MethodSignature"] = 146] = "MethodSignature"; + SyntaxKind[SyntaxKind["Block"] = 147] = "Block"; + SyntaxKind[SyntaxKind["IfStatement"] = 148] = "IfStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 149] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 150] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 151] = "ReturnStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 152] = "SwitchStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 153] = "BreakStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 154] = "ContinueStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 155] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 156] = "ForInStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 157] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 158] = "ThrowStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 159] = "WhileStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 160] = "TryStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 161] = "LabeledStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 162] = "DoStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 163] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 164] = "WithStatement"; + SyntaxKind[SyntaxKind["PlusExpression"] = 165] = "PlusExpression"; + SyntaxKind[SyntaxKind["NegateExpression"] = 166] = "NegateExpression"; + SyntaxKind[SyntaxKind["BitwiseNotExpression"] = 167] = "BitwiseNotExpression"; + SyntaxKind[SyntaxKind["LogicalNotExpression"] = 168] = "LogicalNotExpression"; + SyntaxKind[SyntaxKind["PreIncrementExpression"] = 169] = "PreIncrementExpression"; + SyntaxKind[SyntaxKind["PreDecrementExpression"] = 170] = "PreDecrementExpression"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 171] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 172] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 173] = "VoidExpression"; + SyntaxKind[SyntaxKind["CommaExpression"] = 174] = "CommaExpression"; + SyntaxKind[SyntaxKind["AssignmentExpression"] = 175] = "AssignmentExpression"; + SyntaxKind[SyntaxKind["AddAssignmentExpression"] = 176] = "AddAssignmentExpression"; + SyntaxKind[SyntaxKind["SubtractAssignmentExpression"] = 177] = "SubtractAssignmentExpression"; + SyntaxKind[SyntaxKind["MultiplyAssignmentExpression"] = 178] = "MultiplyAssignmentExpression"; + SyntaxKind[SyntaxKind["DivideAssignmentExpression"] = 179] = "DivideAssignmentExpression"; + SyntaxKind[SyntaxKind["ModuloAssignmentExpression"] = 180] = "ModuloAssignmentExpression"; + SyntaxKind[SyntaxKind["AndAssignmentExpression"] = 181] = "AndAssignmentExpression"; + SyntaxKind[SyntaxKind["ExclusiveOrAssignmentExpression"] = 182] = "ExclusiveOrAssignmentExpression"; + SyntaxKind[SyntaxKind["OrAssignmentExpression"] = 183] = "OrAssignmentExpression"; + SyntaxKind[SyntaxKind["LeftShiftAssignmentExpression"] = 184] = "LeftShiftAssignmentExpression"; + SyntaxKind[SyntaxKind["SignedRightShiftAssignmentExpression"] = 185] = "SignedRightShiftAssignmentExpression"; + SyntaxKind[SyntaxKind["UnsignedRightShiftAssignmentExpression"] = 186] = "UnsignedRightShiftAssignmentExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 187] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["LogicalOrExpression"] = 188] = "LogicalOrExpression"; + SyntaxKind[SyntaxKind["LogicalAndExpression"] = 189] = "LogicalAndExpression"; + SyntaxKind[SyntaxKind["BitwiseOrExpression"] = 190] = "BitwiseOrExpression"; + SyntaxKind[SyntaxKind["BitwiseExclusiveOrExpression"] = 191] = "BitwiseExclusiveOrExpression"; + SyntaxKind[SyntaxKind["BitwiseAndExpression"] = 192] = "BitwiseAndExpression"; + SyntaxKind[SyntaxKind["EqualsWithTypeConversionExpression"] = 193] = "EqualsWithTypeConversionExpression"; + SyntaxKind[SyntaxKind["NotEqualsWithTypeConversionExpression"] = 194] = "NotEqualsWithTypeConversionExpression"; + SyntaxKind[SyntaxKind["EqualsExpression"] = 195] = "EqualsExpression"; + SyntaxKind[SyntaxKind["NotEqualsExpression"] = 196] = "NotEqualsExpression"; + SyntaxKind[SyntaxKind["LessThanExpression"] = 197] = "LessThanExpression"; + SyntaxKind[SyntaxKind["GreaterThanExpression"] = 198] = "GreaterThanExpression"; + SyntaxKind[SyntaxKind["LessThanOrEqualExpression"] = 199] = "LessThanOrEqualExpression"; + SyntaxKind[SyntaxKind["GreaterThanOrEqualExpression"] = 200] = "GreaterThanOrEqualExpression"; + SyntaxKind[SyntaxKind["InstanceOfExpression"] = 201] = "InstanceOfExpression"; + SyntaxKind[SyntaxKind["InExpression"] = 202] = "InExpression"; + SyntaxKind[SyntaxKind["LeftShiftExpression"] = 203] = "LeftShiftExpression"; + SyntaxKind[SyntaxKind["SignedRightShiftExpression"] = 204] = "SignedRightShiftExpression"; + SyntaxKind[SyntaxKind["UnsignedRightShiftExpression"] = 205] = "UnsignedRightShiftExpression"; + SyntaxKind[SyntaxKind["MultiplyExpression"] = 206] = "MultiplyExpression"; + SyntaxKind[SyntaxKind["DivideExpression"] = 207] = "DivideExpression"; + SyntaxKind[SyntaxKind["ModuloExpression"] = 208] = "ModuloExpression"; + SyntaxKind[SyntaxKind["AddExpression"] = 209] = "AddExpression"; + SyntaxKind[SyntaxKind["SubtractExpression"] = 210] = "SubtractExpression"; + SyntaxKind[SyntaxKind["PostIncrementExpression"] = 211] = "PostIncrementExpression"; + SyntaxKind[SyntaxKind["PostDecrementExpression"] = 212] = "PostDecrementExpression"; + SyntaxKind[SyntaxKind["MemberAccessExpression"] = 213] = "MemberAccessExpression"; + SyntaxKind[SyntaxKind["InvocationExpression"] = 214] = "InvocationExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 215] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 216] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectCreationExpression"] = 217] = "ObjectCreationExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 218] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["ParenthesizedArrowFunctionExpression"] = 219] = "ParenthesizedArrowFunctionExpression"; + SyntaxKind[SyntaxKind["SimpleArrowFunctionExpression"] = 220] = "SimpleArrowFunctionExpression"; + SyntaxKind[SyntaxKind["CastExpression"] = 221] = "CastExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 222] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 223] = "FunctionExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 224] = "OmittedExpression"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 225] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarator"] = 226] = "VariableDeclarator"; + SyntaxKind[SyntaxKind["ArgumentList"] = 227] = "ArgumentList"; + SyntaxKind[SyntaxKind["ParameterList"] = 228] = "ParameterList"; + SyntaxKind[SyntaxKind["TypeArgumentList"] = 229] = "TypeArgumentList"; + SyntaxKind[SyntaxKind["TypeParameterList"] = 230] = "TypeParameterList"; + SyntaxKind[SyntaxKind["ExtendsHeritageClause"] = 231] = "ExtendsHeritageClause"; + SyntaxKind[SyntaxKind["ImplementsHeritageClause"] = 232] = "ImplementsHeritageClause"; + SyntaxKind[SyntaxKind["EqualsValueClause"] = 233] = "EqualsValueClause"; + SyntaxKind[SyntaxKind["CaseSwitchClause"] = 234] = "CaseSwitchClause"; + SyntaxKind[SyntaxKind["DefaultSwitchClause"] = 235] = "DefaultSwitchClause"; + SyntaxKind[SyntaxKind["ElseClause"] = 236] = "ElseClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 237] = "CatchClause"; + SyntaxKind[SyntaxKind["FinallyClause"] = 238] = "FinallyClause"; + SyntaxKind[SyntaxKind["TypeParameter"] = 239] = "TypeParameter"; + SyntaxKind[SyntaxKind["Constraint"] = 240] = "Constraint"; + SyntaxKind[SyntaxKind["SimplePropertyAssignment"] = 241] = "SimplePropertyAssignment"; + SyntaxKind[SyntaxKind["FunctionPropertyAssignment"] = 242] = "FunctionPropertyAssignment"; + SyntaxKind[SyntaxKind["Parameter"] = 243] = "Parameter"; + SyntaxKind[SyntaxKind["EnumElement"] = 244] = "EnumElement"; + SyntaxKind[SyntaxKind["TypeAnnotation"] = 245] = "TypeAnnotation"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 246] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 247] = "ModuleNameModuleReference"; SyntaxKind[SyntaxKind["FirstStandardKeyword"] = SyntaxKind.BreakKeyword] = "FirstStandardKeyword"; SyntaxKind[SyntaxKind["LastStandardKeyword"] = SyntaxKind.WithKeyword] = "LastStandardKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedKeyword"] = SyntaxKind.ClassKeyword] = "FirstFutureReservedKeyword"; @@ -16533,17 +16951,17 @@ var TypeScript; function getPrefixUnaryExpressionFromOperatorToken(tokenKind) { switch (tokenKind) { case 89 /* PlusToken */: - return 164 /* PlusExpression */; + return 165 /* PlusExpression */; case 90 /* MinusToken */: - return 165 /* NegateExpression */; + return 166 /* NegateExpression */; case 102 /* TildeToken */: - return 166 /* BitwiseNotExpression */; + return 167 /* BitwiseNotExpression */; case 101 /* ExclamationToken */: - return 167 /* LogicalNotExpression */; + return 168 /* LogicalNotExpression */; case 93 /* PlusPlusToken */: - return 168 /* PreIncrementExpression */; + return 169 /* PreIncrementExpression */; case 94 /* MinusMinusToken */: - return 169 /* PreDecrementExpression */; + return 170 /* PreDecrementExpression */; default: return 0 /* None */; } @@ -16552,9 +16970,9 @@ var TypeScript; function getPostfixUnaryExpressionFromOperatorToken(tokenKind) { switch (tokenKind) { case 93 /* PlusPlusToken */: - return 210 /* PostIncrementExpression */; + return 211 /* PostIncrementExpression */; case 94 /* MinusMinusToken */: - return 211 /* PostDecrementExpression */; + return 212 /* PostDecrementExpression */; default: return 0 /* None */; } @@ -16563,77 +16981,77 @@ var TypeScript; function getBinaryExpressionFromOperatorToken(tokenKind) { switch (tokenKind) { case 91 /* AsteriskToken */: - return 205 /* MultiplyExpression */; + return 206 /* MultiplyExpression */; case 118 /* SlashToken */: - return 206 /* DivideExpression */; + return 207 /* DivideExpression */; case 92 /* PercentToken */: - return 207 /* ModuloExpression */; + return 208 /* ModuloExpression */; case 89 /* PlusToken */: - return 208 /* AddExpression */; + return 209 /* AddExpression */; case 90 /* MinusToken */: - return 209 /* SubtractExpression */; + return 210 /* SubtractExpression */; case 95 /* LessThanLessThanToken */: - return 202 /* LeftShiftExpression */; + return 203 /* LeftShiftExpression */; case 96 /* GreaterThanGreaterThanToken */: - return 203 /* SignedRightShiftExpression */; + return 204 /* SignedRightShiftExpression */; case 97 /* GreaterThanGreaterThanGreaterThanToken */: - return 204 /* UnsignedRightShiftExpression */; + return 205 /* UnsignedRightShiftExpression */; case 80 /* LessThanToken */: - return 196 /* LessThanExpression */; + return 197 /* LessThanExpression */; case 81 /* GreaterThanToken */: - return 197 /* GreaterThanExpression */; + return 198 /* GreaterThanExpression */; case 82 /* LessThanEqualsToken */: - return 198 /* LessThanOrEqualExpression */; + return 199 /* LessThanOrEqualExpression */; case 83 /* GreaterThanEqualsToken */: - return 199 /* GreaterThanOrEqualExpression */; + return 200 /* GreaterThanOrEqualExpression */; case 30 /* InstanceOfKeyword */: - return 200 /* InstanceOfExpression */; + return 201 /* InstanceOfExpression */; case 29 /* InKeyword */: - return 201 /* InExpression */; + return 202 /* InExpression */; case 84 /* EqualsEqualsToken */: - return 192 /* EqualsWithTypeConversionExpression */; + return 193 /* EqualsWithTypeConversionExpression */; case 86 /* ExclamationEqualsToken */: - return 193 /* NotEqualsWithTypeConversionExpression */; + return 194 /* NotEqualsWithTypeConversionExpression */; case 87 /* EqualsEqualsEqualsToken */: - return 194 /* EqualsExpression */; + return 195 /* EqualsExpression */; case 88 /* ExclamationEqualsEqualsToken */: - return 195 /* NotEqualsExpression */; + return 196 /* NotEqualsExpression */; case 98 /* AmpersandToken */: - return 191 /* BitwiseAndExpression */; + return 192 /* BitwiseAndExpression */; case 100 /* CaretToken */: - return 190 /* BitwiseExclusiveOrExpression */; + return 191 /* BitwiseExclusiveOrExpression */; case 99 /* BarToken */: - return 189 /* BitwiseOrExpression */; + return 190 /* BitwiseOrExpression */; case 103 /* AmpersandAmpersandToken */: - return 188 /* LogicalAndExpression */; + return 189 /* LogicalAndExpression */; case 104 /* BarBarToken */: - return 187 /* LogicalOrExpression */; + return 188 /* LogicalOrExpression */; case 116 /* BarEqualsToken */: - return 182 /* OrAssignmentExpression */; + return 183 /* OrAssignmentExpression */; case 115 /* AmpersandEqualsToken */: - return 180 /* AndAssignmentExpression */; + return 181 /* AndAssignmentExpression */; case 117 /* CaretEqualsToken */: - return 181 /* ExclusiveOrAssignmentExpression */; + return 182 /* ExclusiveOrAssignmentExpression */; case 112 /* LessThanLessThanEqualsToken */: - return 183 /* LeftShiftAssignmentExpression */; + return 184 /* LeftShiftAssignmentExpression */; case 113 /* GreaterThanGreaterThanEqualsToken */: - return 184 /* SignedRightShiftAssignmentExpression */; + return 185 /* SignedRightShiftAssignmentExpression */; case 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - return 185 /* UnsignedRightShiftAssignmentExpression */; + return 186 /* UnsignedRightShiftAssignmentExpression */; case 108 /* PlusEqualsToken */: - return 175 /* AddAssignmentExpression */; + return 176 /* AddAssignmentExpression */; case 109 /* MinusEqualsToken */: - return 176 /* SubtractAssignmentExpression */; + return 177 /* SubtractAssignmentExpression */; case 110 /* AsteriskEqualsToken */: - return 177 /* MultiplyAssignmentExpression */; + return 178 /* MultiplyAssignmentExpression */; case 119 /* SlashEqualsToken */: - return 178 /* DivideAssignmentExpression */; + return 179 /* DivideAssignmentExpression */; case 111 /* PercentEqualsToken */: - return 179 /* ModuloAssignmentExpression */; + return 180 /* ModuloAssignmentExpression */; case 107 /* EqualsToken */: - return 174 /* AssignmentExpression */; + return 175 /* AssignmentExpression */; case 79 /* CommaToken */: - return 173 /* CommaExpression */; + return 174 /* CommaExpression */; default: return 0 /* None */; } @@ -16641,77 +17059,77 @@ var TypeScript; SyntaxFacts.getBinaryExpressionFromOperatorToken = getBinaryExpressionFromOperatorToken; function getOperatorTokenFromBinaryExpression(tokenKind) { switch (tokenKind) { - case 205 /* MultiplyExpression */: + case 206 /* MultiplyExpression */: return 91 /* AsteriskToken */; - case 206 /* DivideExpression */: + case 207 /* DivideExpression */: return 118 /* SlashToken */; - case 207 /* ModuloExpression */: + case 208 /* ModuloExpression */: return 92 /* PercentToken */; - case 208 /* AddExpression */: + case 209 /* AddExpression */: return 89 /* PlusToken */; - case 209 /* SubtractExpression */: + case 210 /* SubtractExpression */: return 90 /* MinusToken */; - case 202 /* LeftShiftExpression */: + case 203 /* LeftShiftExpression */: return 95 /* LessThanLessThanToken */; - case 203 /* SignedRightShiftExpression */: + case 204 /* SignedRightShiftExpression */: return 96 /* GreaterThanGreaterThanToken */; - case 204 /* UnsignedRightShiftExpression */: + case 205 /* UnsignedRightShiftExpression */: return 97 /* GreaterThanGreaterThanGreaterThanToken */; - case 196 /* LessThanExpression */: + case 197 /* LessThanExpression */: return 80 /* LessThanToken */; - case 197 /* GreaterThanExpression */: + case 198 /* GreaterThanExpression */: return 81 /* GreaterThanToken */; - case 198 /* LessThanOrEqualExpression */: + case 199 /* LessThanOrEqualExpression */: return 82 /* LessThanEqualsToken */; - case 199 /* GreaterThanOrEqualExpression */: + case 200 /* GreaterThanOrEqualExpression */: return 83 /* GreaterThanEqualsToken */; - case 200 /* InstanceOfExpression */: + case 201 /* InstanceOfExpression */: return 30 /* InstanceOfKeyword */; - case 201 /* InExpression */: + case 202 /* InExpression */: return 29 /* InKeyword */; - case 192 /* EqualsWithTypeConversionExpression */: + case 193 /* EqualsWithTypeConversionExpression */: return 84 /* EqualsEqualsToken */; - case 193 /* NotEqualsWithTypeConversionExpression */: + case 194 /* NotEqualsWithTypeConversionExpression */: return 86 /* ExclamationEqualsToken */; - case 194 /* EqualsExpression */: + case 195 /* EqualsExpression */: return 87 /* EqualsEqualsEqualsToken */; - case 195 /* NotEqualsExpression */: + case 196 /* NotEqualsExpression */: return 88 /* ExclamationEqualsEqualsToken */; - case 191 /* BitwiseAndExpression */: + case 192 /* BitwiseAndExpression */: return 98 /* AmpersandToken */; - case 190 /* BitwiseExclusiveOrExpression */: + case 191 /* BitwiseExclusiveOrExpression */: return 100 /* CaretToken */; - case 189 /* BitwiseOrExpression */: + case 190 /* BitwiseOrExpression */: return 99 /* BarToken */; - case 188 /* LogicalAndExpression */: + case 189 /* LogicalAndExpression */: return 103 /* AmpersandAmpersandToken */; - case 187 /* LogicalOrExpression */: + case 188 /* LogicalOrExpression */: return 104 /* BarBarToken */; - case 182 /* OrAssignmentExpression */: + case 183 /* OrAssignmentExpression */: return 116 /* BarEqualsToken */; - case 180 /* AndAssignmentExpression */: + case 181 /* AndAssignmentExpression */: return 115 /* AmpersandEqualsToken */; - case 181 /* ExclusiveOrAssignmentExpression */: + case 182 /* ExclusiveOrAssignmentExpression */: return 117 /* CaretEqualsToken */; - case 183 /* LeftShiftAssignmentExpression */: + case 184 /* LeftShiftAssignmentExpression */: return 112 /* LessThanLessThanEqualsToken */; - case 184 /* SignedRightShiftAssignmentExpression */: + case 185 /* SignedRightShiftAssignmentExpression */: return 113 /* GreaterThanGreaterThanEqualsToken */; - case 185 /* UnsignedRightShiftAssignmentExpression */: + case 186 /* UnsignedRightShiftAssignmentExpression */: return 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */; - case 175 /* AddAssignmentExpression */: + case 176 /* AddAssignmentExpression */: return 108 /* PlusEqualsToken */; - case 176 /* SubtractAssignmentExpression */: + case 177 /* SubtractAssignmentExpression */: return 109 /* MinusEqualsToken */; - case 177 /* MultiplyAssignmentExpression */: + case 178 /* MultiplyAssignmentExpression */: return 110 /* AsteriskEqualsToken */; - case 178 /* DivideAssignmentExpression */: + case 179 /* DivideAssignmentExpression */: return 119 /* SlashEqualsToken */; - case 179 /* ModuloAssignmentExpression */: + case 180 /* ModuloAssignmentExpression */: return 111 /* PercentEqualsToken */; - case 174 /* AssignmentExpression */: + case 175 /* AssignmentExpression */: return 107 /* EqualsToken */; - case 173 /* CommaExpression */: + case 174 /* CommaExpression */: return 79 /* CommaToken */; default: return 0 /* None */; @@ -18469,8 +18887,8 @@ var TypeScript; function isIntegerLiteral(expression) { if (expression) { switch (expression.kind()) { - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: + case 165 /* PlusExpression */: + case 166 /* NegateExpression */: expression = expression.operand; return TypeScript.isToken(expression) && TypeScript.IntegerUtilities.isInteger(expression.text()); case 13 /* NumericLiteral */: @@ -18939,7 +19357,7 @@ var TypeScript; var SyntaxFacts; (function (SyntaxFacts) { function isDirectivePrologueElement(node) { - if (node.kind() === 149 /* ExpressionStatement */) { + if (node.kind() === 150 /* ExpressionStatement */) { var expressionStatement = node; var expression = expressionStatement.expression; if (expression.kind() === 14 /* StringLiteral */) { @@ -18961,6 +19379,16 @@ var TypeScript; return tokenKind === 11 /* IdentifierName */ || SyntaxFacts.isAnyKeyword(tokenKind); } SyntaxFacts.isIdentifierNameOrAnyKeyword = isIdentifierNameOrAnyKeyword; + function isAccessibilityModifier(kind) { + switch (kind) { + case 57 /* PublicKeyword */: + case 55 /* PrivateKeyword */: + case 56 /* ProtectedKeyword */: + return true; + } + return false; + } + SyntaxFacts.isAccessibilityModifier = isAccessibilityModifier; })(SyntaxFacts = TypeScript.SyntaxFacts || (TypeScript.SyntaxFacts = {})); })(TypeScript || (TypeScript = {})); var TypeScript; @@ -19044,7 +19472,7 @@ var TypeScript; })(TypeScript || (TypeScript = {})); var TypeScript; (function (TypeScript) { - TypeScript.nodeMetadata = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], ["moduleElements", "endOfFileToken"], ["left", "dotToken", "right"], ["openBraceToken", "typeMembers", "closeBraceToken"], ["typeParameterList", "parameterList", "equalsGreaterThanToken", "type"], ["type", "openBracketToken", "closeBracketToken"], ["newKeyword", "typeParameterList", "parameterList", "equalsGreaterThanToken", "type"], ["name", "typeArgumentList"], ["typeOfKeyword", "name"], ["modifiers", "interfaceKeyword", "identifier", "typeParameterList", "heritageClauses", "body"], ["modifiers", "functionKeyword", "identifier", "callSignature", "block", "semicolonToken"], ["modifiers", "moduleKeyword", "name", "stringLiteral", "openBraceToken", "moduleElements", "closeBraceToken"], ["modifiers", "classKeyword", "identifier", "typeParameterList", "heritageClauses", "openBraceToken", "classElements", "closeBraceToken"], ["modifiers", "enumKeyword", "identifier", "openBraceToken", "enumElements", "closeBraceToken"], ["modifiers", "importKeyword", "identifier", "equalsToken", "moduleReference", "semicolonToken"], ["exportKeyword", "equalsToken", "identifier", "semicolonToken"], ["modifiers", "propertyName", "callSignature", "block", "semicolonToken"], ["modifiers", "variableDeclarator", "semicolonToken"], ["modifiers", "constructorKeyword", "callSignature", "block", "semicolonToken"], ["modifiers", "indexSignature", "semicolonToken"], ["modifiers", "getKeyword", "propertyName", "callSignature", "block"], ["modifiers", "setKeyword", "propertyName", "callSignature", "block"], ["propertyName", "questionToken", "typeAnnotation"], ["typeParameterList", "parameterList", "typeAnnotation"], ["newKeyword", "callSignature"], ["openBracketToken", "parameters", "closeBracketToken", "typeAnnotation"], ["propertyName", "questionToken", "callSignature"], ["openBraceToken", "statements", "closeBraceToken"], ["ifKeyword", "openParenToken", "condition", "closeParenToken", "statement", "elseClause"], ["modifiers", "variableDeclaration", "semicolonToken"], ["expression", "semicolonToken"], ["returnKeyword", "expression", "semicolonToken"], ["switchKeyword", "openParenToken", "expression", "closeParenToken", "openBraceToken", "switchClauses", "closeBraceToken"], ["breakKeyword", "identifier", "semicolonToken"], ["continueKeyword", "identifier", "semicolonToken"], ["forKeyword", "openParenToken", "variableDeclaration", "initializer", "firstSemicolonToken", "condition", "secondSemicolonToken", "incrementor", "closeParenToken", "statement"], ["forKeyword", "openParenToken", "variableDeclaration", "left", "inKeyword", "expression", "closeParenToken", "statement"], ["semicolonToken"], ["throwKeyword", "expression", "semicolonToken"], ["whileKeyword", "openParenToken", "condition", "closeParenToken", "statement"], ["tryKeyword", "block", "catchClause", "finallyClause"], ["identifier", "colonToken", "statement"], ["doKeyword", "statement", "whileKeyword", "openParenToken", "condition", "closeParenToken", "semicolonToken"], ["debuggerKeyword", "semicolonToken"], ["withKeyword", "openParenToken", "condition", "closeParenToken", "statement"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["deleteKeyword", "expression"], ["typeOfKeyword", "expression"], ["voidKeyword", "expression"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["condition", "questionToken", "whenTrue", "colonToken", "whenFalse"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["operand", "operatorToken"], ["operand", "operatorToken"], ["expression", "dotToken", "name"], ["expression", "argumentList"], ["openBracketToken", "expressions", "closeBracketToken"], ["openBraceToken", "propertyAssignments", "closeBraceToken"], ["newKeyword", "expression", "argumentList"], ["openParenToken", "expression", "closeParenToken"], ["callSignature", "equalsGreaterThanToken", "block", "expression"], ["parameter", "equalsGreaterThanToken", "block", "expression"], ["lessThanToken", "type", "greaterThanToken", "expression"], ["expression", "openBracketToken", "argumentExpression", "closeBracketToken"], ["functionKeyword", "identifier", "callSignature", "block"], [], ["varKeyword", "variableDeclarators"], ["propertyName", "typeAnnotation", "equalsValueClause"], ["typeArgumentList", "openParenToken", "arguments", "closeParenToken"], ["openParenToken", "parameters", "closeParenToken"], ["lessThanToken", "typeArguments", "greaterThanToken"], ["lessThanToken", "typeParameters", "greaterThanToken"], ["extendsOrImplementsKeyword", "typeNames"], ["extendsOrImplementsKeyword", "typeNames"], ["equalsToken", "value"], ["caseKeyword", "expression", "colonToken", "statements"], ["defaultKeyword", "colonToken", "statements"], ["elseKeyword", "statement"], ["catchKeyword", "openParenToken", "identifier", "typeAnnotation", "closeParenToken", "block"], ["finallyKeyword", "block"], ["identifier", "constraint"], ["extendsKeyword", "typeOrExpression"], ["propertyName", "colonToken", "expression"], ["propertyName", "callSignature", "block"], ["dotDotDotToken", "modifiers", "identifier", "questionToken", "typeAnnotation", "equalsValueClause"], ["propertyName", "equalsValueClause"], ["colonToken", "type"], ["requireKeyword", "openParenToken", "stringLiteral", "closeParenToken"], ["moduleName"], ]; + TypeScript.nodeMetadata = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], ["moduleElements", "endOfFileToken"], ["left", "dotToken", "right"], ["openBraceToken", "typeMembers", "closeBraceToken"], ["typeParameterList", "parameterList", "equalsGreaterThanToken", "type"], ["type", "openBracketToken", "closeBracketToken"], ["newKeyword", "typeParameterList", "parameterList", "equalsGreaterThanToken", "type"], ["name", "typeArgumentList"], ["typeOfKeyword", "name"], ["openBracketToken", "types", "closeBracketToken"], ["modifiers", "interfaceKeyword", "identifier", "typeParameterList", "heritageClauses", "body"], ["modifiers", "functionKeyword", "identifier", "callSignature", "block", "semicolonToken"], ["modifiers", "moduleKeyword", "name", "stringLiteral", "openBraceToken", "moduleElements", "closeBraceToken"], ["modifiers", "classKeyword", "identifier", "typeParameterList", "heritageClauses", "openBraceToken", "classElements", "closeBraceToken"], ["modifiers", "enumKeyword", "identifier", "openBraceToken", "enumElements", "closeBraceToken"], ["modifiers", "importKeyword", "identifier", "equalsToken", "moduleReference", "semicolonToken"], ["exportKeyword", "equalsToken", "identifier", "semicolonToken"], ["modifiers", "propertyName", "callSignature", "block", "semicolonToken"], ["modifiers", "variableDeclarator", "semicolonToken"], ["modifiers", "constructorKeyword", "callSignature", "block", "semicolonToken"], ["modifiers", "indexSignature", "semicolonToken"], ["modifiers", "getKeyword", "propertyName", "callSignature", "block"], ["modifiers", "setKeyword", "propertyName", "callSignature", "block"], ["propertyName", "questionToken", "typeAnnotation"], ["typeParameterList", "parameterList", "typeAnnotation"], ["newKeyword", "callSignature"], ["openBracketToken", "parameters", "closeBracketToken", "typeAnnotation"], ["propertyName", "questionToken", "callSignature"], ["openBraceToken", "statements", "closeBraceToken"], ["ifKeyword", "openParenToken", "condition", "closeParenToken", "statement", "elseClause"], ["modifiers", "variableDeclaration", "semicolonToken"], ["expression", "semicolonToken"], ["returnKeyword", "expression", "semicolonToken"], ["switchKeyword", "openParenToken", "expression", "closeParenToken", "openBraceToken", "switchClauses", "closeBraceToken"], ["breakKeyword", "identifier", "semicolonToken"], ["continueKeyword", "identifier", "semicolonToken"], ["forKeyword", "openParenToken", "variableDeclaration", "initializer", "firstSemicolonToken", "condition", "secondSemicolonToken", "incrementor", "closeParenToken", "statement"], ["forKeyword", "openParenToken", "variableDeclaration", "left", "inKeyword", "expression", "closeParenToken", "statement"], ["semicolonToken"], ["throwKeyword", "expression", "semicolonToken"], ["whileKeyword", "openParenToken", "condition", "closeParenToken", "statement"], ["tryKeyword", "block", "catchClause", "finallyClause"], ["identifier", "colonToken", "statement"], ["doKeyword", "statement", "whileKeyword", "openParenToken", "condition", "closeParenToken", "semicolonToken"], ["debuggerKeyword", "semicolonToken"], ["withKeyword", "openParenToken", "condition", "closeParenToken", "statement"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["deleteKeyword", "expression"], ["typeOfKeyword", "expression"], ["voidKeyword", "expression"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["condition", "questionToken", "whenTrue", "colonToken", "whenFalse"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["operand", "operatorToken"], ["operand", "operatorToken"], ["expression", "dotToken", "name"], ["expression", "argumentList"], ["openBracketToken", "expressions", "closeBracketToken"], ["openBraceToken", "propertyAssignments", "closeBraceToken"], ["newKeyword", "expression", "argumentList"], ["openParenToken", "expression", "closeParenToken"], ["callSignature", "equalsGreaterThanToken", "block", "expression"], ["parameter", "equalsGreaterThanToken", "block", "expression"], ["lessThanToken", "type", "greaterThanToken", "expression"], ["expression", "openBracketToken", "argumentExpression", "closeBracketToken"], ["functionKeyword", "identifier", "callSignature", "block"], [], ["varKeyword", "variableDeclarators"], ["propertyName", "typeAnnotation", "equalsValueClause"], ["typeArgumentList", "openParenToken", "arguments", "closeParenToken"], ["openParenToken", "parameters", "closeParenToken"], ["lessThanToken", "typeArguments", "greaterThanToken"], ["lessThanToken", "typeParameters", "greaterThanToken"], ["extendsOrImplementsKeyword", "typeNames"], ["extendsOrImplementsKeyword", "typeNames"], ["equalsToken", "value"], ["caseKeyword", "expression", "colonToken", "statements"], ["defaultKeyword", "colonToken", "statements"], ["elseKeyword", "statement"], ["catchKeyword", "openParenToken", "identifier", "typeAnnotation", "closeParenToken", "block"], ["finallyKeyword", "block"], ["identifier", "constraint"], ["extendsKeyword", "typeOrExpression"], ["propertyName", "colonToken", "expression"], ["propertyName", "callSignature", "block"], ["dotDotDotToken", "modifiers", "identifier", "questionToken", "typeAnnotation", "equalsValueClause"], ["propertyName", "equalsValueClause"], ["colonToken", "type"], ["requireKeyword", "openParenToken", "stringLiteral", "closeParenToken"], ["moduleName"], ]; })(TypeScript || (TypeScript = {})); var TypeScript; (function (TypeScript) { @@ -19552,7 +19980,6 @@ var TypeScript; var currentIndex = 0; for (var i = 0; i < triviaText.length; i++) { var ch = triviaText.charCodeAt(i); - var isCarriageReturnLineFeed = false; switch (ch) { case 13 /* carriageReturn */: if (i < triviaText.length - 1 && triviaText.charCodeAt(i + 1) === 10 /* lineFeed */) { @@ -19756,15 +20183,15 @@ var TypeScript; } SyntaxUtilities.isAnyFunctionExpressionOrDeclaration = function (ast) { switch (ast.kind()) { - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 222 /* FunctionExpression */: - case 129 /* FunctionDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 241 /* FunctionPropertyAssignment */: - case 137 /* ConstructorDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: + case 220 /* SimpleArrowFunctionExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: + case 223 /* FunctionExpression */: + case 130 /* FunctionDeclaration */: + case 136 /* MemberFunctionDeclaration */: + case 242 /* FunctionPropertyAssignment */: + case 138 /* ConstructorDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: return true; } return false; @@ -19782,14 +20209,14 @@ var TypeScript; SyntaxUtilities.isLeftHandSizeExpression = function (element) { if (element) { switch (element.kind()) { - case 212 /* MemberAccessExpression */: - case 221 /* ElementAccessExpression */: - case 216 /* ObjectCreationExpression */: - case 213 /* InvocationExpression */: - case 214 /* ArrayLiteralExpression */: - case 217 /* ParenthesizedExpression */: - case 215 /* ObjectLiteralExpression */: - case 222 /* FunctionExpression */: + case 213 /* MemberAccessExpression */: + case 222 /* ElementAccessExpression */: + case 217 /* ObjectCreationExpression */: + case 214 /* InvocationExpression */: + case 215 /* ArrayLiteralExpression */: + case 218 /* ParenthesizedExpression */: + case 216 /* ObjectLiteralExpression */: + case 223 /* FunctionExpression */: case 11 /* IdentifierName */: case 12 /* RegularExpressionLiteral */: case 13 /* NumericLiteral */: @@ -19816,66 +20243,66 @@ var TypeScript; case 35 /* ThisKeyword */: case 37 /* TrueKeyword */: case 50 /* SuperKeyword */: - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - case 166 /* BitwiseNotExpression */: - case 167 /* LogicalNotExpression */: - case 168 /* PreIncrementExpression */: - case 169 /* PreDecrementExpression */: - case 170 /* DeleteExpression */: - case 171 /* TypeOfExpression */: - case 172 /* VoidExpression */: - case 173 /* CommaExpression */: - case 174 /* AssignmentExpression */: - case 175 /* AddAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - case 186 /* ConditionalExpression */: - case 187 /* LogicalOrExpression */: - case 188 /* LogicalAndExpression */: - case 189 /* BitwiseOrExpression */: - case 190 /* BitwiseExclusiveOrExpression */: - case 191 /* BitwiseAndExpression */: - case 192 /* EqualsWithTypeConversionExpression */: - case 193 /* NotEqualsWithTypeConversionExpression */: - case 194 /* EqualsExpression */: - case 195 /* NotEqualsExpression */: - case 196 /* LessThanExpression */: - case 197 /* GreaterThanExpression */: - case 198 /* LessThanOrEqualExpression */: - case 199 /* GreaterThanOrEqualExpression */: - case 200 /* InstanceOfExpression */: - case 201 /* InExpression */: - case 202 /* LeftShiftExpression */: - case 203 /* SignedRightShiftExpression */: - case 204 /* UnsignedRightShiftExpression */: - case 205 /* MultiplyExpression */: - case 206 /* DivideExpression */: - case 207 /* ModuloExpression */: - case 208 /* AddExpression */: - case 209 /* SubtractExpression */: - case 210 /* PostIncrementExpression */: - case 211 /* PostDecrementExpression */: - case 212 /* MemberAccessExpression */: - case 213 /* InvocationExpression */: - case 214 /* ArrayLiteralExpression */: - case 215 /* ObjectLiteralExpression */: - case 216 /* ObjectCreationExpression */: - case 217 /* ParenthesizedExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 219 /* SimpleArrowFunctionExpression */: - case 220 /* CastExpression */: - case 221 /* ElementAccessExpression */: - case 222 /* FunctionExpression */: - case 223 /* OmittedExpression */: + case 165 /* PlusExpression */: + case 166 /* NegateExpression */: + case 167 /* BitwiseNotExpression */: + case 168 /* LogicalNotExpression */: + case 169 /* PreIncrementExpression */: + case 170 /* PreDecrementExpression */: + case 171 /* DeleteExpression */: + case 172 /* TypeOfExpression */: + case 173 /* VoidExpression */: + case 174 /* CommaExpression */: + case 175 /* AssignmentExpression */: + case 176 /* AddAssignmentExpression */: + case 177 /* SubtractAssignmentExpression */: + case 178 /* MultiplyAssignmentExpression */: + case 179 /* DivideAssignmentExpression */: + case 180 /* ModuloAssignmentExpression */: + case 181 /* AndAssignmentExpression */: + case 182 /* ExclusiveOrAssignmentExpression */: + case 183 /* OrAssignmentExpression */: + case 184 /* LeftShiftAssignmentExpression */: + case 185 /* SignedRightShiftAssignmentExpression */: + case 186 /* UnsignedRightShiftAssignmentExpression */: + case 187 /* ConditionalExpression */: + case 188 /* LogicalOrExpression */: + case 189 /* LogicalAndExpression */: + case 190 /* BitwiseOrExpression */: + case 191 /* BitwiseExclusiveOrExpression */: + case 192 /* BitwiseAndExpression */: + case 193 /* EqualsWithTypeConversionExpression */: + case 194 /* NotEqualsWithTypeConversionExpression */: + case 195 /* EqualsExpression */: + case 196 /* NotEqualsExpression */: + case 197 /* LessThanExpression */: + case 198 /* GreaterThanExpression */: + case 199 /* LessThanOrEqualExpression */: + case 200 /* GreaterThanOrEqualExpression */: + case 201 /* InstanceOfExpression */: + case 202 /* InExpression */: + case 203 /* LeftShiftExpression */: + case 204 /* SignedRightShiftExpression */: + case 205 /* UnsignedRightShiftExpression */: + case 206 /* MultiplyExpression */: + case 207 /* DivideExpression */: + case 208 /* ModuloExpression */: + case 209 /* AddExpression */: + case 210 /* SubtractExpression */: + case 211 /* PostIncrementExpression */: + case 212 /* PostDecrementExpression */: + case 213 /* MemberAccessExpression */: + case 214 /* InvocationExpression */: + case 215 /* ArrayLiteralExpression */: + case 216 /* ObjectLiteralExpression */: + case 217 /* ObjectCreationExpression */: + case 218 /* ParenthesizedExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: + case 220 /* SimpleArrowFunctionExpression */: + case 221 /* CastExpression */: + case 222 /* ElementAccessExpression */: + case 223 /* FunctionExpression */: + case 224 /* OmittedExpression */: return true; } } @@ -19884,8 +20311,8 @@ var TypeScript; SyntaxUtilities.isSwitchClause = function (element) { if (element) { switch (element.kind()) { - case 233 /* CaseSwitchClause */: - case 234 /* DefaultSwitchClause */: + case 234 /* CaseSwitchClause */: + case 235 /* DefaultSwitchClause */: return true; } } @@ -19894,11 +20321,11 @@ var TypeScript; SyntaxUtilities.isTypeMember = function (element) { if (element) { switch (element.kind()) { - case 143 /* ConstructSignature */: - case 145 /* MethodSignature */: - case 144 /* IndexSignature */: - case 141 /* PropertySignature */: - case 142 /* CallSignature */: + case 144 /* ConstructSignature */: + case 146 /* MethodSignature */: + case 145 /* IndexSignature */: + case 142 /* PropertySignature */: + case 143 /* CallSignature */: return true; } } @@ -19907,13 +20334,13 @@ var TypeScript; SyntaxUtilities.isClassElement = function (element) { if (element) { switch (element.kind()) { - case 137 /* ConstructorDeclaration */: - case 138 /* IndexMemberDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 135 /* MemberFunctionDeclaration */: - case 136 /* MemberVariableDeclaration */: + case 138 /* ConstructorDeclaration */: + case 139 /* IndexMemberDeclaration */: + case 136 /* MemberFunctionDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 136 /* MemberFunctionDeclaration */: + case 137 /* MemberVariableDeclaration */: return true; } } @@ -19922,31 +20349,31 @@ var TypeScript; SyntaxUtilities.isModuleElement = function (element) { if (element) { switch (element.kind()) { - case 133 /* ImportDeclaration */: - case 134 /* ExportAssignment */: - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 130 /* ModuleDeclaration */: - case 132 /* EnumDeclaration */: - case 129 /* FunctionDeclaration */: - case 148 /* VariableStatement */: - case 146 /* Block */: - case 147 /* IfStatement */: - case 149 /* ExpressionStatement */: - case 157 /* ThrowStatement */: - case 150 /* ReturnStatement */: - case 151 /* SwitchStatement */: - case 152 /* BreakStatement */: - case 153 /* ContinueStatement */: - case 155 /* ForInStatement */: - case 154 /* ForStatement */: - case 158 /* WhileStatement */: - case 163 /* WithStatement */: - case 156 /* EmptyStatement */: - case 159 /* TryStatement */: - case 160 /* LabeledStatement */: - case 161 /* DoStatement */: - case 162 /* DebuggerStatement */: + case 134 /* ImportDeclaration */: + case 135 /* ExportAssignment */: + case 132 /* ClassDeclaration */: + case 129 /* InterfaceDeclaration */: + case 131 /* ModuleDeclaration */: + case 133 /* EnumDeclaration */: + case 130 /* FunctionDeclaration */: + case 149 /* VariableStatement */: + case 147 /* Block */: + case 148 /* IfStatement */: + case 150 /* ExpressionStatement */: + case 158 /* ThrowStatement */: + case 151 /* ReturnStatement */: + case 152 /* SwitchStatement */: + case 153 /* BreakStatement */: + case 154 /* ContinueStatement */: + case 156 /* ForInStatement */: + case 155 /* ForStatement */: + case 159 /* WhileStatement */: + case 164 /* WithStatement */: + case 157 /* EmptyStatement */: + case 160 /* TryStatement */: + case 161 /* LabeledStatement */: + case 162 /* DoStatement */: + case 163 /* DebuggerStatement */: return true; } } @@ -19955,25 +20382,25 @@ var TypeScript; SyntaxUtilities.isStatement = function (element) { if (element) { switch (element.kind()) { - case 129 /* FunctionDeclaration */: - case 148 /* VariableStatement */: - case 146 /* Block */: - case 147 /* IfStatement */: - case 149 /* ExpressionStatement */: - case 157 /* ThrowStatement */: - case 150 /* ReturnStatement */: - case 151 /* SwitchStatement */: - case 152 /* BreakStatement */: - case 153 /* ContinueStatement */: - case 155 /* ForInStatement */: - case 154 /* ForStatement */: - case 158 /* WhileStatement */: - case 163 /* WithStatement */: - case 156 /* EmptyStatement */: - case 159 /* TryStatement */: - case 160 /* LabeledStatement */: - case 161 /* DoStatement */: - case 162 /* DebuggerStatement */: + case 130 /* FunctionDeclaration */: + case 149 /* VariableStatement */: + case 147 /* Block */: + case 148 /* IfStatement */: + case 150 /* ExpressionStatement */: + case 158 /* ThrowStatement */: + case 151 /* ReturnStatement */: + case 152 /* SwitchStatement */: + case 153 /* BreakStatement */: + case 154 /* ContinueStatement */: + case 156 /* ForInStatement */: + case 155 /* ForStatement */: + case 159 /* WhileStatement */: + case 164 /* WithStatement */: + case 157 /* EmptyStatement */: + case 160 /* TryStatement */: + case 161 /* LabeledStatement */: + case 162 /* DoStatement */: + case 163 /* DebuggerStatement */: return true; } } @@ -19984,9 +20411,9 @@ var TypeScript; var parent = positionedElement.parent; if (parent !== null && (element.kind() === 80 /* LessThanToken */ || element.kind() === 81 /* GreaterThanToken */)) { switch (parent.kind()) { - case 228 /* TypeArgumentList */: - case 229 /* TypeParameterList */: - case 220 /* CastExpression */: + case 229 /* TypeArgumentList */: + case 230 /* TypeParameterList */: + case 221 /* CastExpression */: return true; } } @@ -20009,13 +20436,13 @@ var TypeScript; }; SyntaxUtilities.getExportKeyword = function (moduleElement) { switch (moduleElement.kind()) { - case 130 /* ModuleDeclaration */: - case 131 /* ClassDeclaration */: - case 129 /* FunctionDeclaration */: - case 148 /* VariableStatement */: - case 132 /* EnumDeclaration */: - case 128 /* InterfaceDeclaration */: - case 133 /* ImportDeclaration */: + case 131 /* ModuleDeclaration */: + case 132 /* ClassDeclaration */: + case 130 /* FunctionDeclaration */: + case 149 /* VariableStatement */: + case 133 /* EnumDeclaration */: + case 129 /* InterfaceDeclaration */: + case 134 /* ImportDeclaration */: return SyntaxUtilities.getToken(moduleElement.modifiers, 47 /* ExportKeyword */); default: return null; @@ -20027,24 +20454,24 @@ var TypeScript; } var node = positionNode; switch (node.kind()) { - case 130 /* ModuleDeclaration */: - case 131 /* ClassDeclaration */: - case 129 /* FunctionDeclaration */: - case 148 /* VariableStatement */: - case 132 /* EnumDeclaration */: + case 131 /* ModuleDeclaration */: + case 132 /* ClassDeclaration */: + case 130 /* FunctionDeclaration */: + case 149 /* VariableStatement */: + case 133 /* EnumDeclaration */: if (SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */)) { return true; } - case 133 /* ImportDeclaration */: - case 137 /* ConstructorDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 136 /* MemberVariableDeclaration */: + case 134 /* ImportDeclaration */: + case 138 /* ConstructorDeclaration */: + case 136 /* MemberFunctionDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 137 /* MemberVariableDeclaration */: if (SyntaxUtilities.isClassElement(node) || SyntaxUtilities.isModuleElement(node)) { return SyntaxUtilities.isAmbientDeclarationSyntax(TypeScript.Syntax.containingNode(positionNode)); } - case 243 /* EnumElement */: + case 244 /* EnumElement */: return SyntaxUtilities.isAmbientDeclarationSyntax(TypeScript.Syntax.containingNode(TypeScript.Syntax.containingNode(positionNode))); default: return SyntaxUtilities.isAmbientDeclarationSyntax(TypeScript.Syntax.containingNode(positionNode)); @@ -20080,201 +20507,203 @@ var TypeScript; return visitor.visitGenericType(element); case 127 /* TypeQuery */: return visitor.visitTypeQuery(element); - case 128 /* InterfaceDeclaration */: + case 128 /* TupleType */: + return visitor.visitTupleType(element); + case 129 /* InterfaceDeclaration */: return visitor.visitInterfaceDeclaration(element); - case 129 /* FunctionDeclaration */: + case 130 /* FunctionDeclaration */: return visitor.visitFunctionDeclaration(element); - case 130 /* ModuleDeclaration */: + case 131 /* ModuleDeclaration */: return visitor.visitModuleDeclaration(element); - case 131 /* ClassDeclaration */: + case 132 /* ClassDeclaration */: return visitor.visitClassDeclaration(element); - case 132 /* EnumDeclaration */: + case 133 /* EnumDeclaration */: return visitor.visitEnumDeclaration(element); - case 133 /* ImportDeclaration */: + case 134 /* ImportDeclaration */: return visitor.visitImportDeclaration(element); - case 134 /* ExportAssignment */: + case 135 /* ExportAssignment */: return visitor.visitExportAssignment(element); - case 135 /* MemberFunctionDeclaration */: + case 136 /* MemberFunctionDeclaration */: return visitor.visitMemberFunctionDeclaration(element); - case 136 /* MemberVariableDeclaration */: + case 137 /* MemberVariableDeclaration */: return visitor.visitMemberVariableDeclaration(element); - case 137 /* ConstructorDeclaration */: + case 138 /* ConstructorDeclaration */: return visitor.visitConstructorDeclaration(element); - case 138 /* IndexMemberDeclaration */: + case 139 /* IndexMemberDeclaration */: return visitor.visitIndexMemberDeclaration(element); - case 139 /* GetAccessor */: + case 140 /* GetAccessor */: return visitor.visitGetAccessor(element); - case 140 /* SetAccessor */: + case 141 /* SetAccessor */: return visitor.visitSetAccessor(element); - case 141 /* PropertySignature */: + case 142 /* PropertySignature */: return visitor.visitPropertySignature(element); - case 142 /* CallSignature */: + case 143 /* CallSignature */: return visitor.visitCallSignature(element); - case 143 /* ConstructSignature */: + case 144 /* ConstructSignature */: return visitor.visitConstructSignature(element); - case 144 /* IndexSignature */: + case 145 /* IndexSignature */: return visitor.visitIndexSignature(element); - case 145 /* MethodSignature */: + case 146 /* MethodSignature */: return visitor.visitMethodSignature(element); - case 146 /* Block */: + case 147 /* Block */: return visitor.visitBlock(element); - case 147 /* IfStatement */: + case 148 /* IfStatement */: return visitor.visitIfStatement(element); - case 148 /* VariableStatement */: + case 149 /* VariableStatement */: return visitor.visitVariableStatement(element); - case 149 /* ExpressionStatement */: + case 150 /* ExpressionStatement */: return visitor.visitExpressionStatement(element); - case 150 /* ReturnStatement */: + case 151 /* ReturnStatement */: return visitor.visitReturnStatement(element); - case 151 /* SwitchStatement */: + case 152 /* SwitchStatement */: return visitor.visitSwitchStatement(element); - case 152 /* BreakStatement */: + case 153 /* BreakStatement */: return visitor.visitBreakStatement(element); - case 153 /* ContinueStatement */: + case 154 /* ContinueStatement */: return visitor.visitContinueStatement(element); - case 154 /* ForStatement */: + case 155 /* ForStatement */: return visitor.visitForStatement(element); - case 155 /* ForInStatement */: + case 156 /* ForInStatement */: return visitor.visitForInStatement(element); - case 156 /* EmptyStatement */: + case 157 /* EmptyStatement */: return visitor.visitEmptyStatement(element); - case 157 /* ThrowStatement */: + case 158 /* ThrowStatement */: return visitor.visitThrowStatement(element); - case 158 /* WhileStatement */: + case 159 /* WhileStatement */: return visitor.visitWhileStatement(element); - case 159 /* TryStatement */: + case 160 /* TryStatement */: return visitor.visitTryStatement(element); - case 160 /* LabeledStatement */: + case 161 /* LabeledStatement */: return visitor.visitLabeledStatement(element); - case 161 /* DoStatement */: + case 162 /* DoStatement */: return visitor.visitDoStatement(element); - case 162 /* DebuggerStatement */: + case 163 /* DebuggerStatement */: return visitor.visitDebuggerStatement(element); - case 163 /* WithStatement */: + case 164 /* WithStatement */: return visitor.visitWithStatement(element); - case 168 /* PreIncrementExpression */: - case 169 /* PreDecrementExpression */: - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: - case 166 /* BitwiseNotExpression */: - case 167 /* LogicalNotExpression */: + case 169 /* PreIncrementExpression */: + case 170 /* PreDecrementExpression */: + case 165 /* PlusExpression */: + case 166 /* NegateExpression */: + case 167 /* BitwiseNotExpression */: + case 168 /* LogicalNotExpression */: return visitor.visitPrefixUnaryExpression(element); - case 170 /* DeleteExpression */: + case 171 /* DeleteExpression */: return visitor.visitDeleteExpression(element); - case 171 /* TypeOfExpression */: + case 172 /* TypeOfExpression */: return visitor.visitTypeOfExpression(element); - case 172 /* VoidExpression */: + case 173 /* VoidExpression */: return visitor.visitVoidExpression(element); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return visitor.visitConditionalExpression(element); - case 205 /* MultiplyExpression */: - case 206 /* DivideExpression */: - case 207 /* ModuloExpression */: - case 208 /* AddExpression */: - case 209 /* SubtractExpression */: - case 202 /* LeftShiftExpression */: - case 203 /* SignedRightShiftExpression */: - case 204 /* UnsignedRightShiftExpression */: - case 196 /* LessThanExpression */: - case 197 /* GreaterThanExpression */: - case 198 /* LessThanOrEqualExpression */: - case 199 /* GreaterThanOrEqualExpression */: - case 200 /* InstanceOfExpression */: - case 201 /* InExpression */: - case 192 /* EqualsWithTypeConversionExpression */: - case 193 /* NotEqualsWithTypeConversionExpression */: - case 194 /* EqualsExpression */: - case 195 /* NotEqualsExpression */: - case 191 /* BitwiseAndExpression */: - case 190 /* BitwiseExclusiveOrExpression */: - case 189 /* BitwiseOrExpression */: - case 188 /* LogicalAndExpression */: - case 187 /* LogicalOrExpression */: - case 182 /* OrAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - case 175 /* AddAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 174 /* AssignmentExpression */: - case 173 /* CommaExpression */: + case 206 /* MultiplyExpression */: + case 207 /* DivideExpression */: + case 208 /* ModuloExpression */: + case 209 /* AddExpression */: + case 210 /* SubtractExpression */: + case 203 /* LeftShiftExpression */: + case 204 /* SignedRightShiftExpression */: + case 205 /* UnsignedRightShiftExpression */: + case 197 /* LessThanExpression */: + case 198 /* GreaterThanExpression */: + case 199 /* LessThanOrEqualExpression */: + case 200 /* GreaterThanOrEqualExpression */: + case 201 /* InstanceOfExpression */: + case 202 /* InExpression */: + case 193 /* EqualsWithTypeConversionExpression */: + case 194 /* NotEqualsWithTypeConversionExpression */: + case 195 /* EqualsExpression */: + case 196 /* NotEqualsExpression */: + case 192 /* BitwiseAndExpression */: + case 191 /* BitwiseExclusiveOrExpression */: + case 190 /* BitwiseOrExpression */: + case 189 /* LogicalAndExpression */: + case 188 /* LogicalOrExpression */: + case 183 /* OrAssignmentExpression */: + case 181 /* AndAssignmentExpression */: + case 182 /* ExclusiveOrAssignmentExpression */: + case 184 /* LeftShiftAssignmentExpression */: + case 185 /* SignedRightShiftAssignmentExpression */: + case 186 /* UnsignedRightShiftAssignmentExpression */: + case 176 /* AddAssignmentExpression */: + case 177 /* SubtractAssignmentExpression */: + case 178 /* MultiplyAssignmentExpression */: + case 179 /* DivideAssignmentExpression */: + case 180 /* ModuloAssignmentExpression */: + case 175 /* AssignmentExpression */: + case 174 /* CommaExpression */: return visitor.visitBinaryExpression(element); - case 210 /* PostIncrementExpression */: - case 211 /* PostDecrementExpression */: + case 211 /* PostIncrementExpression */: + case 212 /* PostDecrementExpression */: return visitor.visitPostfixUnaryExpression(element); - case 212 /* MemberAccessExpression */: + case 213 /* MemberAccessExpression */: return visitor.visitMemberAccessExpression(element); - case 213 /* InvocationExpression */: + case 214 /* InvocationExpression */: return visitor.visitInvocationExpression(element); - case 214 /* ArrayLiteralExpression */: + case 215 /* ArrayLiteralExpression */: return visitor.visitArrayLiteralExpression(element); - case 215 /* ObjectLiteralExpression */: + case 216 /* ObjectLiteralExpression */: return visitor.visitObjectLiteralExpression(element); - case 216 /* ObjectCreationExpression */: + case 217 /* ObjectCreationExpression */: return visitor.visitObjectCreationExpression(element); - case 217 /* ParenthesizedExpression */: + case 218 /* ParenthesizedExpression */: return visitor.visitParenthesizedExpression(element); - case 218 /* ParenthesizedArrowFunctionExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: return visitor.visitParenthesizedArrowFunctionExpression(element); - case 219 /* SimpleArrowFunctionExpression */: + case 220 /* SimpleArrowFunctionExpression */: return visitor.visitSimpleArrowFunctionExpression(element); - case 220 /* CastExpression */: + case 221 /* CastExpression */: return visitor.visitCastExpression(element); - case 221 /* ElementAccessExpression */: + case 222 /* ElementAccessExpression */: return visitor.visitElementAccessExpression(element); - case 222 /* FunctionExpression */: + case 223 /* FunctionExpression */: return visitor.visitFunctionExpression(element); - case 223 /* OmittedExpression */: + case 224 /* OmittedExpression */: return visitor.visitOmittedExpression(element); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitor.visitVariableDeclaration(element); - case 225 /* VariableDeclarator */: + case 226 /* VariableDeclarator */: return visitor.visitVariableDeclarator(element); - case 226 /* ArgumentList */: + case 227 /* ArgumentList */: return visitor.visitArgumentList(element); - case 227 /* ParameterList */: + case 228 /* ParameterList */: return visitor.visitParameterList(element); - case 228 /* TypeArgumentList */: + case 229 /* TypeArgumentList */: return visitor.visitTypeArgumentList(element); - case 229 /* TypeParameterList */: + case 230 /* TypeParameterList */: return visitor.visitTypeParameterList(element); - case 230 /* ExtendsHeritageClause */: - case 231 /* ImplementsHeritageClause */: + case 231 /* ExtendsHeritageClause */: + case 232 /* ImplementsHeritageClause */: return visitor.visitHeritageClause(element); - case 232 /* EqualsValueClause */: + case 233 /* EqualsValueClause */: return visitor.visitEqualsValueClause(element); - case 233 /* CaseSwitchClause */: + case 234 /* CaseSwitchClause */: return visitor.visitCaseSwitchClause(element); - case 234 /* DefaultSwitchClause */: + case 235 /* DefaultSwitchClause */: return visitor.visitDefaultSwitchClause(element); - case 235 /* ElseClause */: + case 236 /* ElseClause */: return visitor.visitElseClause(element); - case 236 /* CatchClause */: + case 237 /* CatchClause */: return visitor.visitCatchClause(element); - case 237 /* FinallyClause */: + case 238 /* FinallyClause */: return visitor.visitFinallyClause(element); - case 238 /* TypeParameter */: + case 239 /* TypeParameter */: return visitor.visitTypeParameter(element); - case 239 /* Constraint */: + case 240 /* Constraint */: return visitor.visitConstraint(element); - case 240 /* SimplePropertyAssignment */: + case 241 /* SimplePropertyAssignment */: return visitor.visitSimplePropertyAssignment(element); - case 241 /* FunctionPropertyAssignment */: + case 242 /* FunctionPropertyAssignment */: return visitor.visitFunctionPropertyAssignment(element); - case 242 /* Parameter */: + case 243 /* Parameter */: return visitor.visitParameter(element); - case 243 /* EnumElement */: + case 244 /* EnumElement */: return visitor.visitEnumElement(element); - case 244 /* TypeAnnotation */: + case 245 /* TypeAnnotation */: return visitor.visitTypeAnnotation(element); - case 245 /* ExternalModuleReference */: + case 246 /* ExternalModuleReference */: return visitor.visitExternalModuleReference(element); - case 246 /* ModuleNameModuleReference */: + case 247 /* ModuleNameModuleReference */: return visitor.visitModuleNameModuleReference(element); } throw TypeScript.Errors.invalidOperation(); @@ -20368,6 +20797,11 @@ var TypeScript; this.visitToken(node.typeOfKeyword); this.visitNodeOrToken(node.name); }; + SyntaxWalker.prototype.visitTupleType = function (node) { + this.visitToken(node.openBracketToken); + this.visitSeparatedList(node.types); + this.visitToken(node.closeBracketToken); + }; SyntaxWalker.prototype.visitInterfaceDeclaration = function (node) { this.visitList(node.modifiers); this.visitToken(node.interfaceKeyword); @@ -21404,7 +21838,7 @@ var TypeScript; } function isEnumElement(inErrorRecovery) { var node = currentNode(); - if (node !== null && node.kind() === 243 /* EnumElement */) { + if (node !== null && node.kind() === 244 /* EnumElement */) { return true; } return isPropertyName(currentToken(), inErrorRecovery); @@ -21414,7 +21848,7 @@ var TypeScript; } function tryParseEnumElement(inErrorRecovery) { var node = currentNode(); - if (node !== null && node.kind() === 243 /* EnumElement */) { + if (node !== null && node.kind() === 244 /* EnumElement */) { consumeNode(node); return node; } @@ -21428,6 +21862,7 @@ var TypeScript; case 47 /* ExportKeyword */: case 57 /* PublicKeyword */: case 55 /* PrivateKeyword */: + case 56 /* ProtectedKeyword */: case 58 /* StaticKeyword */: case 63 /* DeclareKeyword */: return true; @@ -21691,6 +22126,16 @@ var TypeScript; } return new Parser.syntaxFactory.ObjectTypeSyntax(parseNodeData, openBraceToken, typeMembers, eatToken(71 /* CloseBraceToken */)); } + function parseTupleType(currentToken) { + var openBracket = consumeToken(currentToken); + var types = TypeScript.Syntax.emptySeparatedList(); + if (openBracket.fullWidth() > 0) { + var skippedTokens = getArray(); + types = parseSeparatedSyntaxList(21 /* TupleType_Types */, skippedTokens); + openBracket = addSkippedTokensAfterToken(openBracket, skippedTokens); + } + return new Parser.syntaxFactory.TupleTypeSyntax(parseNodeData, openBracket, types, eatToken(75 /* CloseBracketToken */)); + } function isTypeMember(inErrorRecovery) { if (TypeScript.SyntaxUtilities.isTypeMember(currentNode())) { return true; @@ -21844,6 +22289,7 @@ var TypeScript; switch (currentTokenKind) { case 57 /* PublicKeyword */: case 55 /* PrivateKeyword */: + case 56 /* ProtectedKeyword */: case 58 /* StaticKeyword */: var token1 = peekToken(1); if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token1)) { @@ -21887,6 +22333,7 @@ var TypeScript; switch (currentTokenKind) { case 57 /* PublicKeyword */: case 55 /* PrivateKeyword */: + case 56 /* ProtectedKeyword */: case 58 /* StaticKeyword */: if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(peekToken(1))) { return null; @@ -22208,13 +22655,13 @@ var TypeScript; } function isVariableDeclarator() { var node = currentNode(); - if (node !== null && node.kind() === 225 /* VariableDeclarator */) { + if (node !== null && node.kind() === 226 /* VariableDeclarator */) { return true; } return isIdentifier(currentToken()); } function canReuseVariableDeclaratorNode(node) { - if (node === null || node.kind() !== 225 /* VariableDeclarator */) { + if (node === null || node.kind() !== 226 /* VariableDeclarator */) { return false; } var variableDeclarator = node; @@ -22654,7 +23101,7 @@ var TypeScript; } token2 = peekToken(2); token2Kind = token2.kind(); - if (token1Kind === 57 /* PublicKeyword */ || token1Kind === 55 /* PrivateKeyword */) { + if (TypeScript.SyntaxFacts.isAccessibilityModifier(token1Kind)) { if (isIdentifier(token2)) { return true; } @@ -22917,6 +23364,8 @@ var TypeScript; return parseConstructorType(); case 39 /* TypeOfKeyword */: return parseTypeQuery(_currentToken); + case 74 /* OpenBracketToken */: + return parseTupleType(_currentToken); } return tryParseNameOrGenericType(); } @@ -22949,7 +23398,7 @@ var TypeScript; return new Parser.syntaxFactory.ConstructorTypeSyntax(parseNodeData, eatToken(31 /* NewKeyword */), tryParseTypeParameterList(false), parseParameterList(), eatToken(85 /* EqualsGreaterThanToken */), parseType()); } function isParameter() { - if (currentNode() !== null && currentNode().kind() === 242 /* Parameter */) { + if (currentNode() !== null && currentNode().kind() === 243 /* Parameter */) { return true; } return isParameterHelper(currentToken()); @@ -22963,7 +23412,7 @@ var TypeScript; } function tryParseParameter() { var node = currentNode(); - if (node !== null && node.kind() === 242 /* Parameter */) { + if (node !== null && node.kind() === 243 /* Parameter */) { consumeNode(node); return node; } @@ -23161,6 +23610,8 @@ var TypeScript; return isExpectedTypeArgumentList_TypesTerminator(); case 20 /* TypeParameterList_TypeParameters */: return isExpectedTypeParameterList_TypeParametersTerminator(); + case 21 /* TupleType_Types */: + return isExpectedTupleType_TypesTerminator(); default: throw TypeScript.Errors.invalidOperation(); } @@ -23194,6 +23645,14 @@ var TypeScript; } return false; } + function isExpectedTupleType_TypesTerminator() { + var token = currentToken(); + var tokenKind = token.kind(); + if (tokenKind === 75 /* CloseBracketToken */) { + return true; + } + return false; + } function isExpectedTypeParameterList_TypeParametersTerminator() { var tokenKind = currentToken().kind(); if (tokenKind === 81 /* GreaterThanToken */) { @@ -23328,6 +23787,8 @@ var TypeScript; return isType(); case 20 /* TypeParameterList_TypeParameters */: return isTypeParameter(); + case 21 /* TupleType_Types */: + return isType(); default: throw TypeScript.Errors.invalidOperation(); } @@ -23386,6 +23847,8 @@ var TypeScript; return tryParseType(); case 20 /* TypeParameterList_TypeParameters */: return tryParseTypeParameter(); + case 21 /* TupleType_Types */: + return tryParseType(); default: throw TypeScript.Errors.invalidOperation(); } @@ -23428,6 +23891,8 @@ var TypeScript; return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, null); case 20 /* TypeParameterList_TypeParameters */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_parameter, null); + case 21 /* TupleType_Types */: + return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, null); case 16 /* ArrayLiteralExpression_AssignmentExpressions */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, null); default: @@ -23473,8 +23938,9 @@ var TypeScript; ListParsingState[ListParsingState["IndexSignature_Parameters"] = 18] = "IndexSignature_Parameters"; ListParsingState[ListParsingState["TypeArgumentList_Types"] = 19] = "TypeArgumentList_Types"; ListParsingState[ListParsingState["TypeParameterList_TypeParameters"] = 20] = "TypeParameterList_TypeParameters"; + ListParsingState[ListParsingState["TupleType_Types"] = 21] = "TupleType_Types"; ListParsingState[ListParsingState["FirstListParsingState"] = ListParsingState.SourceUnit_ModuleElements] = "FirstListParsingState"; - ListParsingState[ListParsingState["LastListParsingState"] = ListParsingState.TypeParameterList_TypeParameters] = "LastListParsingState"; + ListParsingState[ListParsingState["LastListParsingState"] = ListParsingState.TupleType_Types] = "LastListParsingState"; })(ListParsingState || (ListParsingState = {})); var parseSyntaxTree = createParseSyntaxTree(); function parse(fileName, text, languageVersion, isDeclaration) { @@ -23568,6 +24034,15 @@ var TypeScript; return TypeQuerySyntax; })(TypeScript.SyntaxNode); Concrete.TypeQuerySyntax = TypeQuerySyntax; + var TupleTypeSyntax = (function (_super) { + __extends(TupleTypeSyntax, _super); + function TupleTypeSyntax(data, openBracketToken, types, closeBracketToken) { + _super.call(this, data); + this.openBracketToken = openBracketToken, this.types = types, this.closeBracketToken = closeBracketToken, openBracketToken.parent = this, !TypeScript.isShared(types) && (types.parent = this), closeBracketToken.parent = this; + } + return TupleTypeSyntax; + })(TypeScript.SyntaxNode); + Concrete.TupleTypeSyntax = TupleTypeSyntax; var InterfaceDeclarationSyntax = (function (_super) { __extends(InterfaceDeclarationSyntax, _super); function InterfaceDeclarationSyntax(data, modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body) { @@ -24132,7 +24607,7 @@ var TypeScript; this.extendsOrImplementsKeyword = extendsOrImplementsKeyword, this.typeNames = typeNames, extendsOrImplementsKeyword.parent = this, !TypeScript.isShared(typeNames) && (typeNames.parent = this); } HeritageClauseSyntax.prototype.kind = function () { - return this.extendsOrImplementsKeyword.kind() === 48 /* ExtendsKeyword */ ? 230 /* ExtendsHeritageClause */ : 231 /* ImplementsHeritageClause */; + return this.extendsOrImplementsKeyword.kind() === 48 /* ExtendsKeyword */ ? 231 /* ExtendsHeritageClause */ : 232 /* ImplementsHeritageClause */; }; return HeritageClauseSyntax; })(TypeScript.SyntaxNode); @@ -24272,7 +24747,7 @@ var TypeScript; return ModuleNameModuleReferenceSyntax; })(TypeScript.SyntaxNode); Concrete.ModuleNameModuleReferenceSyntax = ModuleNameModuleReferenceSyntax; - SourceUnitSyntax.prototype.__kind = 120 /* SourceUnit */, QualifiedNameSyntax.prototype.__kind = 121 /* QualifiedName */, ObjectTypeSyntax.prototype.__kind = 122 /* ObjectType */, FunctionTypeSyntax.prototype.__kind = 123 /* FunctionType */, ArrayTypeSyntax.prototype.__kind = 124 /* ArrayType */, ConstructorTypeSyntax.prototype.__kind = 125 /* ConstructorType */, GenericTypeSyntax.prototype.__kind = 126 /* GenericType */, TypeQuerySyntax.prototype.__kind = 127 /* TypeQuery */, InterfaceDeclarationSyntax.prototype.__kind = 128 /* InterfaceDeclaration */, FunctionDeclarationSyntax.prototype.__kind = 129 /* FunctionDeclaration */, ModuleDeclarationSyntax.prototype.__kind = 130 /* ModuleDeclaration */, ClassDeclarationSyntax.prototype.__kind = 131 /* ClassDeclaration */, EnumDeclarationSyntax.prototype.__kind = 132 /* EnumDeclaration */, ImportDeclarationSyntax.prototype.__kind = 133 /* ImportDeclaration */, ExportAssignmentSyntax.prototype.__kind = 134 /* ExportAssignment */, MemberFunctionDeclarationSyntax.prototype.__kind = 135 /* MemberFunctionDeclaration */, MemberVariableDeclarationSyntax.prototype.__kind = 136 /* MemberVariableDeclaration */, ConstructorDeclarationSyntax.prototype.__kind = 137 /* ConstructorDeclaration */, IndexMemberDeclarationSyntax.prototype.__kind = 138 /* IndexMemberDeclaration */, GetAccessorSyntax.prototype.__kind = 139 /* GetAccessor */, SetAccessorSyntax.prototype.__kind = 140 /* SetAccessor */, PropertySignatureSyntax.prototype.__kind = 141 /* PropertySignature */, CallSignatureSyntax.prototype.__kind = 142 /* CallSignature */, ConstructSignatureSyntax.prototype.__kind = 143 /* ConstructSignature */, IndexSignatureSyntax.prototype.__kind = 144 /* IndexSignature */, MethodSignatureSyntax.prototype.__kind = 145 /* MethodSignature */, BlockSyntax.prototype.__kind = 146 /* Block */, IfStatementSyntax.prototype.__kind = 147 /* IfStatement */, VariableStatementSyntax.prototype.__kind = 148 /* VariableStatement */, ExpressionStatementSyntax.prototype.__kind = 149 /* ExpressionStatement */, ReturnStatementSyntax.prototype.__kind = 150 /* ReturnStatement */, SwitchStatementSyntax.prototype.__kind = 151 /* SwitchStatement */, BreakStatementSyntax.prototype.__kind = 152 /* BreakStatement */, ContinueStatementSyntax.prototype.__kind = 153 /* ContinueStatement */, ForStatementSyntax.prototype.__kind = 154 /* ForStatement */, ForInStatementSyntax.prototype.__kind = 155 /* ForInStatement */, EmptyStatementSyntax.prototype.__kind = 156 /* EmptyStatement */, ThrowStatementSyntax.prototype.__kind = 157 /* ThrowStatement */, WhileStatementSyntax.prototype.__kind = 158 /* WhileStatement */, TryStatementSyntax.prototype.__kind = 159 /* TryStatement */, LabeledStatementSyntax.prototype.__kind = 160 /* LabeledStatement */, DoStatementSyntax.prototype.__kind = 161 /* DoStatement */, DebuggerStatementSyntax.prototype.__kind = 162 /* DebuggerStatement */, WithStatementSyntax.prototype.__kind = 163 /* WithStatement */, DeleteExpressionSyntax.prototype.__kind = 170 /* DeleteExpression */, TypeOfExpressionSyntax.prototype.__kind = 171 /* TypeOfExpression */, VoidExpressionSyntax.prototype.__kind = 172 /* VoidExpression */, ConditionalExpressionSyntax.prototype.__kind = 186 /* ConditionalExpression */, MemberAccessExpressionSyntax.prototype.__kind = 212 /* MemberAccessExpression */, InvocationExpressionSyntax.prototype.__kind = 213 /* InvocationExpression */, ArrayLiteralExpressionSyntax.prototype.__kind = 214 /* ArrayLiteralExpression */, ObjectLiteralExpressionSyntax.prototype.__kind = 215 /* ObjectLiteralExpression */, ObjectCreationExpressionSyntax.prototype.__kind = 216 /* ObjectCreationExpression */, ParenthesizedExpressionSyntax.prototype.__kind = 217 /* ParenthesizedExpression */, ParenthesizedArrowFunctionExpressionSyntax.prototype.__kind = 218 /* ParenthesizedArrowFunctionExpression */, SimpleArrowFunctionExpressionSyntax.prototype.__kind = 219 /* SimpleArrowFunctionExpression */, CastExpressionSyntax.prototype.__kind = 220 /* CastExpression */, ElementAccessExpressionSyntax.prototype.__kind = 221 /* ElementAccessExpression */, FunctionExpressionSyntax.prototype.__kind = 222 /* FunctionExpression */, OmittedExpressionSyntax.prototype.__kind = 223 /* OmittedExpression */, VariableDeclarationSyntax.prototype.__kind = 224 /* VariableDeclaration */, VariableDeclaratorSyntax.prototype.__kind = 225 /* VariableDeclarator */, ArgumentListSyntax.prototype.__kind = 226 /* ArgumentList */, ParameterListSyntax.prototype.__kind = 227 /* ParameterList */, TypeArgumentListSyntax.prototype.__kind = 228 /* TypeArgumentList */, TypeParameterListSyntax.prototype.__kind = 229 /* TypeParameterList */, EqualsValueClauseSyntax.prototype.__kind = 232 /* EqualsValueClause */, CaseSwitchClauseSyntax.prototype.__kind = 233 /* CaseSwitchClause */, DefaultSwitchClauseSyntax.prototype.__kind = 234 /* DefaultSwitchClause */, ElseClauseSyntax.prototype.__kind = 235 /* ElseClause */, CatchClauseSyntax.prototype.__kind = 236 /* CatchClause */, FinallyClauseSyntax.prototype.__kind = 237 /* FinallyClause */, TypeParameterSyntax.prototype.__kind = 238 /* TypeParameter */, ConstraintSyntax.prototype.__kind = 239 /* Constraint */, SimplePropertyAssignmentSyntax.prototype.__kind = 240 /* SimplePropertyAssignment */, FunctionPropertyAssignmentSyntax.prototype.__kind = 241 /* FunctionPropertyAssignment */, ParameterSyntax.prototype.__kind = 242 /* Parameter */, EnumElementSyntax.prototype.__kind = 243 /* EnumElement */, TypeAnnotationSyntax.prototype.__kind = 244 /* TypeAnnotation */, ExternalModuleReferenceSyntax.prototype.__kind = 245 /* ExternalModuleReference */, ModuleNameModuleReferenceSyntax.prototype.__kind = 246 /* ModuleNameModuleReference */; + SourceUnitSyntax.prototype.__kind = 120 /* SourceUnit */, QualifiedNameSyntax.prototype.__kind = 121 /* QualifiedName */, ObjectTypeSyntax.prototype.__kind = 122 /* ObjectType */, FunctionTypeSyntax.prototype.__kind = 123 /* FunctionType */, ArrayTypeSyntax.prototype.__kind = 124 /* ArrayType */, ConstructorTypeSyntax.prototype.__kind = 125 /* ConstructorType */, GenericTypeSyntax.prototype.__kind = 126 /* GenericType */, TypeQuerySyntax.prototype.__kind = 127 /* TypeQuery */, TupleTypeSyntax.prototype.__kind = 128 /* TupleType */, InterfaceDeclarationSyntax.prototype.__kind = 129 /* InterfaceDeclaration */, FunctionDeclarationSyntax.prototype.__kind = 130 /* FunctionDeclaration */, ModuleDeclarationSyntax.prototype.__kind = 131 /* ModuleDeclaration */, ClassDeclarationSyntax.prototype.__kind = 132 /* ClassDeclaration */, EnumDeclarationSyntax.prototype.__kind = 133 /* EnumDeclaration */, ImportDeclarationSyntax.prototype.__kind = 134 /* ImportDeclaration */, ExportAssignmentSyntax.prototype.__kind = 135 /* ExportAssignment */, MemberFunctionDeclarationSyntax.prototype.__kind = 136 /* MemberFunctionDeclaration */, MemberVariableDeclarationSyntax.prototype.__kind = 137 /* MemberVariableDeclaration */, ConstructorDeclarationSyntax.prototype.__kind = 138 /* ConstructorDeclaration */, IndexMemberDeclarationSyntax.prototype.__kind = 139 /* IndexMemberDeclaration */, GetAccessorSyntax.prototype.__kind = 140 /* GetAccessor */, SetAccessorSyntax.prototype.__kind = 141 /* SetAccessor */, PropertySignatureSyntax.prototype.__kind = 142 /* PropertySignature */, CallSignatureSyntax.prototype.__kind = 143 /* CallSignature */, ConstructSignatureSyntax.prototype.__kind = 144 /* ConstructSignature */, IndexSignatureSyntax.prototype.__kind = 145 /* IndexSignature */, MethodSignatureSyntax.prototype.__kind = 146 /* MethodSignature */, BlockSyntax.prototype.__kind = 147 /* Block */, IfStatementSyntax.prototype.__kind = 148 /* IfStatement */, VariableStatementSyntax.prototype.__kind = 149 /* VariableStatement */, ExpressionStatementSyntax.prototype.__kind = 150 /* ExpressionStatement */, ReturnStatementSyntax.prototype.__kind = 151 /* ReturnStatement */, SwitchStatementSyntax.prototype.__kind = 152 /* SwitchStatement */, BreakStatementSyntax.prototype.__kind = 153 /* BreakStatement */, ContinueStatementSyntax.prototype.__kind = 154 /* ContinueStatement */, ForStatementSyntax.prototype.__kind = 155 /* ForStatement */, ForInStatementSyntax.prototype.__kind = 156 /* ForInStatement */, EmptyStatementSyntax.prototype.__kind = 157 /* EmptyStatement */, ThrowStatementSyntax.prototype.__kind = 158 /* ThrowStatement */, WhileStatementSyntax.prototype.__kind = 159 /* WhileStatement */, TryStatementSyntax.prototype.__kind = 160 /* TryStatement */, LabeledStatementSyntax.prototype.__kind = 161 /* LabeledStatement */, DoStatementSyntax.prototype.__kind = 162 /* DoStatement */, DebuggerStatementSyntax.prototype.__kind = 163 /* DebuggerStatement */, WithStatementSyntax.prototype.__kind = 164 /* WithStatement */, DeleteExpressionSyntax.prototype.__kind = 171 /* DeleteExpression */, TypeOfExpressionSyntax.prototype.__kind = 172 /* TypeOfExpression */, VoidExpressionSyntax.prototype.__kind = 173 /* VoidExpression */, ConditionalExpressionSyntax.prototype.__kind = 187 /* ConditionalExpression */, MemberAccessExpressionSyntax.prototype.__kind = 213 /* MemberAccessExpression */, InvocationExpressionSyntax.prototype.__kind = 214 /* InvocationExpression */, ArrayLiteralExpressionSyntax.prototype.__kind = 215 /* ArrayLiteralExpression */, ObjectLiteralExpressionSyntax.prototype.__kind = 216 /* ObjectLiteralExpression */, ObjectCreationExpressionSyntax.prototype.__kind = 217 /* ObjectCreationExpression */, ParenthesizedExpressionSyntax.prototype.__kind = 218 /* ParenthesizedExpression */, ParenthesizedArrowFunctionExpressionSyntax.prototype.__kind = 219 /* ParenthesizedArrowFunctionExpression */, SimpleArrowFunctionExpressionSyntax.prototype.__kind = 220 /* SimpleArrowFunctionExpression */, CastExpressionSyntax.prototype.__kind = 221 /* CastExpression */, ElementAccessExpressionSyntax.prototype.__kind = 222 /* ElementAccessExpression */, FunctionExpressionSyntax.prototype.__kind = 223 /* FunctionExpression */, OmittedExpressionSyntax.prototype.__kind = 224 /* OmittedExpression */, VariableDeclarationSyntax.prototype.__kind = 225 /* VariableDeclaration */, VariableDeclaratorSyntax.prototype.__kind = 226 /* VariableDeclarator */, ArgumentListSyntax.prototype.__kind = 227 /* ArgumentList */, ParameterListSyntax.prototype.__kind = 228 /* ParameterList */, TypeArgumentListSyntax.prototype.__kind = 229 /* TypeArgumentList */, TypeParameterListSyntax.prototype.__kind = 230 /* TypeParameterList */, EqualsValueClauseSyntax.prototype.__kind = 233 /* EqualsValueClause */, CaseSwitchClauseSyntax.prototype.__kind = 234 /* CaseSwitchClause */, DefaultSwitchClauseSyntax.prototype.__kind = 235 /* DefaultSwitchClause */, ElseClauseSyntax.prototype.__kind = 236 /* ElseClause */, CatchClauseSyntax.prototype.__kind = 237 /* CatchClause */, FinallyClauseSyntax.prototype.__kind = 238 /* FinallyClause */, TypeParameterSyntax.prototype.__kind = 239 /* TypeParameter */, ConstraintSyntax.prototype.__kind = 240 /* Constraint */, SimplePropertyAssignmentSyntax.prototype.__kind = 241 /* SimplePropertyAssignment */, FunctionPropertyAssignmentSyntax.prototype.__kind = 242 /* FunctionPropertyAssignment */, ParameterSyntax.prototype.__kind = 243 /* Parameter */, EnumElementSyntax.prototype.__kind = 244 /* EnumElement */, TypeAnnotationSyntax.prototype.__kind = 245 /* TypeAnnotation */, ExternalModuleReferenceSyntax.prototype.__kind = 246 /* ExternalModuleReference */, ModuleNameModuleReferenceSyntax.prototype.__kind = 247 /* ModuleNameModuleReference */; })(Concrete = Syntax.Concrete || (Syntax.Concrete = {})); })(Syntax = TypeScript.Syntax || (TypeScript.Syntax = {})); })(TypeScript || (TypeScript = {})); @@ -24450,7 +24925,7 @@ var TypeScript; return false; }; GrammarCheckerWalker.prototype.checkParameterAccessibilityModifier = function (parameterList, modifier, modifierIndex) { - if (modifier.kind() !== 57 /* PublicKeyword */ && modifier.kind() !== 55 /* PrivateKeyword */) { + if (!TypeScript.SyntaxFacts.isAccessibilityModifier(modifier.kind())) { this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_parameter, [modifier.text()]); return true; } @@ -24507,6 +24982,12 @@ var TypeScript; } _super.prototype.visitTypeArgumentList.call(this, node); }; + GrammarCheckerWalker.prototype.visitTupleType = function (node) { + if (this.checkForTrailingComma(node.types) || this.checkForAtLeastOneElement(node, node.types, node.openBracketToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, null))) { + return; + } + _super.prototype.visitTupleType.call(this, node); + }; GrammarCheckerWalker.prototype.visitTypeParameterList = function (node) { if (this.checkForTrailingComma(node.typeParameters) || this.checkForAtLeastOneElement(node, node.typeParameters, node.lessThanToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_parameter, null))) { return; @@ -24655,7 +25136,7 @@ var TypeScript; var seenStaticModifier = false; for (var i = 0, n = list.length; i < n; i++) { var modifier = list[i]; - if (modifier.kind() === 57 /* PublicKeyword */ || modifier.kind() === 55 /* PrivateKeyword */) { + if (TypeScript.SyntaxFacts.isAccessibilityModifier(modifier.kind())) { if (seenAccessibilityModifier) { this.pushDiagnostic(modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); return true; @@ -24828,7 +25309,7 @@ var TypeScript; var seenDeclareModifier = false; for (var i = 0, n = modifiers.length; i < n; i++) { var modifier = modifiers[i]; - if (modifier.kind() === 57 /* PublicKeyword */ || modifier.kind() === 55 /* PrivateKeyword */ || modifier.kind() === 58 /* StaticKeyword */) { + if (TypeScript.SyntaxFacts.isAccessibilityModifier(modifier.kind()) || modifier.kind() === 58 /* StaticKeyword */) { this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_module_element, [modifier.text()]); return true; } @@ -24857,9 +25338,9 @@ var TypeScript; if (!node.stringLiteral) { for (var i = 0, n = node.moduleElements.length; i < n; i++) { var child = node.moduleElements[i]; - if (child.kind() === 133 /* ImportDeclaration */) { + if (child.kind() === 134 /* ImportDeclaration */) { var importDeclaration = child; - if (importDeclaration.moduleReference.kind() === 245 /* ExternalModuleReference */) { + if (importDeclaration.moduleReference.kind() === 246 /* ExternalModuleReference */) { this.pushDiagnostic(importDeclaration, TypeScript.DiagnosticCode.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); } } @@ -24901,7 +25382,7 @@ var TypeScript; GrammarCheckerWalker.prototype.checkForDisallowedExportAssignment = function (node) { for (var i = 0, n = node.moduleElements.length; i < n; i++) { var child = node.moduleElements[i]; - if (child.kind() === 134 /* ExportAssignment */) { + if (child.kind() === 135 /* ExportAssignment */) { this.pushDiagnostic(child, TypeScript.DiagnosticCode.Export_assignment_cannot_be_used_in_internal_modules); return true; } @@ -24975,7 +25456,7 @@ var TypeScript; }; GrammarCheckerWalker.prototype.inSwitchStatement = function (ast) { while (ast) { - if (ast.kind() === 151 /* SwitchStatement */) { + if (ast.kind() === 152 /* SwitchStatement */) { return true; } if (TypeScript.SyntaxUtilities.isAnyFunctionExpressionOrDeclaration(ast)) { @@ -24987,10 +25468,10 @@ var TypeScript; }; GrammarCheckerWalker.prototype.isIterationStatement = function (ast) { switch (ast.kind()) { - case 154 /* ForStatement */: - case 155 /* ForInStatement */: - case 158 /* WhileStatement */: - case 161 /* DoStatement */: + case 155 /* ForStatement */: + case 156 /* ForInStatement */: + case 159 /* WhileStatement */: + case 162 /* DoStatement */: return true; } return false; @@ -25011,7 +25492,7 @@ var TypeScript; var result = []; element = element.parent; while (element) { - if (element.kind() === 160 /* LabeledStatement */) { + if (element.kind() === 161 /* LabeledStatement */) { var labeledStatement = element; if (breakable) { result.push(labeledStatement); @@ -25031,12 +25512,12 @@ var TypeScript; }; GrammarCheckerWalker.prototype.labelIsOnContinuableConstruct = function (statement) { switch (statement.kind()) { - case 160 /* LabeledStatement */: + case 161 /* LabeledStatement */: return this.labelIsOnContinuableConstruct(statement.statement); - case 158 /* WhileStatement */: - case 154 /* ForStatement */: - case 155 /* ForInStatement */: - case 161 /* DoStatement */: + case 159 /* WhileStatement */: + case 155 /* ForStatement */: + case 156 /* ForInStatement */: + case 162 /* DoStatement */: return true; default: return false; @@ -25267,7 +25748,7 @@ var TypeScript; _super.prototype.visitVariableDeclarator.call(this, node); }; GrammarCheckerWalker.prototype.checkVariableDeclaratorIdentifier = function (node) { - if (node.parent.kind() !== 136 /* MemberVariableDeclaration */) { + if (node.parent.kind() !== 137 /* MemberVariableDeclaration */) { if (this.checkForDisallowedEvalOrArguments(node, node.propertyName)) { return true; } @@ -25346,8 +25827,8 @@ var TypeScript; }; GrammarCheckerWalker.prototype.isPreIncrementOrDecrementExpression = function (node) { switch (node.kind()) { - case 169 /* PreDecrementExpression */: - case 168 /* PreIncrementExpression */: + case 170 /* PreDecrementExpression */: + case 169 /* PreIncrementExpression */: return true; } return false; @@ -25435,9 +25916,9 @@ var TypeScript; if (_firstToken !== null && _firstToken.kind() === 47 /* ExportKeyword */) { return new TypeScript.TextSpan(TypeScript.start(_firstToken), TypeScript.width(_firstToken)); } - if (moduleElement.kind() === 133 /* ImportDeclaration */) { + if (moduleElement.kind() === 134 /* ImportDeclaration */) { var importDecl = moduleElement; - if (importDecl.moduleReference.kind() === 245 /* ExternalModuleReference */) { + if (importDecl.moduleReference.kind() === 246 /* ExternalModuleReference */) { var literal = importDecl.moduleReference.stringLiteral; return new TypeScript.TextSpan(TypeScript.start(literal), TypeScript.width(literal)); } @@ -25931,23 +26412,23 @@ var ts; return; } switch (n.kind) { - case 143 /* Block */: - case 168 /* FunctionBlock */: - case 173 /* ModuleBlock */: - case 162 /* TryBlock */: - case 162 /* TryBlock */: - case 163 /* CatchBlock */: - case 164 /* FinallyBlock */: - var openBrace = ts.forEach(n.getChildren(), function (c) { return c.kind === 5 /* OpenBraceToken */ && c; }); - var closeBrace = ts.forEach(n.getChildren(), function (c) { return c.kind === 6 /* CloseBraceToken */ && c; }); + case 148 /* Block */: + case 173 /* FunctionBlock */: + case 178 /* ModuleBlock */: + case 167 /* TryBlock */: + case 167 /* TryBlock */: + case 168 /* CatchBlock */: + case 169 /* FinallyBlock */: + var openBrace = ts.forEach(n.getChildren(), function (c) { return c.kind === 9 /* OpenBraceToken */ && c; }); + var closeBrace = ts.forEach(n.getChildren(), function (c) { return c.kind === 10 /* CloseBraceToken */ && c; }); addOutlineRange(n.parent, openBrace, closeBrace); break; - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 171 /* EnumDeclaration */: - case 128 /* ObjectLiteral */: - var openBrace = ts.forEach(n.getChildren(), function (c) { return c.kind === 5 /* OpenBraceToken */ && c; }); - var closeBrace = ts.forEach(n.getChildren(), function (c) { return c.kind === 6 /* CloseBraceToken */ && c; }); + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: + case 133 /* ObjectLiteral */: + var openBrace = ts.forEach(n.getChildren(), function (c) { return c.kind === 9 /* OpenBraceToken */ && c; }); + var closeBrace = ts.forEach(n.getChildren(), function (c) { return c.kind === 10 /* CloseBraceToken */ && c; }); addOutlineRange(n, openBrace, closeBrace); break; } @@ -25973,7 +26454,7 @@ var TypeScript; var indent = this.hasGlobalNode ? 1 : 0; var current = node.parent; while (current != null) { - if (current.kind() == 130 /* ModuleDeclaration */ || current.kind() === 129 /* FunctionDeclaration */) { + if (current.kind() == 131 /* ModuleDeclaration */ || current.kind() === 130 /* FunctionDeclaration */) { indent++; } current = current.parent; @@ -25995,10 +26476,10 @@ var TypeScript; var childNodes = []; for (var i = 0, n = nodes.length; i < n; i++) { var node = nodes[i]; - if (node.kind() === 129 /* FunctionDeclaration */) { + if (node.kind() === 130 /* FunctionDeclaration */) { childNodes.push(node); } - else if (node.kind() === 148 /* VariableStatement */) { + else if (node.kind() === 149 /* VariableStatement */) { var variableDeclaration = node.variableDeclaration; childNodes.push.apply(childNodes, variableDeclaration.variableDeclarators); } @@ -26015,17 +26496,17 @@ var TypeScript; for (var i = 0, n = nodes.length; i < n; i++) { var node = nodes[i]; switch (node.kind()) { - case 131 /* ClassDeclaration */: - case 132 /* EnumDeclaration */: - case 128 /* InterfaceDeclaration */: + case 132 /* ClassDeclaration */: + case 133 /* EnumDeclaration */: + case 129 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 130 /* ModuleDeclaration */: + case 131 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); this.addTopLevelNodes(moduleDeclaration.moduleElements, topLevelNodes); break; - case 129 /* FunctionDeclaration */: + case 130 /* FunctionDeclaration */: var functionDeclaration = node; if (this.isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -26036,7 +26517,7 @@ var TypeScript; } }; NavigationBarItemGetter.prototype.isTopLevelFunctionDeclaration = function (functionDeclaration) { - return functionDeclaration.block && TypeScript.ArrayUtilities.any(functionDeclaration.block.statements, function (s) { return s.kind() === 129 /* FunctionDeclaration */; }); + return functionDeclaration.block && TypeScript.ArrayUtilities.any(functionDeclaration.block.statements, function (s) { return s.kind() === 130 /* FunctionDeclaration */; }); }; NavigationBarItemGetter.prototype.getItemsWorker = function (getNodes, createItem) { var items = []; @@ -26082,52 +26563,52 @@ var TypeScript; }; NavigationBarItemGetter.prototype.createChildItem = function (node) { switch (node.kind()) { - case 242 /* Parameter */: + case 243 /* Parameter */: var parameter = node; if (parameter.modifiers.length === 0) { return null; } return new ts.NavigationBarItem(parameter.identifier.text(), ts.ScriptElementKind.memberVariableElement, this.getKindModifiers(parameter.modifiers), [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); - case 135 /* MemberFunctionDeclaration */: + case 136 /* MemberFunctionDeclaration */: var memberFunction = node; return new ts.NavigationBarItem(memberFunction.propertyName.text(), ts.ScriptElementKind.memberFunctionElement, this.getKindModifiers(memberFunction.modifiers), [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); - case 139 /* GetAccessor */: + case 140 /* GetAccessor */: var getAccessor = node; return new ts.NavigationBarItem(getAccessor.propertyName.text(), ts.ScriptElementKind.memberGetAccessorElement, this.getKindModifiers(getAccessor.modifiers), [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); - case 140 /* SetAccessor */: + case 141 /* SetAccessor */: var setAccessor = node; return new ts.NavigationBarItem(setAccessor.propertyName.text(), ts.ScriptElementKind.memberSetAccessorElement, this.getKindModifiers(setAccessor.modifiers), [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); - case 144 /* IndexSignature */: + case 145 /* IndexSignature */: var indexSignature = node; return new ts.NavigationBarItem("[]", ts.ScriptElementKind.indexSignatureElement, ts.ScriptElementKindModifier.none, [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); - case 243 /* EnumElement */: + case 244 /* EnumElement */: var enumElement = node; return new ts.NavigationBarItem(enumElement.propertyName.text(), ts.ScriptElementKind.memberVariableElement, ts.ScriptElementKindModifier.none, [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); - case 142 /* CallSignature */: + case 143 /* CallSignature */: var callSignature = node; return new ts.NavigationBarItem("()", ts.ScriptElementKind.callSignatureElement, ts.ScriptElementKindModifier.none, [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); - case 143 /* ConstructSignature */: + case 144 /* ConstructSignature */: var constructSignature = node; return new ts.NavigationBarItem("new()", ts.ScriptElementKind.constructSignatureElement, ts.ScriptElementKindModifier.none, [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); - case 145 /* MethodSignature */: + case 146 /* MethodSignature */: var methodSignature = node; return new ts.NavigationBarItem(methodSignature.propertyName.text(), ts.ScriptElementKind.memberFunctionElement, ts.ScriptElementKindModifier.none, [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); - case 141 /* PropertySignature */: + case 142 /* PropertySignature */: var propertySignature = node; return new ts.NavigationBarItem(propertySignature.propertyName.text(), ts.ScriptElementKind.memberVariableElement, ts.ScriptElementKindModifier.none, [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); - case 129 /* FunctionDeclaration */: + case 130 /* FunctionDeclaration */: var functionDeclaration = node; if (!this.isTopLevelFunctionDeclaration(functionDeclaration)) { return new ts.NavigationBarItem(functionDeclaration.identifier.text(), ts.ScriptElementKind.functionElement, this.getKindModifiers(functionDeclaration.modifiers), [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); } break; - case 136 /* MemberVariableDeclaration */: + case 137 /* MemberVariableDeclaration */: var memberVariableDeclaration = node; return new ts.NavigationBarItem(memberVariableDeclaration.variableDeclarator.propertyName.text(), ts.ScriptElementKind.memberVariableElement, this.getKindModifiers(memberVariableDeclaration.modifiers), [TypeScript.TextSpan.fromBounds(TypeScript.start(memberVariableDeclaration.variableDeclarator), TypeScript.end(memberVariableDeclaration.variableDeclarator))]); - case 225 /* VariableDeclarator */: + case 226 /* VariableDeclarator */: var variableDeclarator = node; return new ts.NavigationBarItem(variableDeclarator.propertyName.text(), ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, [TypeScript.TextSpan.fromBounds(TypeScript.start(variableDeclarator), TypeScript.end(variableDeclarator))]); - case 137 /* ConstructorDeclaration */: + case 138 /* ConstructorDeclaration */: var constructorDeclaration = node; return new ts.NavigationBarItem("constructor", ts.ScriptElementKind.constructorImplementationElement, ts.ScriptElementKindModifier.none, [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))]); } @@ -26137,15 +26618,15 @@ var TypeScript; switch (node.kind()) { case 120 /* SourceUnit */: return this.createSourceUnitItem(node); - case 131 /* ClassDeclaration */: + case 132 /* ClassDeclaration */: return this.createClassItem(node); - case 132 /* EnumDeclaration */: + case 133 /* EnumDeclaration */: return this.createEnumItem(node); - case 128 /* InterfaceDeclaration */: + case 129 /* InterfaceDeclaration */: return this.createIterfaceItem(node); - case 130 /* ModuleDeclaration */: + case 131 /* ModuleDeclaration */: return this.createModuleItem(node); - case 129 /* FunctionDeclaration */: + case 130 /* FunctionDeclaration */: return this.createFunctionItem(node); } return null; @@ -26192,7 +26673,7 @@ var TypeScript; }; NavigationBarItemGetter.prototype.createClassItem = function (node) { var _this = this; - var constructor = TypeScript.ArrayUtilities.firstOrDefault(node.classElements, function (n) { return n.kind() === 137 /* ConstructorDeclaration */; }); + var constructor = TypeScript.ArrayUtilities.firstOrDefault(node.classElements, function (n) { return n.kind() === 138 /* ConstructorDeclaration */; }); var nodes = constructor ? constructor.callSignature.parameterList.parameters.concat(node.classElements) : node.classElements; var childItems = this.getItemsWorker(function () { return nodes; }, function (n) { return _this.createChildItem(n); }); return new ts.NavigationBarItem(node.identifier.text(), ts.ScriptElementKind.classElement, this.getKindModifiers(node.modifiers), [TypeScript.TextSpan.fromBounds(TypeScript.start(node), TypeScript.end(node))], childItems, this.getIndent(node)); @@ -26325,7 +26806,7 @@ var TypeScript; return this.breakpointSpanOfCloseParen(positionedToken); case 22 /* DoKeyword */: var parentElement = positionedToken.parent; - if (parentElement && parentElement.kind() == 161 /* DoStatement */) { + if (parentElement && parentElement.kind() == 162 /* DoStatement */) { return this.breakpointSpanIfStartsOnSameLine(TypeScript.nextToken(positionedToken)); } break; @@ -26336,29 +26817,29 @@ var TypeScript; var container = TypeScript.Syntax.containingNode(openBraceToken); if (container) { var originalContainer = container; - if (container && container.kind() == 146 /* Block */) { + if (container && container.kind() == 147 /* Block */) { container = TypeScript.Syntax.containingNode(container); if (!container) { container = originalContainer; } } switch (container.kind()) { - case 146 /* Block */: + case 147 /* Block */: if (!this.canHaveBreakpointInBlock(container)) { return null; } return this.breakpointSpanOfFirstStatementInBlock(container); break; - case 130 /* ModuleDeclaration */: - case 131 /* ClassDeclaration */: - case 129 /* FunctionDeclaration */: - case 137 /* ConstructorDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 222 /* FunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 219 /* SimpleArrowFunctionExpression */: + case 131 /* ModuleDeclaration */: + case 132 /* ClassDeclaration */: + case 130 /* FunctionDeclaration */: + case 138 /* ConstructorDeclaration */: + case 136 /* MemberFunctionDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 223 /* FunctionExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: + case 220 /* SimpleArrowFunctionExpression */: if (!this.canHaveBreakpointInDeclaration(container)) { return null; } @@ -26368,7 +26849,7 @@ var TypeScript; else { return this.breakpointSpanOf(container); } - case 132 /* EnumDeclaration */: + case 133 /* EnumDeclaration */: if (!this.canHaveBreakpointInDeclaration(container)) { return null; } @@ -26378,33 +26859,33 @@ var TypeScript; else { return this.breakpointSpanOf(container); } - case 147 /* IfStatement */: - case 155 /* ForInStatement */: - case 158 /* WhileStatement */: - case 236 /* CatchClause */: + case 148 /* IfStatement */: + case 156 /* ForInStatement */: + case 159 /* WhileStatement */: + case 237 /* CatchClause */: if (this.posLine != this.lineMap.getLineNumberFromPosition(TypeScript.start(container))) { return this.breakpointSpanOfFirstStatementInBlock(originalContainer); } else { return this.breakpointSpanOf(container); } - case 161 /* DoStatement */: + case 162 /* DoStatement */: return this.breakpointSpanOfFirstStatementInBlock(originalContainer); - case 154 /* ForStatement */: + case 155 /* ForStatement */: if (this.posLine != this.lineMap.getLineNumberFromPosition(TypeScript.start(container))) { return this.breakpointSpanOfFirstStatementInBlock(originalContainer); } else { return this.breakpointSpanOf(TypeScript.previousToken(openBraceToken)); } - case 235 /* ElseClause */: - case 233 /* CaseSwitchClause */: - case 234 /* DefaultSwitchClause */: - case 163 /* WithStatement */: - case 159 /* TryStatement */: - case 237 /* FinallyClause */: + case 236 /* ElseClause */: + case 234 /* CaseSwitchClause */: + case 235 /* DefaultSwitchClause */: + case 164 /* WithStatement */: + case 160 /* TryStatement */: + case 238 /* FinallyClause */: return this.breakpointSpanOfFirstStatementInBlock(originalContainer); - case 151 /* SwitchStatement */: + case 152 /* SwitchStatement */: if (this.posLine != this.lineMap.getLineNumberFromPosition(TypeScript.start(container))) { return this.breakpointSpanOfFirstStatementOfFirstCaseClause(container); } @@ -26419,20 +26900,20 @@ var TypeScript; var container = TypeScript.Syntax.containingNode(closeBraceToken); if (container) { var originalContainer = container; - if (container.kind() == 146 /* Block */) { + if (container.kind() == 147 /* Block */) { container = TypeScript.Syntax.containingNode(container); if (!container) { container = originalContainer; } } switch (container.kind()) { - case 146 /* Block */: + case 147 /* Block */: if (!this.canHaveBreakpointInBlock(container)) { return null; } return this.breakpointSpanOfLastStatementInBlock(container); break; - case 130 /* ModuleDeclaration */: + case 131 /* ModuleDeclaration */: if (!this.canHaveBreakpointInDeclaration(container)) { return null; } @@ -26443,38 +26924,38 @@ var TypeScript; else { return null; } - case 131 /* ClassDeclaration */: - case 129 /* FunctionDeclaration */: - case 137 /* ConstructorDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 222 /* FunctionExpression */: + case 132 /* ClassDeclaration */: + case 130 /* FunctionDeclaration */: + case 138 /* ConstructorDeclaration */: + case 136 /* MemberFunctionDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 223 /* FunctionExpression */: if (!this.canHaveBreakpointInDeclaration(container)) { return null; } return createBreakpointSpanInfo(closeBraceToken); - case 132 /* EnumDeclaration */: + case 133 /* EnumDeclaration */: if (!this.canHaveBreakpointInDeclaration(container)) { return null; } return createBreakpointSpanInfo(closeBraceToken); - case 147 /* IfStatement */: - case 235 /* ElseClause */: - case 155 /* ForInStatement */: - case 154 /* ForStatement */: - case 158 /* WhileStatement */: - case 161 /* DoStatement */: - case 233 /* CaseSwitchClause */: - case 234 /* DefaultSwitchClause */: - case 163 /* WithStatement */: - case 159 /* TryStatement */: - case 236 /* CatchClause */: - case 237 /* FinallyClause */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 219 /* SimpleArrowFunctionExpression */: + case 148 /* IfStatement */: + case 236 /* ElseClause */: + case 156 /* ForInStatement */: + case 155 /* ForStatement */: + case 159 /* WhileStatement */: + case 162 /* DoStatement */: + case 234 /* CaseSwitchClause */: + case 235 /* DefaultSwitchClause */: + case 164 /* WithStatement */: + case 160 /* TryStatement */: + case 237 /* CatchClause */: + case 238 /* FinallyClause */: + case 219 /* ParenthesizedArrowFunctionExpression */: + case 220 /* SimpleArrowFunctionExpression */: return this.breakpointSpanOfLastStatementInBlock(originalContainer); - case 151 /* SwitchStatement */: + case 152 /* SwitchStatement */: return this.breakpointSpanOfLastStatementOfLastCaseClause(container); } } @@ -26486,15 +26967,15 @@ var TypeScript; var grandParent = commaParent.parent; if (grandParent) { switch (grandParent.kind()) { - case 224 /* VariableDeclaration */: - case 132 /* EnumDeclaration */: - case 227 /* ParameterList */: + case 225 /* VariableDeclaration */: + case 133 /* EnumDeclaration */: + case 228 /* ParameterList */: var index = TypeScript.Syntax.childIndex(commaParent, commaToken); if (index > 0) { var child = TypeScript.childAt(commaParent, index - 1); return this.breakpointSpanOf(child); } - if (grandParent.kind() == 132 /* EnumDeclaration */) { + if (grandParent.kind() == 133 /* EnumDeclaration */) { return null; } break; @@ -26507,8 +26988,8 @@ var TypeScript; var closeParenParent = closeParenToken.parent; if (closeParenParent) { switch (closeParenParent.kind()) { - case 154 /* ForStatement */: - case 227 /* ParameterList */: + case 155 /* ForStatement */: + case 228 /* ParameterList */: return this.breakpointSpanOf(TypeScript.previousToken(closeParenToken)); } } @@ -26531,7 +27012,7 @@ var TypeScript; return null; } var firstStatement = TypeScript.childAt(statementsNode, 0); - if (firstStatement && firstStatement.kind() == 146 /* Block */) { + if (firstStatement && firstStatement.kind() == 147 /* Block */) { if (this.canHaveBreakpointInBlock(firstStatement)) { return this.breakpointSpanOfFirstStatementInBlock(firstStatement); } @@ -26551,7 +27032,7 @@ var TypeScript; return null; } var lastStatement = TypeScript.childAt(statementsNode, statementsNode.length - 1); - if (lastStatement && lastStatement.kind() == 146 /* Block */) { + if (lastStatement && lastStatement.kind() == 147 /* Block */) { if (this.canHaveBreakpointInBlock(lastStatement)) { return this.breakpointSpanOfLastStatementInBlock(lastStatement); } @@ -26570,7 +27051,7 @@ var TypeScript; return null; } var firstStatement = TypeScript.childAt(positionedList, 0); - if (firstStatement && firstStatement.kind() == 146 /* Block */) { + if (firstStatement && firstStatement.kind() == 147 /* Block */) { if (this.canHaveBreakpointInBlock(firstStatement)) { return this.breakpointSpanOfFirstStatementInBlock(firstStatement); } @@ -26589,7 +27070,7 @@ var TypeScript; return null; } var lastStatement = TypeScript.childAt(positionedList, 0); - if (lastStatement && lastStatement.kind() == 146 /* Block */) { + if (lastStatement && lastStatement.kind() == 147 /* Block */) { if (this.canHaveBreakpointInBlock(lastStatement)) { return this.breakpointSpanOfLastStatementInBlock(lastStatement); } @@ -26602,60 +27083,60 @@ var TypeScript; BreakpointResolver.prototype.breakpointSpanOfNode = function (positionedNode) { var node = positionedNode; switch (node.kind()) { - case 130 /* ModuleDeclaration */: - case 131 /* ClassDeclaration */: - case 129 /* FunctionDeclaration */: - case 137 /* ConstructorDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 222 /* FunctionExpression */: + case 131 /* ModuleDeclaration */: + case 132 /* ClassDeclaration */: + case 130 /* FunctionDeclaration */: + case 138 /* ConstructorDeclaration */: + case 136 /* MemberFunctionDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 223 /* FunctionExpression */: return this.breakpointSpanOfDeclarationWithElements(positionedNode); - case 225 /* VariableDeclarator */: + case 226 /* VariableDeclarator */: return this.breakpointSpanOfVariableDeclarator(positionedNode); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return this.breakpointSpanOfVariableDeclaration(positionedNode); - case 148 /* VariableStatement */: + case 149 /* VariableStatement */: return this.breakpointSpanOfVariableStatement(positionedNode); - case 242 /* Parameter */: + case 243 /* Parameter */: return this.breakpointSpanOfParameter(positionedNode); - case 136 /* MemberVariableDeclaration */: + case 137 /* MemberVariableDeclaration */: return this.breakpointSpanOfMemberVariableDeclaration(positionedNode); - case 133 /* ImportDeclaration */: + case 134 /* ImportDeclaration */: return this.breakpointSpanOfImportDeclaration(positionedNode); - case 132 /* EnumDeclaration */: + case 133 /* EnumDeclaration */: return this.breakpointSpanOfEnumDeclaration(positionedNode); - case 243 /* EnumElement */: + case 244 /* EnumElement */: return this.breakpointSpanOfEnumElement(positionedNode); - case 147 /* IfStatement */: + case 148 /* IfStatement */: return this.breakpointSpanOfIfStatement(positionedNode); - case 235 /* ElseClause */: + case 236 /* ElseClause */: return this.breakpointSpanOfElseClause(positionedNode); - case 155 /* ForInStatement */: + case 156 /* ForInStatement */: return this.breakpointSpanOfForInStatement(positionedNode); - case 154 /* ForStatement */: + case 155 /* ForStatement */: return this.breakpointSpanOfForStatement(positionedNode); - case 158 /* WhileStatement */: + case 159 /* WhileStatement */: return this.breakpointSpanOfWhileStatement(positionedNode); - case 161 /* DoStatement */: + case 162 /* DoStatement */: return this.breakpointSpanOfDoStatement(positionedNode); - case 151 /* SwitchStatement */: + case 152 /* SwitchStatement */: return this.breakpointSpanOfSwitchStatement(positionedNode); - case 233 /* CaseSwitchClause */: + case 234 /* CaseSwitchClause */: return this.breakpointSpanOfCaseSwitchClause(positionedNode); - case 234 /* DefaultSwitchClause */: + case 235 /* DefaultSwitchClause */: return this.breakpointSpanOfDefaultSwitchClause(positionedNode); - case 163 /* WithStatement */: + case 164 /* WithStatement */: return this.breakpointSpanOfWithStatement(positionedNode); - case 159 /* TryStatement */: + case 160 /* TryStatement */: return this.breakpointSpanOfTryStatement(positionedNode); - case 236 /* CatchClause */: + case 237 /* CatchClause */: return this.breakpointSpanOfCatchClause(positionedNode); - case 237 /* FinallyClause */: + case 238 /* FinallyClause */: return this.breakpointSpanOfFinallyClause(positionedNode); - case 218 /* ParenthesizedArrowFunctionExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: return this.breakpointSpanOfParenthesizedArrowFunctionExpression(positionedNode); - case 219 /* SimpleArrowFunctionExpression */: + case 220 /* SimpleArrowFunctionExpression */: return this.breakpointSpanOfSimpleArrowFunctionExpression(positionedNode); default: if (TypeScript.SyntaxUtilities.isStatement(node)) { @@ -26672,17 +27153,17 @@ var TypeScript; } var expressionParent = expression.parent; if (expressionParent) { - if (expressionParent.kind() == 218 /* ParenthesizedArrowFunctionExpression */) { + if (expressionParent.kind() == 219 /* ParenthesizedArrowFunctionExpression */) { var parenthesizedArrowExpression = expressionParent; var expressionOfParenthesizedArrowExpression = parenthesizedArrowExpression.expression; return expressionOfParenthesizedArrowExpression == expression; } - else if (expressionParent.kind() == 219 /* SimpleArrowFunctionExpression */) { + else if (expressionParent.kind() == 220 /* SimpleArrowFunctionExpression */) { var simpleArrowExpression = expressionParent; var expressionOfSimpleArrowExpression = simpleArrowExpression.expression; return expressionOfSimpleArrowExpression == expression; } - else if (expressionParent.kind() == 173 /* CommaExpression */) { + else if (expressionParent.kind() == 174 /* CommaExpression */) { return this.isExpressionOfArrowExpressions(expressionParent); } } @@ -26693,13 +27174,13 @@ var TypeScript; return false; } var expressionParent = expressionNode.parent; - if (expressionParent && expressionParent.kind() == 154 /* ForStatement */) { + if (expressionParent && expressionParent.kind() == 155 /* ForStatement */) { var expression = expressionNode; var forStatement = expressionParent; var initializer = forStatement.initializer; return initializer === expression; } - else if (expressionParent && expressionParent.kind() == 173 /* CommaExpression */) { + else if (expressionParent && expressionParent.kind() == 174 /* CommaExpression */) { return this.isInitializerOfForStatement(expressionParent); } return false; @@ -26709,13 +27190,13 @@ var TypeScript; return false; } var expressionParent = expressionNode.parent; - if (expressionParent && expressionParent.kind() == 154 /* ForStatement */) { + if (expressionParent && expressionParent.kind() == 155 /* ForStatement */) { var expression = expressionNode; var forStatement = expressionParent; var condition = forStatement.condition; return condition === expression; } - else if (expressionParent && expressionParent.kind() == 173 /* CommaExpression */) { + else if (expressionParent && expressionParent.kind() == 174 /* CommaExpression */) { return this.isConditionOfForStatement(expressionParent); } return false; @@ -26725,13 +27206,13 @@ var TypeScript; return false; } var expressionParent = expressionNode.parent; - if (expressionParent && expressionParent.kind() == 154 /* ForStatement */) { + if (expressionParent && expressionParent.kind() == 155 /* ForStatement */) { var expression = expressionNode; var forStatement = expressionParent; var incrementor = forStatement.incrementor; return incrementor === expression; } - else if (expressionParent && expressionParent.kind() == 173 /* CommaExpression */) { + else if (expressionParent && expressionParent.kind() == 174 /* CommaExpression */) { return this.isIncrememtorOfForStatement(expressionParent); } return false; @@ -26742,18 +27223,18 @@ var TypeScript; }; BreakpointResolver.prototype.breakpointOfExpression = function (expressionNode) { if (this.isInitializerOfForStatement(expressionNode) || this.isConditionOfForStatement(expressionNode) || this.isIncrememtorOfForStatement(expressionNode)) { - if (expressionNode.kind() == 173 /* CommaExpression */) { + if (expressionNode.kind() == 174 /* CommaExpression */) { return this.breakpointOfLeftOfCommaExpression(expressionNode); } return createBreakpointSpanInfo(expressionNode); } if (this.isExpressionOfArrowExpressions(expressionNode)) { - if (expressionNode.kind() == 173 /* CommaExpression */) { + if (expressionNode.kind() == 174 /* CommaExpression */) { return this.breakpointOfLeftOfCommaExpression(expressionNode); } return createBreakpointSpanInfo(expressionNode); } - if (expressionNode.kind() == 134 /* ExportAssignment */) { + if (expressionNode.kind() == 135 /* ExportAssignment */) { var exportAssignmentSyntax = expressionNode; return createBreakpointSpanInfo(expressionNode, exportAssignmentSyntax.exportKeyword, exportAssignmentSyntax.equalsToken, exportAssignmentSyntax.identifier); } @@ -26761,35 +27242,35 @@ var TypeScript; }; BreakpointResolver.prototype.breakpointSpanOfStatement = function (statementNode) { var statement = statementNode; - if (statement.kind() == 156 /* EmptyStatement */) { + if (statement.kind() == 157 /* EmptyStatement */) { return null; } var containingNode = TypeScript.Syntax.containingNode(statementNode); if (TypeScript.SyntaxUtilities.isStatement(containingNode)) { var useNodeForBreakpoint = false; switch (containingNode.kind()) { - case 130 /* ModuleDeclaration */: - case 131 /* ClassDeclaration */: - case 129 /* FunctionDeclaration */: - case 137 /* ConstructorDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 146 /* Block */: - case 147 /* IfStatement */: - case 235 /* ElseClause */: - case 155 /* ForInStatement */: - case 154 /* ForStatement */: - case 158 /* WhileStatement */: - case 161 /* DoStatement */: - case 151 /* SwitchStatement */: - case 233 /* CaseSwitchClause */: - case 234 /* DefaultSwitchClause */: - case 163 /* WithStatement */: - case 159 /* TryStatement */: - case 236 /* CatchClause */: - case 237 /* FinallyClause */: - case 146 /* Block */: + case 131 /* ModuleDeclaration */: + case 132 /* ClassDeclaration */: + case 130 /* FunctionDeclaration */: + case 138 /* ConstructorDeclaration */: + case 136 /* MemberFunctionDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 147 /* Block */: + case 148 /* IfStatement */: + case 236 /* ElseClause */: + case 156 /* ForInStatement */: + case 155 /* ForStatement */: + case 159 /* WhileStatement */: + case 162 /* DoStatement */: + case 152 /* SwitchStatement */: + case 234 /* CaseSwitchClause */: + case 235 /* DefaultSwitchClause */: + case 164 /* WithStatement */: + case 160 /* TryStatement */: + case 237 /* CatchClause */: + case 238 /* FinallyClause */: + case 147 /* Block */: useNodeForBreakpoint = true; } if (!useNodeForBreakpoint) { @@ -26797,25 +27278,25 @@ var TypeScript; } } switch (statement.kind()) { - case 149 /* ExpressionStatement */: + case 150 /* ExpressionStatement */: var expressionSyntax = statement; return createBreakpointSpanInfo(expressionSyntax.expression); - case 150 /* ReturnStatement */: + case 151 /* ReturnStatement */: var returnStatementSyntax = statement; return createBreakpointSpanInfo(statementNode, returnStatementSyntax.returnKeyword, returnStatementSyntax.expression); - case 157 /* ThrowStatement */: + case 158 /* ThrowStatement */: var throwStatementSyntax = statement; return createBreakpointSpanInfo(statementNode, throwStatementSyntax.throwKeyword, throwStatementSyntax.expression); - case 152 /* BreakStatement */: + case 153 /* BreakStatement */: var breakStatementSyntax = statement; return createBreakpointSpanInfo(statementNode, breakStatementSyntax.breakKeyword, breakStatementSyntax.identifier); - case 153 /* ContinueStatement */: + case 154 /* ContinueStatement */: var continueStatementSyntax = statement; return createBreakpointSpanInfo(statementNode, continueStatementSyntax.continueKeyword, continueStatementSyntax.identifier); - case 162 /* DebuggerStatement */: + case 163 /* DebuggerStatement */: var debuggerStatementSyntax = statement; return createBreakpointSpanInfo(debuggerStatementSyntax.debuggerKeyword); - case 160 /* LabeledStatement */: + case 161 /* LabeledStatement */: var labeledStatementSyntax = statement; return this.breakpointSpanOf(labeledStatementSyntax.statement); } @@ -26826,34 +27307,34 @@ var TypeScript; var elementsList; var block; switch (node.kind()) { - case 130 /* ModuleDeclaration */: + case 131 /* ModuleDeclaration */: elementsList = node.moduleElements; break; - case 131 /* ClassDeclaration */: + case 132 /* ClassDeclaration */: elementsList = node.classElements; break; - case 129 /* FunctionDeclaration */: + case 130 /* FunctionDeclaration */: block = node.block; break; - case 137 /* ConstructorDeclaration */: + case 138 /* ConstructorDeclaration */: block = node.block; break; - case 135 /* MemberFunctionDeclaration */: + case 136 /* MemberFunctionDeclaration */: block = node.block; break; - case 139 /* GetAccessor */: + case 140 /* GetAccessor */: block = node.block; break; - case 140 /* SetAccessor */: + case 141 /* SetAccessor */: block = node.block; break; - case 222 /* FunctionExpression */: + case 223 /* FunctionExpression */: block = node.block; break; - case 218 /* ParenthesizedArrowFunctionExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: block = node.block; break; - case 219 /* SimpleArrowFunctionExpression */: + case 220 /* SimpleArrowFunctionExpression */: block = node.block; break; default: @@ -26875,7 +27356,7 @@ var TypeScript; } var node = positionedNode; var moduleSyntax = positionedNode; - if ((TypeScript.SyntaxUtilities.isModuleElement(node) && TypeScript.Syntax.containingNode(positionedNode).kind() != 120 /* SourceUnit */) || TypeScript.SyntaxUtilities.isClassElement(node) || (moduleSyntax.kind() == 130 /* ModuleDeclaration */ && moduleSyntax.name && moduleSyntax.name.kind() == 121 /* QualifiedName */)) { + if ((TypeScript.SyntaxUtilities.isModuleElement(node) && TypeScript.Syntax.containingNode(positionedNode).kind() != 120 /* SourceUnit */) || TypeScript.SyntaxUtilities.isClassElement(node) || (moduleSyntax.kind() == 131 /* ModuleDeclaration */ && moduleSyntax.name && moduleSyntax.name.kind() == 121 /* QualifiedName */)) { return createBreakpointSpanInfo(positionedNode); } else { @@ -26894,7 +27375,7 @@ var TypeScript; return null; } var container = TypeScript.Syntax.containingNode(varDeclaratorNode); - if (container && container.kind() == 224 /* VariableDeclaration */) { + if (container && container.kind() == 225 /* VariableDeclaration */) { var parentDeclaratorsList = varDeclaratorNode.parent; if (parentDeclaratorsList && TypeScript.childAt(parentDeclaratorsList, 0) == varDeclaratorNode) { return this.breakpointSpanOfVariableDeclaration(container); @@ -26933,8 +27414,7 @@ var TypeScript; var container = TypeScript.Syntax.containingNode(varDeclarationNode); var varDeclarationSyntax = varDeclarationNode; var varDeclarators = varDeclarationSyntax.variableDeclarators; - var varDeclaratorsCount = TypeScript.childCount(varDeclarators); - if (container && container.kind() == 148 /* VariableStatement */) { + if (container && container.kind() == 149 /* VariableStatement */) { return this.breakpointSpanOfVariableStatement(container); } if (this.canHaveBreakpointInVariableDeclaration(varDeclarationNode)) { @@ -26962,7 +27442,7 @@ var TypeScript; return createBreakpointSpanInfoWithLimChar(varStatementNode, TypeScript.end(TypeScript.childAt(varDeclarators, 0))); }; BreakpointResolver.prototype.breakpointSpanOfParameter = function (parameterNode) { - if (parameterNode.parent.kind() === 219 /* SimpleArrowFunctionExpression */) { + if (parameterNode.parent.kind() === 220 /* SimpleArrowFunctionExpression */) { return this.breakpointSpanOfNode(parameterNode.parent); } if (TypeScript.SyntaxUtilities.isAmbientDeclarationSyntax(parameterNode)) { @@ -27127,7 +27607,7 @@ var TypeScript; return null; } for (var containingNode = TypeScript.Syntax.containingNode(positionedElement); containingNode != null; containingNode = TypeScript.Syntax.containingNode(containingNode)) { - if (containingNode.kind() == 244 /* TypeAnnotation */) { + if (containingNode.kind() == 245 /* TypeAnnotation */) { return this.breakpointSpanIfStartsOnSameLine(containingNode); } } @@ -27896,55 +28376,55 @@ var TypeScript; throw new Error(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Unknown_rule, null)); }; Rules.IsForContext = function (context) { - return context.contextNode.kind() === 154 /* ForStatement */; + return context.contextNode.kind() === 155 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind()) { - case 174 /* AssignmentExpression */: - case 175 /* AddAssignmentExpression */: - case 176 /* SubtractAssignmentExpression */: - case 177 /* MultiplyAssignmentExpression */: - case 178 /* DivideAssignmentExpression */: - case 179 /* ModuloAssignmentExpression */: - case 180 /* AndAssignmentExpression */: - case 181 /* ExclusiveOrAssignmentExpression */: - case 182 /* OrAssignmentExpression */: - case 183 /* LeftShiftAssignmentExpression */: - case 184 /* SignedRightShiftAssignmentExpression */: - case 185 /* UnsignedRightShiftAssignmentExpression */: - case 186 /* ConditionalExpression */: - case 187 /* LogicalOrExpression */: - case 188 /* LogicalAndExpression */: - case 189 /* BitwiseOrExpression */: - case 190 /* BitwiseExclusiveOrExpression */: - case 191 /* BitwiseAndExpression */: - case 192 /* EqualsWithTypeConversionExpression */: - case 193 /* NotEqualsWithTypeConversionExpression */: - case 194 /* EqualsExpression */: - case 195 /* NotEqualsExpression */: - case 196 /* LessThanExpression */: - case 197 /* GreaterThanExpression */: - case 198 /* LessThanOrEqualExpression */: - case 199 /* GreaterThanOrEqualExpression */: - case 200 /* InstanceOfExpression */: - case 201 /* InExpression */: - case 202 /* LeftShiftExpression */: - case 203 /* SignedRightShiftExpression */: - case 204 /* UnsignedRightShiftExpression */: - case 205 /* MultiplyExpression */: - case 206 /* DivideExpression */: - case 207 /* ModuloExpression */: - case 208 /* AddExpression */: - case 209 /* SubtractExpression */: + case 175 /* AssignmentExpression */: + case 176 /* AddAssignmentExpression */: + case 177 /* SubtractAssignmentExpression */: + case 178 /* MultiplyAssignmentExpression */: + case 179 /* DivideAssignmentExpression */: + case 180 /* ModuloAssignmentExpression */: + case 181 /* AndAssignmentExpression */: + case 182 /* ExclusiveOrAssignmentExpression */: + case 183 /* OrAssignmentExpression */: + case 184 /* LeftShiftAssignmentExpression */: + case 185 /* SignedRightShiftAssignmentExpression */: + case 186 /* UnsignedRightShiftAssignmentExpression */: + case 187 /* ConditionalExpression */: + case 188 /* LogicalOrExpression */: + case 189 /* LogicalAndExpression */: + case 190 /* BitwiseOrExpression */: + case 191 /* BitwiseExclusiveOrExpression */: + case 192 /* BitwiseAndExpression */: + case 193 /* EqualsWithTypeConversionExpression */: + case 194 /* NotEqualsWithTypeConversionExpression */: + case 195 /* EqualsExpression */: + case 196 /* NotEqualsExpression */: + case 197 /* LessThanExpression */: + case 198 /* GreaterThanExpression */: + case 199 /* LessThanOrEqualExpression */: + case 200 /* GreaterThanOrEqualExpression */: + case 201 /* InstanceOfExpression */: + case 202 /* InExpression */: + case 203 /* LeftShiftExpression */: + case 204 /* SignedRightShiftExpression */: + case 205 /* UnsignedRightShiftExpression */: + case 206 /* MultiplyExpression */: + case 207 /* DivideExpression */: + case 208 /* ModuloExpression */: + case 209 /* AddExpression */: + case 210 /* SubtractExpression */: return true; - case 133 /* ImportDeclaration */: - case 225 /* VariableDeclarator */: - case 232 /* EqualsValueClause */: + case 134 /* ImportDeclaration */: + case 226 /* VariableDeclarator */: + case 233 /* EqualsValueClause */: return context.currentTokenSpan.kind === 107 /* EqualsToken */ || context.nextTokenSpan.kind === 107 /* EqualsToken */; - case 155 /* ForInStatement */: + case 156 /* ForInStatement */: return context.currentTokenSpan.kind === 29 /* InKeyword */ || context.nextTokenSpan.kind === 29 /* InKeyword */; } return false; @@ -27975,26 +28455,26 @@ var TypeScript; return true; } switch (node.kind()) { - case 146 /* Block */: - case 151 /* SwitchStatement */: - case 215 /* ObjectLiteralExpression */: + case 147 /* Block */: + case 152 /* SwitchStatement */: + case 216 /* ObjectLiteralExpression */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind()) { - case 129 /* FunctionDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 145 /* MethodSignature */: - case 142 /* CallSignature */: - case 222 /* FunctionExpression */: - case 137 /* ConstructorDeclaration */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 128 /* InterfaceDeclaration */: + case 130 /* FunctionDeclaration */: + case 136 /* MemberFunctionDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 146 /* MethodSignature */: + case 143 /* CallSignature */: + case 223 /* FunctionExpression */: + case 138 /* ConstructorDeclaration */: + case 220 /* SimpleArrowFunctionExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: + case 129 /* InterfaceDeclaration */: return true; } return false; @@ -28004,51 +28484,51 @@ var TypeScript; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind()) { - case 131 /* ClassDeclaration */: - case 132 /* EnumDeclaration */: + case 132 /* ClassDeclaration */: + case 133 /* EnumDeclaration */: case 122 /* ObjectType */: - case 130 /* ModuleDeclaration */: + case 131 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind()) { - case 131 /* ClassDeclaration */: - case 130 /* ModuleDeclaration */: - case 132 /* EnumDeclaration */: - case 146 /* Block */: - case 151 /* SwitchStatement */: + case 132 /* ClassDeclaration */: + case 131 /* ModuleDeclaration */: + case 133 /* EnumDeclaration */: + case 147 /* Block */: + case 152 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind()) { - case 147 /* IfStatement */: - case 151 /* SwitchStatement */: - case 154 /* ForStatement */: - case 155 /* ForInStatement */: - case 158 /* WhileStatement */: - case 159 /* TryStatement */: - case 161 /* DoStatement */: - case 163 /* WithStatement */: - case 235 /* ElseClause */: - case 236 /* CatchClause */: - case 237 /* FinallyClause */: + case 148 /* IfStatement */: + case 152 /* SwitchStatement */: + case 155 /* ForStatement */: + case 156 /* ForInStatement */: + case 159 /* WhileStatement */: + case 160 /* TryStatement */: + case 162 /* DoStatement */: + case 164 /* WithStatement */: + case 236 /* ElseClause */: + case 237 /* CatchClause */: + case 238 /* FinallyClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind() === 215 /* ObjectLiteralExpression */; + return context.contextNode.kind() === 216 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind() === 213 /* InvocationExpression */; + return context.contextNode.kind() === 214 /* InvocationExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind() === 216 /* ObjectCreationExpression */; + return context.contextNode.kind() === 217 /* ObjectCreationExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -28060,19 +28540,19 @@ var TypeScript; return context.formattingRequestKind != 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind() === 130 /* ModuleDeclaration */; + return context.contextNode.kind() === 131 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind() === 122 /* ObjectType */ && context.contextNode.parent().kind() !== 128 /* InterfaceDeclaration */; + return context.contextNode.kind() === 122 /* ObjectType */ && context.contextNode.parent().kind() !== 129 /* InterfaceDeclaration */; }; Rules.IsTypeArgumentOrParameter = function (tokenKind, parentKind) { - return ((tokenKind === 80 /* LessThanToken */ || tokenKind === 81 /* GreaterThanToken */) && (parentKind === 229 /* TypeParameterList */ || parentKind === 228 /* TypeArgumentList */)); + return ((tokenKind === 80 /* LessThanToken */ || tokenKind === 81 /* GreaterThanToken */) && (parentKind === 230 /* TypeParameterList */ || parentKind === 229 /* TypeArgumentList */)); }; Rules.IsTypeArgumentOrParameterContext = function (context) { return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan.kind, context.currentTokenParent.kind()) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan.kind, context.nextTokenParent.kind()); }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 41 /* VoidKeyword */ && context.currentTokenParent.kind() === 172 /* VoidExpression */; + return context.currentTokenSpan.kind === 41 /* VoidKeyword */ && context.currentTokenParent.kind() === 173 /* VoidExpression */; }; return Rules; })(); @@ -28648,7 +29128,7 @@ var TypeScript; } }; IndentationTrackingWalker.prototype.getTokenIndentationAmount = function (token) { - if (TypeScript.firstToken(this._parent.node()) === token || token.kind() === 70 /* OpenBraceToken */ || token.kind() === 71 /* CloseBraceToken */ || token.kind() === 74 /* OpenBracketToken */ || token.kind() === 75 /* CloseBracketToken */ || (token.kind() === 42 /* WhileKeyword */ && this._parent.node().kind() == 161 /* DoStatement */)) { + if (TypeScript.firstToken(this._parent.node()) === token || token.kind() === 70 /* OpenBraceToken */ || token.kind() === 71 /* CloseBraceToken */ || token.kind() === 74 /* OpenBracketToken */ || token.kind() === 75 /* CloseBracketToken */ || (token.kind() === 42 /* WhileKeyword */ && this._parent.node().kind() == 162 /* DoStatement */)) { return this._parent.indentationAmount(); } return (this._parent.indentationAmount() + this._parent.childIndentationAmountDelta()); @@ -28666,7 +29146,7 @@ var TypeScript; parentIndentationAmount = parent.indentationAmount(); } else { - if (parent.kind() === 146 /* Block */ && !this.shouldIndentBlockInParent(this._parent.parent())) { + if (parent.kind() === 147 /* Block */ && !this.shouldIndentBlockInParent(this._parent.parent())) { parent = this._parent.parent(); } var line = this._snapshot.getLineFromPosition(parent.start()).getText(); @@ -28682,46 +29162,46 @@ var TypeScript; indentationAmount = (parentIndentationAmount + parentIndentationAmountDelta); indentationAmountDelta = 0; break; - case 131 /* ClassDeclaration */: - case 130 /* ModuleDeclaration */: + case 132 /* ClassDeclaration */: + case 131 /* ModuleDeclaration */: case 122 /* ObjectType */: - case 132 /* EnumDeclaration */: - case 151 /* SwitchStatement */: - case 215 /* ObjectLiteralExpression */: - case 137 /* ConstructorDeclaration */: - case 129 /* FunctionDeclaration */: - case 222 /* FunctionExpression */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 138 /* IndexMemberDeclaration */: - case 236 /* CatchClause */: - case 214 /* ArrayLiteralExpression */: + case 133 /* EnumDeclaration */: + case 152 /* SwitchStatement */: + case 216 /* ObjectLiteralExpression */: + case 138 /* ConstructorDeclaration */: + case 130 /* FunctionDeclaration */: + case 223 /* FunctionExpression */: + case 136 /* MemberFunctionDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 139 /* IndexMemberDeclaration */: + case 237 /* CatchClause */: + case 215 /* ArrayLiteralExpression */: case 124 /* ArrayType */: - case 221 /* ElementAccessExpression */: - case 144 /* IndexSignature */: - case 154 /* ForStatement */: - case 155 /* ForInStatement */: - case 158 /* WhileStatement */: - case 161 /* DoStatement */: - case 163 /* WithStatement */: - case 233 /* CaseSwitchClause */: - case 234 /* DefaultSwitchClause */: - case 150 /* ReturnStatement */: - case 157 /* ThrowStatement */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 224 /* VariableDeclaration */: - case 134 /* ExportAssignment */: - case 213 /* InvocationExpression */: - case 216 /* ObjectCreationExpression */: - case 142 /* CallSignature */: - case 143 /* ConstructSignature */: + case 222 /* ElementAccessExpression */: + case 145 /* IndexSignature */: + case 155 /* ForStatement */: + case 156 /* ForInStatement */: + case 159 /* WhileStatement */: + case 162 /* DoStatement */: + case 164 /* WithStatement */: + case 234 /* CaseSwitchClause */: + case 235 /* DefaultSwitchClause */: + case 151 /* ReturnStatement */: + case 158 /* ThrowStatement */: + case 220 /* SimpleArrowFunctionExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: + case 225 /* VariableDeclaration */: + case 135 /* ExportAssignment */: + case 214 /* InvocationExpression */: + case 217 /* ObjectCreationExpression */: + case 143 /* CallSignature */: + case 144 /* ConstructSignature */: indentationAmount = (parentIndentationAmount + parentIndentationAmountDelta); indentationAmountDelta = this.options.indentSpaces; break; - case 147 /* IfStatement */: - if (parent.kind() === 235 /* ElseClause */ && !TypeScript.SyntaxUtilities.isLastTokenOnLine(parentNode.elseKeyword, this._text)) { + case 148 /* IfStatement */: + if (parent.kind() === 236 /* ElseClause */ && !TypeScript.SyntaxUtilities.isLastTokenOnLine(parentNode.elseKeyword, this._text)) { indentationAmount = parentIndentationAmount; } else { @@ -28729,11 +29209,11 @@ var TypeScript; } indentationAmountDelta = this.options.indentSpaces; break; - case 235 /* ElseClause */: + case 236 /* ElseClause */: indentationAmount = parentIndentationAmount; indentationAmountDelta = this.options.indentSpaces; break; - case 146 /* Block */: + case 147 /* Block */: if (this.shouldIndentBlockInParent(parent)) { indentationAmount = parentIndentationAmount + parentIndentationAmountDelta; } @@ -28761,10 +29241,10 @@ var TypeScript; IndentationTrackingWalker.prototype.shouldIndentBlockInParent = function (parent) { switch (parent.kind()) { case 120 /* SourceUnit */: - case 130 /* ModuleDeclaration */: - case 146 /* Block */: - case 233 /* CaseSwitchClause */: - case 234 /* DefaultSwitchClause */: + case 131 /* ModuleDeclaration */: + case 147 /* Block */: + case 234 /* CaseSwitchClause */: + case 235 /* DefaultSwitchClause */: return true; default: return false; @@ -28926,38 +29406,6 @@ var TypeScript; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - var Formatting; - (function (Formatting) { - var SingleTokenIndenter = (function (_super) { - __extends(SingleTokenIndenter, _super); - function SingleTokenIndenter(indentationPosition, sourceUnit, snapshot, indentFirstToken, options) { - _super.call(this, new TypeScript.TextSpan(indentationPosition, 1), sourceUnit, snapshot, indentFirstToken, options); - this.indentationAmount = null; - this.indentationPosition = indentationPosition; - } - SingleTokenIndenter.getIndentationAmount = function (position, sourceUnit, snapshot, options) { - var walker = new SingleTokenIndenter(position, sourceUnit, snapshot, true, options); - TypeScript.visitNodeOrToken(walker, sourceUnit); - return walker.indentationAmount; - }; - SingleTokenIndenter.prototype.indentToken = function (token, indentationAmount, commentIndentationAmount) { - if (token.fullWidth() === 0 || (this.indentationPosition - this.position() < token.leadingTriviaWidth())) { - this.indentationAmount = commentIndentationAmount; - } - else { - this.indentationAmount = indentationAmount; - } - }; - return SingleTokenIndenter; - })(Formatting.IndentationTrackingWalker); - Formatting.SingleTokenIndenter = SingleTokenIndenter; - })(Formatting = Services.Formatting || (Services.Formatting = {})); - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; (function (TypeScript) { var Services; (function (Services) { @@ -29174,6 +29622,388 @@ var TypeScript; })(Formatting = Services.Formatting || (Services.Formatting = {})); })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var SmartIndenter; + (function (SmartIndenter) { + function getIndentation(position, sourceFile, options) { + if (position > sourceFile.text.length) { + return 0; + } + var precedingToken = findPrecedingToken(position, sourceFile); + if (!precedingToken) { + return 0; + } + if ((precedingToken.kind === 7 /* StringLiteral */ || precedingToken.kind === 8 /* RegularExpressionLiteral */) && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { + return 0; + } + var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; + if (precedingToken.kind === 18 /* CommaToken */ && precedingToken.parent.kind !== 145 /* BinaryExpression */) { + var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + } + var previous; + var current = precedingToken; + var currentStart; + var indentationDelta; + while (current) { + if (positionBelongsToNode(current, position, sourceFile) && nodeContentIsIndented(current, previous)) { + currentStart = getStartLineAndCharacterForNode(current, sourceFile); + if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { + indentationDelta = 0; + } + else { + indentationDelta = lineAtPosition !== currentStart.line ? options.indentSpaces : 0; + } + break; + } + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + previous = current; + current = current.parent; + } + if (!current) { + return 0; + } + var parent = current.parent; + var parentStart; + while (parent) { + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + parentStart = sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + if (nodeContentIsIndented(parent, current) && !parentAndChildShareLine) { + indentationDelta += options.indentSpaces; + } + current = parent; + currentStart = parentStart; + parent = current.parent; + } + return indentationDelta; + } + SmartIndenter.getIndentation = getIndentation; + function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { + var itemInfo = findPrecedingListItem(commaToken); + return deriveActualIndentationFromList(itemInfo.list.getChildren(), itemInfo.listItemIndex, sourceFile, options); + } + function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 182 /* SourceFile */ || !parentAndChildShareLine); + if (!useActualIndentation) { + return -1; + } + return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); + } + function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { + var nextToken = findNextToken(precedingToken, current); + if (!nextToken) { + return false; + } + if (nextToken.kind === 9 /* OpenBraceToken */) { + return true; + } + else if (nextToken.kind === 10 /* CloseBraceToken */) { + var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; + return lineAtPosition === nextTokenStartLine; + } + return false; + } + function getStartLineAndCharacterForNode(n, sourceFile) { + return sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + } + function findPrecedingListItem(commaToken) { + var syntaxList = ts.forEach(commaToken.parent.getChildren(), function (c) { + if (c.kind == 184 /* SyntaxList */ && c.pos <= commaToken.end && c.end >= commaToken.end) { + return c; + } + }); + ts.Debug.assert(syntaxList); + var children = syntaxList.getChildren(); + var commaIndex = ts.indexOf(children, commaToken); + ts.Debug.assert(commaIndex !== -1 && commaIndex !== 0); + return { + listItemIndex: commaIndex - 1, + list: syntaxList + }; + } + function positionBelongsToNode(candidate, position, sourceFile) { + return candidate.end > position || !isCompletedNode(candidate, sourceFile); + } + function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { + if (parent.kind === 152 /* IfStatement */ && parent.elseStatement === child) { + var elseKeyword = ts.forEach(parent.getChildren(), function (c) { return c.kind === 70 /* ElseKeyword */ && c; }); + ts.Debug.assert(elseKeyword); + var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + return elseKeywordStartLine === childStartLine; + } + } + function getActualIndentationForListItem(node, sourceFile, options) { + if (node.parent) { + switch (node.parent.kind) { + case 127 /* TypeReference */: + if (node.parent.typeArguments) { + return getActualIndentationFromList(node.parent.typeArguments); + } + break; + case 133 /* ObjectLiteral */: + return getActualIndentationFromList(node.parent.properties); + case 129 /* TypeLiteral */: + return getActualIndentationFromList(node.parent.members); + case 132 /* ArrayLiteral */: + return getActualIndentationFromList(node.parent.elements); + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: + case 120 /* Method */: + case 124 /* CallSignature */: + case 125 /* ConstructSignature */: + if (node.parent.typeParameters && node.end < node.parent.typeParameters.end) { + return getActualIndentationFromList(node.parent.typeParameters); + } + return getActualIndentationFromList(node.parent.parameters); + case 138 /* NewExpression */: + case 137 /* CallExpression */: + if (node.parent.typeArguments && node.end < node.parent.typeArguments.end) { + return getActualIndentationFromList(node.parent.typeArguments); + } + return getActualIndentationFromList(node.parent.arguments); + } + } + return -1; + function getActualIndentationFromList(list) { + var index = ts.indexOf(list, node); + return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1; + } + } + function deriveActualIndentationFromList(list, index, sourceFile, options) { + ts.Debug.assert(index >= 0 && index < list.length); + var node = list[index]; + var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); + for (var i = index - 1; i >= 0; --i) { + if (list[i].kind === 18 /* CommaToken */) { + continue; + } + var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line; + if (prevEndLine !== lineAndCharacter.line) { + return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); + } + lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile); + } + return -1; + } + function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) { + var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1); + var column = 0; + for (var i = 0; i < lineAndCharacter.character; ++i) { + var charCode = sourceFile.text.charCodeAt(lineStart + i); + if (!ts.isWhiteSpace(charCode)) { + return column; + } + if (charCode === 9 /* tab */) { + column += options.spacesPerTab; + } + else { + column++; + } + } + return column; + } + function findNextToken(previousToken, parent) { + return find(parent); + function find(n) { + if (isToken(n) && n.pos === previousToken.end) { + return n; + } + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; ++i) { + var child = children[i]; + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); + if (shouldDiveInChildNode && nodeHasTokens(child)) { + return find(child); + } + } + return undefined; + } + } + function findPrecedingToken(position, sourceFile) { + return find(sourceFile); + function findRightmostToken(n) { + if (isToken(n)) { + return n; + } + var children = n.getChildren(); + var candidate = findRightmostChildNodeWithTokens(children, children.length); + return candidate && findRightmostToken(candidate); + } + function find(n) { + if (isToken(n)) { + return n; + } + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; ++i) { + var child = children[i]; + if (nodeHasTokens(child)) { + if (position < child.end) { + if (child.getStart(sourceFile) >= position) { + var candidate = findRightmostChildNodeWithTokens(children, i); + return candidate && findRightmostToken(candidate); + } + else { + return find(child); + } + } + } + } + ts.Debug.assert(n.kind === 182 /* SourceFile */); + if (children.length) { + var candidate = findRightmostChildNodeWithTokens(children, children.length); + return candidate && findRightmostToken(candidate); + } + } + function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) { + for (var i = exclusiveStartPosition - 1; i >= 0; --i) { + if (nodeHasTokens(children[i])) { + return children[i]; + } + } + } + } + function nodeHasTokens(n) { + if (n.kind === 151 /* ExpressionStatement */) { + return nodeHasTokens(n.expression); + } + if (n.kind === 1 /* EndOfFileToken */ || n.kind === 147 /* OmittedExpression */ || n.kind === 115 /* Missing */) { + return false; + } + return n.kind !== 184 /* SyntaxList */ || n.getChildCount() !== 0; + } + function isToken(n) { + return n.kind >= ts.SyntaxKind.FirstToken && n.kind <= ts.SyntaxKind.LastToken; + } + function nodeContentIsIndented(parent, child) { + switch (parent.kind) { + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: + return true; + case 177 /* ModuleDeclaration */: + return false; + case 172 /* FunctionDeclaration */: + case 120 /* Method */: + case 141 /* FunctionExpression */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 121 /* Constructor */: + return false; + case 153 /* DoStatement */: + case 154 /* WhileStatement */: + case 156 /* ForInStatement */: + case 155 /* ForStatement */: + return child && child.kind !== 148 /* Block */; + case 152 /* IfStatement */: + return child && child.kind !== 148 /* Block */; + case 166 /* TryStatement */: + return false; + case 132 /* ArrayLiteral */: + case 148 /* Block */: + case 173 /* FunctionBlock */: + case 167 /* TryBlock */: + case 168 /* CatchBlock */: + case 169 /* FinallyBlock */: + case 178 /* ModuleBlock */: + case 133 /* ObjectLiteral */: + case 129 /* TypeLiteral */: + case 161 /* SwitchStatement */: + case 163 /* DefaultClause */: + case 162 /* CaseClause */: + case 140 /* ParenExpression */: + case 137 /* CallExpression */: + case 138 /* NewExpression */: + case 149 /* VariableStatement */: + case 171 /* VariableDeclaration */: + return true; + default: + return false; + } + } + function nodeEndsWith(n, expectedLastToken, sourceFile) { + var children = n.getChildren(sourceFile); + if (children.length) { + var last = children[children.length - 1]; + if (last.kind === expectedLastToken) { + return true; + } + else if (last.kind === 17 /* SemicolonToken */ && children.length !== 1) { + return children[children.length - 2].kind === expectedLastToken; + } + } + return false; + } + function isCompletedNode(n, sourceFile) { + switch (n.kind) { + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: + case 133 /* ObjectLiteral */: + case 148 /* Block */: + case 168 /* CatchBlock */: + case 169 /* FinallyBlock */: + case 173 /* FunctionBlock */: + case 178 /* ModuleBlock */: + case 161 /* SwitchStatement */: + return nodeEndsWith(n, 10 /* CloseBraceToken */, sourceFile); + case 140 /* ParenExpression */: + case 124 /* CallSignature */: + case 137 /* CallExpression */: + case 125 /* ConstructSignature */: + return nodeEndsWith(n, 12 /* CloseParenToken */, sourceFile); + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 120 /* Method */: + case 142 /* ArrowFunction */: + return !n.body || isCompletedNode(n.body, sourceFile); + case 177 /* ModuleDeclaration */: + return n.body && isCompletedNode(n.body, sourceFile); + case 152 /* IfStatement */: + if (n.elseStatement) { + return isCompletedNode(n.elseStatement, sourceFile); + } + return isCompletedNode(n.thenStatement, sourceFile); + case 151 /* ExpressionStatement */: + return isCompletedNode(n.expression, sourceFile); + case 132 /* ArrayLiteral */: + return nodeEndsWith(n, 14 /* CloseBracketToken */, sourceFile); + case 115 /* Missing */: + return false; + case 162 /* CaseClause */: + case 163 /* DefaultClause */: + return false; + case 154 /* WhileStatement */: + return isCompletedNode(n.statement, sourceFile); + case 153 /* DoStatement */: + var hasWhileKeyword = ts.forEach(n.getChildren(), function (c) { return c.kind === 94 /* WhileKeyword */ && c; }); + if (hasWhileKeyword) { + return nodeEndsWith(n, 12 /* CloseParenToken */, sourceFile); + } + return isCompletedNode(n.statement, sourceFile); + default: + return true; + } + } + })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); var TypeScript; (function (TypeScript) { var NullLogger = (function () { @@ -29263,6 +30093,9 @@ var TypeScript; function walkTypeArgumentListChildren(preAst, walker) { walker.walk(preAst.typeArguments); } + function walkTupleTypeChildren(preAst, walker) { + walker.walk(preAst.types); + } function walkTypeOfExpressionChildren(preAst, walker) { walker.walk(preAst.expression); } @@ -29573,151 +30406,152 @@ var TypeScript; for (var i = TypeScript.SyntaxKind.FirstTrivia, n = TypeScript.SyntaxKind.LastTrivia; i <= n; i++) { childrenWalkers[i] = null; } - childrenWalkers[175 /* AddAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[208 /* AddExpression */] = walkBinaryExpressionChildren; - childrenWalkers[180 /* AndAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[176 /* AddAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[209 /* AddExpression */] = walkBinaryExpressionChildren; + childrenWalkers[181 /* AndAssignmentExpression */] = walkBinaryExpressionChildren; childrenWalkers[60 /* AnyKeyword */] = null; - childrenWalkers[226 /* ArgumentList */] = walkArgumentListChildren; - childrenWalkers[214 /* ArrayLiteralExpression */] = walkArrayLiteralExpressionChildren; + childrenWalkers[227 /* ArgumentList */] = walkArgumentListChildren; + childrenWalkers[215 /* ArrayLiteralExpression */] = walkArrayLiteralExpressionChildren; childrenWalkers[124 /* ArrayType */] = walkArrayTypeChildren; - childrenWalkers[219 /* SimpleArrowFunctionExpression */] = walkSimpleArrowFunctionExpressionChildren; - childrenWalkers[218 /* ParenthesizedArrowFunctionExpression */] = walkParenthesizedArrowFunctionExpressionChildren; - childrenWalkers[174 /* AssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[191 /* BitwiseAndExpression */] = walkBinaryExpressionChildren; - childrenWalkers[190 /* BitwiseExclusiveOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[166 /* BitwiseNotExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[189 /* BitwiseOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[146 /* Block */] = walkBlockChildren; + childrenWalkers[220 /* SimpleArrowFunctionExpression */] = walkSimpleArrowFunctionExpressionChildren; + childrenWalkers[219 /* ParenthesizedArrowFunctionExpression */] = walkParenthesizedArrowFunctionExpressionChildren; + childrenWalkers[175 /* AssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[192 /* BitwiseAndExpression */] = walkBinaryExpressionChildren; + childrenWalkers[191 /* BitwiseExclusiveOrExpression */] = walkBinaryExpressionChildren; + childrenWalkers[167 /* BitwiseNotExpression */] = walkPrefixUnaryExpressionChildren; + childrenWalkers[190 /* BitwiseOrExpression */] = walkBinaryExpressionChildren; + childrenWalkers[147 /* Block */] = walkBlockChildren; childrenWalkers[61 /* BooleanKeyword */] = null; - childrenWalkers[152 /* BreakStatement */] = null; - childrenWalkers[142 /* CallSignature */] = walkCallSignatureChildren; - childrenWalkers[233 /* CaseSwitchClause */] = walkCaseSwitchClauseChildren; - childrenWalkers[220 /* CastExpression */] = walkCastExpressionChildren; - childrenWalkers[236 /* CatchClause */] = walkCatchClauseChildren; - childrenWalkers[131 /* ClassDeclaration */] = walkClassDeclChildren; - childrenWalkers[173 /* CommaExpression */] = walkBinaryExpressionChildren; - childrenWalkers[186 /* ConditionalExpression */] = walkTrinaryExpressionChildren; - childrenWalkers[239 /* Constraint */] = walkConstraintChildren; - childrenWalkers[137 /* ConstructorDeclaration */] = walkConstructorDeclarationChildren; - childrenWalkers[143 /* ConstructSignature */] = walkConstructSignatureChildren; - childrenWalkers[153 /* ContinueStatement */] = null; + childrenWalkers[153 /* BreakStatement */] = null; + childrenWalkers[143 /* CallSignature */] = walkCallSignatureChildren; + childrenWalkers[234 /* CaseSwitchClause */] = walkCaseSwitchClauseChildren; + childrenWalkers[221 /* CastExpression */] = walkCastExpressionChildren; + childrenWalkers[237 /* CatchClause */] = walkCatchClauseChildren; + childrenWalkers[132 /* ClassDeclaration */] = walkClassDeclChildren; + childrenWalkers[174 /* CommaExpression */] = walkBinaryExpressionChildren; + childrenWalkers[187 /* ConditionalExpression */] = walkTrinaryExpressionChildren; + childrenWalkers[240 /* Constraint */] = walkConstraintChildren; + childrenWalkers[138 /* ConstructorDeclaration */] = walkConstructorDeclarationChildren; + childrenWalkers[144 /* ConstructSignature */] = walkConstructSignatureChildren; + childrenWalkers[154 /* ContinueStatement */] = null; childrenWalkers[125 /* ConstructorType */] = walkConstructorTypeChildren; - childrenWalkers[162 /* DebuggerStatement */] = null; - childrenWalkers[234 /* DefaultSwitchClause */] = walkDefaultSwitchClauseChildren; - childrenWalkers[170 /* DeleteExpression */] = walkDeleteExpressionChildren; - childrenWalkers[178 /* DivideAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[206 /* DivideExpression */] = walkBinaryExpressionChildren; - childrenWalkers[161 /* DoStatement */] = walkDoStatementChildren; - childrenWalkers[221 /* ElementAccessExpression */] = walkElementAccessExpressionChildren; - childrenWalkers[235 /* ElseClause */] = walkElseClauseChildren; - childrenWalkers[156 /* EmptyStatement */] = null; - childrenWalkers[132 /* EnumDeclaration */] = walkEnumDeclarationChildren; - childrenWalkers[243 /* EnumElement */] = walkEnumElementChildren; - childrenWalkers[194 /* EqualsExpression */] = walkBinaryExpressionChildren; - childrenWalkers[232 /* EqualsValueClause */] = walkEqualsValueClauseChildren; - childrenWalkers[192 /* EqualsWithTypeConversionExpression */] = walkBinaryExpressionChildren; - childrenWalkers[181 /* ExclusiveOrAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[134 /* ExportAssignment */] = walkExportAssignmentChildren; - childrenWalkers[149 /* ExpressionStatement */] = walkExpressionStatementChildren; - childrenWalkers[230 /* ExtendsHeritageClause */] = walkHeritageClauseChildren; - childrenWalkers[245 /* ExternalModuleReference */] = walkExternalModuleReferenceChildren; + childrenWalkers[163 /* DebuggerStatement */] = null; + childrenWalkers[235 /* DefaultSwitchClause */] = walkDefaultSwitchClauseChildren; + childrenWalkers[171 /* DeleteExpression */] = walkDeleteExpressionChildren; + childrenWalkers[179 /* DivideAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[207 /* DivideExpression */] = walkBinaryExpressionChildren; + childrenWalkers[162 /* DoStatement */] = walkDoStatementChildren; + childrenWalkers[222 /* ElementAccessExpression */] = walkElementAccessExpressionChildren; + childrenWalkers[236 /* ElseClause */] = walkElseClauseChildren; + childrenWalkers[157 /* EmptyStatement */] = null; + childrenWalkers[133 /* EnumDeclaration */] = walkEnumDeclarationChildren; + childrenWalkers[244 /* EnumElement */] = walkEnumElementChildren; + childrenWalkers[195 /* EqualsExpression */] = walkBinaryExpressionChildren; + childrenWalkers[233 /* EqualsValueClause */] = walkEqualsValueClauseChildren; + childrenWalkers[193 /* EqualsWithTypeConversionExpression */] = walkBinaryExpressionChildren; + childrenWalkers[182 /* ExclusiveOrAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[135 /* ExportAssignment */] = walkExportAssignmentChildren; + childrenWalkers[150 /* ExpressionStatement */] = walkExpressionStatementChildren; + childrenWalkers[231 /* ExtendsHeritageClause */] = walkHeritageClauseChildren; + childrenWalkers[246 /* ExternalModuleReference */] = walkExternalModuleReferenceChildren; childrenWalkers[24 /* FalseKeyword */] = null; - childrenWalkers[237 /* FinallyClause */] = walkFinallyClauseChildren; - childrenWalkers[155 /* ForInStatement */] = walkForInStatementChildren; - childrenWalkers[154 /* ForStatement */] = walkForStatementChildren; - childrenWalkers[129 /* FunctionDeclaration */] = walkFuncDeclChildren; - childrenWalkers[222 /* FunctionExpression */] = walkFunctionExpressionChildren; - childrenWalkers[241 /* FunctionPropertyAssignment */] = walkFunctionPropertyAssignmentChildren; + childrenWalkers[238 /* FinallyClause */] = walkFinallyClauseChildren; + childrenWalkers[156 /* ForInStatement */] = walkForInStatementChildren; + childrenWalkers[155 /* ForStatement */] = walkForStatementChildren; + childrenWalkers[130 /* FunctionDeclaration */] = walkFuncDeclChildren; + childrenWalkers[223 /* FunctionExpression */] = walkFunctionExpressionChildren; + childrenWalkers[242 /* FunctionPropertyAssignment */] = walkFunctionPropertyAssignmentChildren; childrenWalkers[123 /* FunctionType */] = walkFunctionTypeChildren; childrenWalkers[126 /* GenericType */] = walkGenericTypeChildren; - childrenWalkers[139 /* GetAccessor */] = walkGetAccessorChildren; - childrenWalkers[197 /* GreaterThanExpression */] = walkBinaryExpressionChildren; - childrenWalkers[199 /* GreaterThanOrEqualExpression */] = walkBinaryExpressionChildren; - childrenWalkers[147 /* IfStatement */] = walkIfStatementChildren; - childrenWalkers[231 /* ImplementsHeritageClause */] = walkHeritageClauseChildren; - childrenWalkers[133 /* ImportDeclaration */] = walkImportDeclarationChildren; - childrenWalkers[138 /* IndexMemberDeclaration */] = walkIndexMemberDeclarationChildren; - childrenWalkers[144 /* IndexSignature */] = walkIndexSignatureChildren; - childrenWalkers[201 /* InExpression */] = walkBinaryExpressionChildren; - childrenWalkers[200 /* InstanceOfExpression */] = walkBinaryExpressionChildren; - childrenWalkers[128 /* InterfaceDeclaration */] = walkInterfaceDeclerationChildren; - childrenWalkers[213 /* InvocationExpression */] = walkInvocationExpressionChildren; - childrenWalkers[160 /* LabeledStatement */] = walkLabeledStatementChildren; - childrenWalkers[183 /* LeftShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[202 /* LeftShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[196 /* LessThanExpression */] = walkBinaryExpressionChildren; - childrenWalkers[198 /* LessThanOrEqualExpression */] = walkBinaryExpressionChildren; + childrenWalkers[140 /* GetAccessor */] = walkGetAccessorChildren; + childrenWalkers[198 /* GreaterThanExpression */] = walkBinaryExpressionChildren; + childrenWalkers[200 /* GreaterThanOrEqualExpression */] = walkBinaryExpressionChildren; + childrenWalkers[148 /* IfStatement */] = walkIfStatementChildren; + childrenWalkers[232 /* ImplementsHeritageClause */] = walkHeritageClauseChildren; + childrenWalkers[134 /* ImportDeclaration */] = walkImportDeclarationChildren; + childrenWalkers[139 /* IndexMemberDeclaration */] = walkIndexMemberDeclarationChildren; + childrenWalkers[145 /* IndexSignature */] = walkIndexSignatureChildren; + childrenWalkers[202 /* InExpression */] = walkBinaryExpressionChildren; + childrenWalkers[201 /* InstanceOfExpression */] = walkBinaryExpressionChildren; + childrenWalkers[129 /* InterfaceDeclaration */] = walkInterfaceDeclerationChildren; + childrenWalkers[214 /* InvocationExpression */] = walkInvocationExpressionChildren; + childrenWalkers[161 /* LabeledStatement */] = walkLabeledStatementChildren; + childrenWalkers[184 /* LeftShiftAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[203 /* LeftShiftExpression */] = walkBinaryExpressionChildren; + childrenWalkers[197 /* LessThanExpression */] = walkBinaryExpressionChildren; + childrenWalkers[199 /* LessThanOrEqualExpression */] = walkBinaryExpressionChildren; childrenWalkers[1 /* List */] = walkListChildren; - childrenWalkers[188 /* LogicalAndExpression */] = walkBinaryExpressionChildren; - childrenWalkers[167 /* LogicalNotExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[187 /* LogicalOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[212 /* MemberAccessExpression */] = walkMemberAccessExpressionChildren; - childrenWalkers[135 /* MemberFunctionDeclaration */] = walkMemberFunctionDeclarationChildren; - childrenWalkers[136 /* MemberVariableDeclaration */] = walkMemberVariableDeclarationChildren; - childrenWalkers[145 /* MethodSignature */] = walkMethodSignatureChildren; - childrenWalkers[130 /* ModuleDeclaration */] = walkModuleDeclarationChildren; - childrenWalkers[246 /* ModuleNameModuleReference */] = walkModuleNameModuleReferenceChildren; - childrenWalkers[179 /* ModuloAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[207 /* ModuloExpression */] = walkBinaryExpressionChildren; - childrenWalkers[177 /* MultiplyAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[205 /* MultiplyExpression */] = walkBinaryExpressionChildren; + childrenWalkers[189 /* LogicalAndExpression */] = walkBinaryExpressionChildren; + childrenWalkers[168 /* LogicalNotExpression */] = walkPrefixUnaryExpressionChildren; + childrenWalkers[188 /* LogicalOrExpression */] = walkBinaryExpressionChildren; + childrenWalkers[213 /* MemberAccessExpression */] = walkMemberAccessExpressionChildren; + childrenWalkers[136 /* MemberFunctionDeclaration */] = walkMemberFunctionDeclarationChildren; + childrenWalkers[137 /* MemberVariableDeclaration */] = walkMemberVariableDeclarationChildren; + childrenWalkers[146 /* MethodSignature */] = walkMethodSignatureChildren; + childrenWalkers[131 /* ModuleDeclaration */] = walkModuleDeclarationChildren; + childrenWalkers[247 /* ModuleNameModuleReference */] = walkModuleNameModuleReferenceChildren; + childrenWalkers[180 /* ModuloAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[208 /* ModuloExpression */] = walkBinaryExpressionChildren; + childrenWalkers[178 /* MultiplyAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[206 /* MultiplyExpression */] = walkBinaryExpressionChildren; childrenWalkers[11 /* IdentifierName */] = null; - childrenWalkers[165 /* NegateExpression */] = walkPrefixUnaryExpressionChildren; + childrenWalkers[166 /* NegateExpression */] = walkPrefixUnaryExpressionChildren; childrenWalkers[0 /* None */] = null; - childrenWalkers[195 /* NotEqualsExpression */] = walkBinaryExpressionChildren; - childrenWalkers[193 /* NotEqualsWithTypeConversionExpression */] = walkBinaryExpressionChildren; + childrenWalkers[196 /* NotEqualsExpression */] = walkBinaryExpressionChildren; + childrenWalkers[194 /* NotEqualsWithTypeConversionExpression */] = walkBinaryExpressionChildren; childrenWalkers[32 /* NullKeyword */] = null; childrenWalkers[67 /* NumberKeyword */] = null; childrenWalkers[13 /* NumericLiteral */] = null; - childrenWalkers[216 /* ObjectCreationExpression */] = walkObjectCreationExpressionChildren; - childrenWalkers[215 /* ObjectLiteralExpression */] = walkObjectLiteralExpressionChildren; + childrenWalkers[217 /* ObjectCreationExpression */] = walkObjectCreationExpressionChildren; + childrenWalkers[216 /* ObjectLiteralExpression */] = walkObjectLiteralExpressionChildren; childrenWalkers[122 /* ObjectType */] = walkObjectTypeChildren; - childrenWalkers[223 /* OmittedExpression */] = null; - childrenWalkers[182 /* OrAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[242 /* Parameter */] = walkParameterChildren; - childrenWalkers[227 /* ParameterList */] = walkParameterListChildren; - childrenWalkers[217 /* ParenthesizedExpression */] = walkParenthesizedExpressionChildren; - childrenWalkers[164 /* PlusExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[211 /* PostDecrementExpression */] = walkPostfixUnaryExpressionChildren; - childrenWalkers[210 /* PostIncrementExpression */] = walkPostfixUnaryExpressionChildren; - childrenWalkers[169 /* PreDecrementExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[168 /* PreIncrementExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[141 /* PropertySignature */] = walkPropertySignatureChildren; + childrenWalkers[224 /* OmittedExpression */] = null; + childrenWalkers[183 /* OrAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[243 /* Parameter */] = walkParameterChildren; + childrenWalkers[228 /* ParameterList */] = walkParameterListChildren; + childrenWalkers[218 /* ParenthesizedExpression */] = walkParenthesizedExpressionChildren; + childrenWalkers[165 /* PlusExpression */] = walkPrefixUnaryExpressionChildren; + childrenWalkers[212 /* PostDecrementExpression */] = walkPostfixUnaryExpressionChildren; + childrenWalkers[211 /* PostIncrementExpression */] = walkPostfixUnaryExpressionChildren; + childrenWalkers[170 /* PreDecrementExpression */] = walkPrefixUnaryExpressionChildren; + childrenWalkers[169 /* PreIncrementExpression */] = walkPrefixUnaryExpressionChildren; + childrenWalkers[142 /* PropertySignature */] = walkPropertySignatureChildren; childrenWalkers[121 /* QualifiedName */] = walkQualifiedNameChildren; childrenWalkers[12 /* RegularExpressionLiteral */] = null; - childrenWalkers[150 /* ReturnStatement */] = walkReturnStatementChildren; + childrenWalkers[151 /* ReturnStatement */] = walkReturnStatementChildren; childrenWalkers[120 /* SourceUnit */] = walkScriptChildren; childrenWalkers[2 /* SeparatedList */] = walkSeparatedListChildren; - childrenWalkers[140 /* SetAccessor */] = walkSetAccessorChildren; - childrenWalkers[184 /* SignedRightShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[203 /* SignedRightShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[240 /* SimplePropertyAssignment */] = walkSimplePropertyAssignmentChildren; + childrenWalkers[141 /* SetAccessor */] = walkSetAccessorChildren; + childrenWalkers[185 /* SignedRightShiftAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[204 /* SignedRightShiftExpression */] = walkBinaryExpressionChildren; + childrenWalkers[241 /* SimplePropertyAssignment */] = walkSimplePropertyAssignmentChildren; childrenWalkers[14 /* StringLiteral */] = null; childrenWalkers[69 /* StringKeyword */] = null; - childrenWalkers[176 /* SubtractAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[209 /* SubtractExpression */] = walkBinaryExpressionChildren; + childrenWalkers[177 /* SubtractAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[210 /* SubtractExpression */] = walkBinaryExpressionChildren; childrenWalkers[50 /* SuperKeyword */] = null; - childrenWalkers[151 /* SwitchStatement */] = walkSwitchStatementChildren; + childrenWalkers[152 /* SwitchStatement */] = walkSwitchStatementChildren; childrenWalkers[35 /* ThisKeyword */] = null; - childrenWalkers[157 /* ThrowStatement */] = walkThrowStatementChildren; + childrenWalkers[158 /* ThrowStatement */] = walkThrowStatementChildren; childrenWalkers[3 /* TriviaList */] = null; childrenWalkers[37 /* TrueKeyword */] = null; - childrenWalkers[159 /* TryStatement */] = walkTryStatementChildren; - childrenWalkers[244 /* TypeAnnotation */] = walkTypeAnnotationChildren; - childrenWalkers[228 /* TypeArgumentList */] = walkTypeArgumentListChildren; - childrenWalkers[171 /* TypeOfExpression */] = walkTypeOfExpressionChildren; - childrenWalkers[238 /* TypeParameter */] = walkTypeParameterChildren; - childrenWalkers[229 /* TypeParameterList */] = walkTypeParameterListChildren; + childrenWalkers[160 /* TryStatement */] = walkTryStatementChildren; + childrenWalkers[128 /* TupleType */] = walkTupleTypeChildren; + childrenWalkers[245 /* TypeAnnotation */] = walkTypeAnnotationChildren; + childrenWalkers[229 /* TypeArgumentList */] = walkTypeArgumentListChildren; + childrenWalkers[172 /* TypeOfExpression */] = walkTypeOfExpressionChildren; + childrenWalkers[239 /* TypeParameter */] = walkTypeParameterChildren; + childrenWalkers[230 /* TypeParameterList */] = walkTypeParameterListChildren; childrenWalkers[127 /* TypeQuery */] = walkTypeQueryChildren; - childrenWalkers[185 /* UnsignedRightShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[204 /* UnsignedRightShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[224 /* VariableDeclaration */] = walkVariableDeclarationChildren; - childrenWalkers[225 /* VariableDeclarator */] = walkVariableDeclaratorChildren; - childrenWalkers[148 /* VariableStatement */] = walkVariableStatementChildren; - childrenWalkers[172 /* VoidExpression */] = walkVoidExpressionChildren; + childrenWalkers[186 /* UnsignedRightShiftAssignmentExpression */] = walkBinaryExpressionChildren; + childrenWalkers[205 /* UnsignedRightShiftExpression */] = walkBinaryExpressionChildren; + childrenWalkers[225 /* VariableDeclaration */] = walkVariableDeclarationChildren; + childrenWalkers[226 /* VariableDeclarator */] = walkVariableDeclaratorChildren; + childrenWalkers[149 /* VariableStatement */] = walkVariableStatementChildren; + childrenWalkers[173 /* VoidExpression */] = walkVoidExpressionChildren; childrenWalkers[41 /* VoidKeyword */] = null; - childrenWalkers[158 /* WhileStatement */] = walkWhileStatementChildren; - childrenWalkers[163 /* WithStatement */] = walkWithStatementChildren; + childrenWalkers[159 /* WhileStatement */] = walkWhileStatementChildren; + childrenWalkers[164 /* WithStatement */] = walkWithStatementChildren; for (var e in TypeScript.SyntaxKind) { if (TypeScript.SyntaxKind.hasOwnProperty(e) && TypeScript.StringUtilities.isString(TypeScript.SyntaxKind[e])) { TypeScript.Debug.assert(childrenWalkers[e] !== undefined, "Fix initWalkers: " + TypeScript.SyntaxKind[e]); @@ -29848,12 +30682,12 @@ var TypeScript; var top = null; var pre = function (cur, walker) { if (!TypeScript.isShared(cur) && isValidAstNode(cur)) { - var isInvalid1 = cur.kind() === 149 /* ExpressionStatement */ && TypeScript.width(cur) === 0; + var isInvalid1 = cur.kind() === 150 /* ExpressionStatement */ && TypeScript.width(cur) === 0; if (isInvalid1) { walker.options.goChildren = false; } else { - var inclusive = forceInclusive || cur.kind() === 11 /* IdentifierName */ || cur.kind() === 212 /* MemberAccessExpression */ || cur.kind() === 121 /* QualifiedName */ || cur.kind() === 224 /* VariableDeclaration */ || cur.kind() === 225 /* VariableDeclarator */ || cur.kind() === 213 /* InvocationExpression */ || pos === TypeScript.end(script) + TypeScript.lastToken(script).trailingTriviaWidth(); + var inclusive = forceInclusive || cur.kind() === 11 /* IdentifierName */ || cur.kind() === 213 /* MemberAccessExpression */ || cur.kind() === 121 /* QualifiedName */ || cur.kind() === 225 /* VariableDeclaration */ || cur.kind() === 226 /* VariableDeclarator */ || cur.kind() === 214 /* InvocationExpression */ || pos === TypeScript.end(script) + TypeScript.lastToken(script).trailingTriviaWidth(); var minChar = TypeScript.start(cur); var limChar = TypeScript.end(cur) + (useTrailingTriviaAsLimChar ? TypeScript.trailingTriviaWidth(cur) : 0) + (inclusive ? 1 : 0); if (pos >= minChar && pos < limChar) { @@ -29877,11 +30711,11 @@ var TypeScript; } ASTHelpers.getAstAtPosition = getAstAtPosition; function getExtendsHeritageClause(clauses) { - return getHeritageClause(clauses, 230 /* ExtendsHeritageClause */); + return getHeritageClause(clauses, 231 /* ExtendsHeritageClause */); } ASTHelpers.getExtendsHeritageClause = getExtendsHeritageClause; function getImplementsHeritageClause(clauses) { - return getHeritageClause(clauses, 231 /* ImplementsHeritageClause */); + return getHeritageClause(clauses, 232 /* ImplementsHeritageClause */); } ASTHelpers.getImplementsHeritageClause = getImplementsHeritageClause; function getHeritageClause(clauses, kind) { @@ -29896,7 +30730,7 @@ var TypeScript; return null; } function isCallExpression(ast) { - return (ast && ast.kind() === 213 /* InvocationExpression */) || (ast && ast.kind() === 216 /* ObjectCreationExpression */); + return (ast && ast.kind() === 214 /* InvocationExpression */) || (ast && ast.kind() === 217 /* ObjectCreationExpression */); } ASTHelpers.isCallExpression = isCallExpression; function isCallExpressionTarget(ast) { @@ -29909,14 +30743,14 @@ var TypeScript; } var current = ast; while (current && current.parent) { - if (current.parent.kind() === 212 /* MemberAccessExpression */ && current.parent.name === current) { + if (current.parent.kind() === 213 /* MemberAccessExpression */ && current.parent.name === current) { current = current.parent; continue; } break; } if (current && current.parent) { - if (current.parent.kind() === 213 /* InvocationExpression */ || current.parent.kind() === 216 /* ObjectCreationExpression */) { + if (current.parent.kind() === 214 /* InvocationExpression */ || current.parent.kind() === 217 /* ObjectCreationExpression */) { return current === current.parent.expression ? current : null; } } @@ -29931,35 +30765,35 @@ var TypeScript; return false; } switch (ast.parent.kind()) { - case 131 /* ClassDeclaration */: + case 132 /* ClassDeclaration */: return ast.parent.identifier === ast; - case 128 /* InterfaceDeclaration */: + case 129 /* InterfaceDeclaration */: return ast.parent.identifier === ast; - case 132 /* EnumDeclaration */: + case 133 /* EnumDeclaration */: return ast.parent.identifier === ast; - case 130 /* ModuleDeclaration */: + case 131 /* ModuleDeclaration */: return ast.parent.name === ast || ast.parent.stringLiteral === ast; - case 225 /* VariableDeclarator */: + case 226 /* VariableDeclarator */: return ast.parent.propertyName === ast; - case 129 /* FunctionDeclaration */: + case 130 /* FunctionDeclaration */: return ast.parent.identifier === ast; - case 135 /* MemberFunctionDeclaration */: + case 136 /* MemberFunctionDeclaration */: return ast.parent.propertyName === ast; - case 242 /* Parameter */: + case 243 /* Parameter */: return ast.parent.identifier === ast; - case 238 /* TypeParameter */: + case 239 /* TypeParameter */: return ast.parent.identifier === ast; - case 240 /* SimplePropertyAssignment */: + case 241 /* SimplePropertyAssignment */: return ast.parent.propertyName === ast; - case 241 /* FunctionPropertyAssignment */: + case 242 /* FunctionPropertyAssignment */: return ast.parent.propertyName === ast; - case 243 /* EnumElement */: + case 244 /* EnumElement */: return ast.parent.propertyName === ast; - case 133 /* ImportDeclaration */: + case 134 /* ImportDeclaration */: return ast.parent.identifier === ast; - case 145 /* MethodSignature */: + case 146 /* MethodSignature */: return ast.parent.propertyName === ast; - case 141 /* PropertySignature */: + case 142 /* PropertySignature */: return ast.parent.propertyName === ast; } return false; @@ -29972,14 +30806,14 @@ var TypeScript; var current = ast; while (current) { switch (current.kind()) { - case 232 /* EqualsValueClause */: - if (current.parent && current.parent.kind() === 242 /* Parameter */) { + case 233 /* EqualsValueClause */: + if (current.parent && current.parent.kind() === 243 /* Parameter */) { return current.parent; } break; - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 130 /* ModuleDeclaration */: + case 132 /* ClassDeclaration */: + case 129 /* InterfaceDeclaration */: + case 131 /* ModuleDeclaration */: return null; } current = current.parent; @@ -29991,15 +30825,15 @@ var TypeScript; var current = ast; while (current) { switch (current.kind()) { - case 136 /* MemberVariableDeclaration */: - case 145 /* MethodSignature */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: + case 137 /* MemberVariableDeclaration */: + case 146 /* MethodSignature */: + case 136 /* MemberFunctionDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: return current; - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 130 /* ModuleDeclaration */: + case 132 /* ClassDeclaration */: + case 129 /* InterfaceDeclaration */: + case 131 /* ModuleDeclaration */: return null; } current = current.parent; @@ -30008,15 +30842,15 @@ var TypeScript; } ASTHelpers.getEnclosingMemberDeclaration = getEnclosingMemberDeclaration; function isNameOfFunction(ast) { - return ast && ast.parent && ast.kind() === 11 /* IdentifierName */ && ast.parent.kind() === 129 /* FunctionDeclaration */ && ast.parent.identifier === ast; + return ast && ast.parent && ast.kind() === 11 /* IdentifierName */ && ast.parent.kind() === 130 /* FunctionDeclaration */ && ast.parent.identifier === ast; } ASTHelpers.isNameOfFunction = isNameOfFunction; function isNameOfMemberFunction(ast) { - return ast && ast.parent && ast.kind() === 11 /* IdentifierName */ && ast.parent.kind() === 135 /* MemberFunctionDeclaration */ && ast.parent.propertyName === ast; + return ast && ast.parent && ast.kind() === 11 /* IdentifierName */ && ast.parent.kind() === 136 /* MemberFunctionDeclaration */ && ast.parent.propertyName === ast; } ASTHelpers.isNameOfMemberFunction = isNameOfMemberFunction; function isNameOfMemberAccessExpression(ast) { - if (ast && ast.parent && ast.parent.kind() === 212 /* MemberAccessExpression */ && ast.parent.name === ast) { + if (ast && ast.parent && ast.parent.kind() === 213 /* MemberAccessExpression */ && ast.parent.name === ast) { return true; } return false; @@ -30030,40 +30864,40 @@ var TypeScript; } ASTHelpers.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function parentIsModuleDeclaration(ast) { - return ast.parent && ast.parent.kind() === 130 /* ModuleDeclaration */; + return ast.parent && ast.parent.kind() === 131 /* ModuleDeclaration */; } ASTHelpers.parentIsModuleDeclaration = parentIsModuleDeclaration; function isDeclarationAST(ast) { switch (ast.kind()) { - case 225 /* VariableDeclarator */: + case 226 /* VariableDeclarator */: return getVariableStatement(ast) !== null; - case 133 /* ImportDeclaration */: - case 131 /* ClassDeclaration */: - case 128 /* InterfaceDeclaration */: - case 242 /* Parameter */: - case 219 /* SimpleArrowFunctionExpression */: - case 218 /* ParenthesizedArrowFunctionExpression */: - case 144 /* IndexSignature */: - case 129 /* FunctionDeclaration */: - case 130 /* ModuleDeclaration */: + case 134 /* ImportDeclaration */: + case 132 /* ClassDeclaration */: + case 129 /* InterfaceDeclaration */: + case 243 /* Parameter */: + case 220 /* SimpleArrowFunctionExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: + case 145 /* IndexSignature */: + case 130 /* FunctionDeclaration */: + case 131 /* ModuleDeclaration */: case 124 /* ArrayType */: case 122 /* ObjectType */: - case 238 /* TypeParameter */: - case 137 /* ConstructorDeclaration */: - case 135 /* MemberFunctionDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 136 /* MemberVariableDeclaration */: - case 138 /* IndexMemberDeclaration */: - case 132 /* EnumDeclaration */: - case 243 /* EnumElement */: - case 240 /* SimplePropertyAssignment */: - case 241 /* FunctionPropertyAssignment */: - case 222 /* FunctionExpression */: - case 142 /* CallSignature */: - case 143 /* ConstructSignature */: - case 145 /* MethodSignature */: - case 141 /* PropertySignature */: + case 239 /* TypeParameter */: + case 138 /* ConstructorDeclaration */: + case 136 /* MemberFunctionDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 137 /* MemberVariableDeclaration */: + case 139 /* IndexMemberDeclaration */: + case 133 /* EnumDeclaration */: + case 244 /* EnumElement */: + case 241 /* SimplePropertyAssignment */: + case 242 /* FunctionPropertyAssignment */: + case 223 /* FunctionExpression */: + case 143 /* CallSignature */: + case 144 /* ConstructSignature */: + case 146 /* MethodSignature */: + case 142 /* PropertySignature */: return true; default: return false; @@ -30073,30 +30907,30 @@ var TypeScript; function preComments(element, text) { if (element) { switch (element.kind()) { - case 148 /* VariableStatement */: - case 149 /* ExpressionStatement */: - case 131 /* ClassDeclaration */: - case 133 /* ImportDeclaration */: - case 129 /* FunctionDeclaration */: - case 130 /* ModuleDeclaration */: - case 132 /* EnumDeclaration */: - case 147 /* IfStatement */: - case 240 /* SimplePropertyAssignment */: - case 135 /* MemberFunctionDeclaration */: - case 128 /* InterfaceDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 150 /* ReturnStatement */: - case 137 /* ConstructorDeclaration */: - case 136 /* MemberVariableDeclaration */: - case 243 /* EnumElement */: - case 142 /* CallSignature */: - case 143 /* ConstructSignature */: - case 144 /* IndexSignature */: - case 141 /* PropertySignature */: - case 145 /* MethodSignature */: - case 241 /* FunctionPropertyAssignment */: - case 242 /* Parameter */: + case 149 /* VariableStatement */: + case 150 /* ExpressionStatement */: + case 132 /* ClassDeclaration */: + case 134 /* ImportDeclaration */: + case 130 /* FunctionDeclaration */: + case 131 /* ModuleDeclaration */: + case 133 /* EnumDeclaration */: + case 148 /* IfStatement */: + case 241 /* SimplePropertyAssignment */: + case 136 /* MemberFunctionDeclaration */: + case 129 /* InterfaceDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 151 /* ReturnStatement */: + case 138 /* ConstructorDeclaration */: + case 137 /* MemberVariableDeclaration */: + case 244 /* EnumElement */: + case 143 /* CallSignature */: + case 144 /* ConstructSignature */: + case 145 /* IndexSignature */: + case 142 /* PropertySignature */: + case 146 /* MethodSignature */: + case 242 /* FunctionPropertyAssignment */: + case 243 /* Parameter */: return convertNodeLeadingComments(element, text); } } @@ -30106,31 +30940,31 @@ var TypeScript; function postComments(element, text) { if (element) { switch (element.kind()) { - case 149 /* ExpressionStatement */: + case 150 /* ExpressionStatement */: return convertNodeTrailingComments(element, text, true); - case 148 /* VariableStatement */: - case 131 /* ClassDeclaration */: - case 133 /* ImportDeclaration */: - case 129 /* FunctionDeclaration */: - case 130 /* ModuleDeclaration */: - case 132 /* EnumDeclaration */: - case 147 /* IfStatement */: - case 240 /* SimplePropertyAssignment */: - case 135 /* MemberFunctionDeclaration */: - case 128 /* InterfaceDeclaration */: - case 139 /* GetAccessor */: - case 140 /* SetAccessor */: - case 150 /* ReturnStatement */: - case 137 /* ConstructorDeclaration */: - case 136 /* MemberVariableDeclaration */: - case 243 /* EnumElement */: - case 142 /* CallSignature */: - case 143 /* ConstructSignature */: - case 144 /* IndexSignature */: - case 141 /* PropertySignature */: - case 145 /* MethodSignature */: - case 241 /* FunctionPropertyAssignment */: - case 242 /* Parameter */: + case 149 /* VariableStatement */: + case 132 /* ClassDeclaration */: + case 134 /* ImportDeclaration */: + case 130 /* FunctionDeclaration */: + case 131 /* ModuleDeclaration */: + case 133 /* EnumDeclaration */: + case 148 /* IfStatement */: + case 241 /* SimplePropertyAssignment */: + case 136 /* MemberFunctionDeclaration */: + case 129 /* InterfaceDeclaration */: + case 140 /* GetAccessor */: + case 141 /* SetAccessor */: + case 151 /* ReturnStatement */: + case 138 /* ConstructorDeclaration */: + case 137 /* MemberVariableDeclaration */: + case 244 /* EnumElement */: + case 143 /* CallSignature */: + case 144 /* ConstructSignature */: + case 145 /* IndexSignature */: + case 142 /* PropertySignature */: + case 146 /* MethodSignature */: + case 242 /* FunctionPropertyAssignment */: + case 243 /* Parameter */: return convertNodeTrailingComments(element, text); } } @@ -30188,10 +31022,10 @@ var TypeScript; function docComments(ast, text) { if (isDeclarationAST(ast)) { var comments = null; - if (ast.kind() === 225 /* VariableDeclarator */) { + if (ast.kind() === 226 /* VariableDeclarator */) { comments = TypeScript.ASTHelpers.preComments(getVariableStatement(ast), text); } - else if (ast.kind() === 242 /* Parameter */) { + else if (ast.kind() === 243 /* Parameter */) { comments = TypeScript.ASTHelpers.preComments(ast, text); if (!comments) { var previousToken = TypeScript.findToken(TypeScript.syntaxTree(ast).sourceUnit(), TypeScript.firstToken(ast).fullStart() - 1); @@ -30221,31 +31055,31 @@ var TypeScript; function getParameterList(ast) { if (ast) { switch (ast.kind()) { - case 137 /* ConstructorDeclaration */: + case 138 /* ConstructorDeclaration */: return getParameterList(ast.callSignature); - case 129 /* FunctionDeclaration */: + case 130 /* FunctionDeclaration */: return getParameterList(ast.callSignature); - case 218 /* ParenthesizedArrowFunctionExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: return getParameterList(ast.callSignature); - case 143 /* ConstructSignature */: + case 144 /* ConstructSignature */: return getParameterList(ast.callSignature); - case 135 /* MemberFunctionDeclaration */: + case 136 /* MemberFunctionDeclaration */: return getParameterList(ast.callSignature); - case 241 /* FunctionPropertyAssignment */: + case 242 /* FunctionPropertyAssignment */: return getParameterList(ast.callSignature); - case 222 /* FunctionExpression */: + case 223 /* FunctionExpression */: return getParameterList(ast.callSignature); - case 145 /* MethodSignature */: + case 146 /* MethodSignature */: return getParameterList(ast.callSignature); case 125 /* ConstructorType */: return ast.parameterList; case 123 /* FunctionType */: return ast.parameterList; - case 142 /* CallSignature */: + case 143 /* CallSignature */: return ast.parameterList; - case 139 /* GetAccessor */: + case 140 /* GetAccessor */: return getParameterList(ast.callSignature); - case 140 /* SetAccessor */: + case 141 /* SetAccessor */: return getParameterList(ast.callSignature); } } @@ -30255,41 +31089,41 @@ var TypeScript; function getType(ast) { if (ast) { switch (ast.kind()) { - case 129 /* FunctionDeclaration */: + case 130 /* FunctionDeclaration */: return getType(ast.callSignature); - case 218 /* ParenthesizedArrowFunctionExpression */: + case 219 /* ParenthesizedArrowFunctionExpression */: return getType(ast.callSignature); - case 143 /* ConstructSignature */: + case 144 /* ConstructSignature */: return getType(ast.callSignature); - case 135 /* MemberFunctionDeclaration */: + case 136 /* MemberFunctionDeclaration */: return getType(ast.callSignature); - case 241 /* FunctionPropertyAssignment */: + case 242 /* FunctionPropertyAssignment */: return getType(ast.callSignature); - case 222 /* FunctionExpression */: + case 223 /* FunctionExpression */: return getType(ast.callSignature); - case 145 /* MethodSignature */: + case 146 /* MethodSignature */: return getType(ast.callSignature); - case 142 /* CallSignature */: + case 143 /* CallSignature */: return getType(ast.typeAnnotation); - case 144 /* IndexSignature */: + case 145 /* IndexSignature */: return getType(ast.typeAnnotation); - case 141 /* PropertySignature */: + case 142 /* PropertySignature */: return getType(ast.typeAnnotation); - case 139 /* GetAccessor */: + case 140 /* GetAccessor */: return getType(ast.callSignature); - case 242 /* Parameter */: + case 243 /* Parameter */: return getType(ast.typeAnnotation); - case 136 /* MemberVariableDeclaration */: + case 137 /* MemberVariableDeclaration */: return getType(ast.variableDeclarator); - case 225 /* VariableDeclarator */: + case 226 /* VariableDeclarator */: return getType(ast.typeAnnotation); - case 236 /* CatchClause */: + case 237 /* CatchClause */: return getType(ast.typeAnnotation); case 125 /* ConstructorType */: return ast.type; case 123 /* FunctionType */: return ast.type; - case 244 /* TypeAnnotation */: + case 245 /* TypeAnnotation */: return ast.type; } } @@ -30297,7 +31131,7 @@ var TypeScript; } ASTHelpers.getType = getType; function getVariableStatement(variableDeclarator) { - if (variableDeclarator && variableDeclarator.parent && variableDeclarator.parent.parent && variableDeclarator.parent.parent.parent && variableDeclarator.parent.kind() === 2 /* SeparatedList */ && variableDeclarator.parent.parent.kind() === 224 /* VariableDeclaration */ && variableDeclarator.parent.parent.parent.kind() === 148 /* VariableStatement */) { + if (variableDeclarator && variableDeclarator.parent && variableDeclarator.parent.parent && variableDeclarator.parent.parent.parent && variableDeclarator.parent.kind() === 2 /* SeparatedList */ && variableDeclarator.parent.parent.kind() === 225 /* VariableDeclaration */ && variableDeclarator.parent.parent.parent.kind() === 149 /* VariableStatement */) { return variableDeclarator.parent.parent.parent; } return null; @@ -30310,8 +31144,8 @@ var TypeScript; function isIntegerLiteralAST(expression) { if (expression) { switch (expression.kind()) { - case 164 /* PlusExpression */: - case 165 /* NegateExpression */: + case 165 /* PlusExpression */: + case 166 /* NegateExpression */: expression = expression.operand; return expression.kind() === 13 /* NumericLiteral */ && TypeScript.IntegerUtilities.isInteger(expression.text()); case 13 /* NumericLiteral */: @@ -30324,7 +31158,7 @@ var TypeScript; ASTHelpers.isIntegerLiteralAST = isIntegerLiteralAST; function getEnclosingModuleDeclaration(ast) { while (ast) { - if (ast.kind() === 130 /* ModuleDeclaration */) { + if (ast.kind() === 131 /* ModuleDeclaration */) { return ast; } ast = ast.parent; @@ -30658,7 +31492,7 @@ var TypeScript; })(TypeScript || (TypeScript = {})); var ts; (function (ts) { - var scanner = ts.createScanner(1 /* ES5 */); + var scanner = ts.createScanner(1 /* ES5 */, true); var emptyArray = []; function createNode(kind, pos, end, flags, parent) { var node = new (ts.getNodeConstructor(kind))(); @@ -30673,12 +31507,12 @@ var ts; } NodeObject.prototype.getSourceFile = function () { var node = this; - while (node.kind !== 177 /* SourceFile */) + while (node.kind !== 182 /* SourceFile */) node = node.parent; return node; }; - NodeObject.prototype.getStart = function () { - return ts.getTokenPosOfNode(this); + NodeObject.prototype.getStart = function (sourceFile) { + return ts.getTokenPosOfNode(this, sourceFile); }; NodeObject.prototype.getFullStart = function () { return this.pos; @@ -30686,30 +31520,30 @@ var ts; NodeObject.prototype.getEnd = function () { return this.end; }; - NodeObject.prototype.getWidth = function () { - return this.getEnd() - this.getStart(); + NodeObject.prototype.getWidth = function (sourceFile) { + return this.getEnd() - this.getStart(sourceFile); }; NodeObject.prototype.getFullWidth = function () { return this.end - this.getFullStart(); }; - NodeObject.prototype.getLeadingTriviaWidth = function () { - return this.getStart() - this.pos; + NodeObject.prototype.getLeadingTriviaWidth = function (sourceFile) { + return this.getStart(sourceFile) - this.pos; }; - NodeObject.prototype.getFullText = function () { - return this.getSourceFile().text.substring(this.pos, this.end); + NodeObject.prototype.getFullText = function (sourceFile) { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); }; NodeObject.prototype.addSyntheticNodes = function (nodes, pos, end) { scanner.setTextPos(pos); while (pos < end) { var token = scanner.scan(); var textPos = scanner.getTextPos(); - var node = nodes.push(createNode(token, pos, textPos, 256 /* Synthetic */, this)); + var node = nodes.push(createNode(token, pos, textPos, 512 /* Synthetic */, this)); pos = textPos; } return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(179 /* SyntaxList */, nodes.pos, nodes.end, 256 /* Synthetic */, this); + var list = createNode(184 /* SyntaxList */, nodes.pos, nodes.end, 512 /* Synthetic */, this); list._children = []; var pos = nodes.pos; for (var i = 0, len = nodes.length; i < len; i++) { @@ -30725,10 +31559,10 @@ var ts; } return list; }; - NodeObject.prototype.createChildren = function () { + NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; - if (this.kind > 111 /* Missing */) { - scanner.setText(this.getSourceFile().text); + if (this.kind > 115 /* Missing */) { + scanner.setText((sourceFile || this.getSourceFile()).text); var children = []; var pos = this.pos; var processNode = function (node) { @@ -30753,39 +31587,39 @@ var ts; } this._children = children || emptyArray; }; - NodeObject.prototype.getChildCount = function () { + NodeObject.prototype.getChildCount = function (sourceFile) { if (!this._children) - this.createChildren(); + this.createChildren(sourceFile); return this._children.length; }; - NodeObject.prototype.getChildAt = function (index) { + NodeObject.prototype.getChildAt = function (index, sourceFile) { if (!this._children) - this.createChildren(); + this.createChildren(sourceFile); return this._children[index]; }; - NodeObject.prototype.getChildren = function () { + NodeObject.prototype.getChildren = function (sourceFile) { if (!this._children) - this.createChildren(); + this.createChildren(sourceFile); return this._children; }; - NodeObject.prototype.getFirstToken = function () { - var children = this.getChildren(); + NodeObject.prototype.getFirstToken = function (sourceFile) { + var children = this.getChildren(sourceFile); for (var i = 0; i < children.length; i++) { var child = children[i]; - if (child.kind < 111 /* Missing */) + if (child.kind < 115 /* Missing */) return child; - if (child.kind > 111 /* Missing */) - return child.getFirstToken(); + if (child.kind > 115 /* Missing */) + return child.getFirstToken(sourceFile); } }; - NodeObject.prototype.getLastToken = function () { - var children = this.getChildren(); + NodeObject.prototype.getLastToken = function (sourceFile) { + var children = this.getChildren(sourceFile); for (var i = children.length - 1; i >= 0; i--) { var child = children[i]; - if (child.kind < 111 /* Missing */) + if (child.kind < 115 /* Missing */) return child; - if (child.kind > 111 /* Missing */) - return child.getLastToken(); + if (child.kind > 115 /* Missing */) + return child.getLastToken(sourceFile); } }; return NodeObject; @@ -30879,6 +31713,50 @@ var ts; SourceFileObject.prototype.getLineMap = function () { return this.getSyntaxTree().lineMap(); }; + SourceFileObject.prototype.getNamedDeclarations = function () { + if (!this.namedDeclarations) { + var sourceFile = this; + var namedDeclarations = []; + var isExternalModule = ts.isExternalModule(sourceFile); + ts.forEachChild(sourceFile, function visit(node) { + switch (node.kind) { + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: + case 177 /* ModuleDeclaration */: + case 179 /* ImportDeclaration */: + case 120 /* Method */: + case 172 /* FunctionDeclaration */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 129 /* TypeLiteral */: + if (node.name) { + namedDeclarations.push(node); + } + ts.forEachChild(node, visit); + break; + case 149 /* VariableStatement */: + case 178 /* ModuleBlock */: + case 173 /* FunctionBlock */: + ts.forEachChild(node, visit); + break; + case 118 /* Parameter */: + if (!(node.flags & ts.NodeFlags.AccessibilityModifier)) { + break; + } + case 171 /* VariableDeclaration */: + case 181 /* EnumMember */: + case 119 /* Property */: + namedDeclarations.push(node); + break; + } + return undefined; + }); + this.namedDeclarations = namedDeclarations; + } + return this.namedDeclarations; + }; SourceFileObject.prototype.getSyntaxTree = function () { if (!this.syntaxTree) { var start = new Date().getTime(); @@ -30917,6 +31795,34 @@ var ts; }; return SourceFileObject; })(NodeObject); + var ClassificationTypeNames = (function () { + function ClassificationTypeNames() { + } + ClassificationTypeNames.comment = "comment"; + ClassificationTypeNames.identifier = "identifier"; + ClassificationTypeNames.keyword = "keyword"; + ClassificationTypeNames.numericLiteral = "number"; + ClassificationTypeNames.operator = "operator"; + ClassificationTypeNames.stringLiteral = "string"; + ClassificationTypeNames.whiteSpace = "whitespace"; + ClassificationTypeNames.text = "text"; + ClassificationTypeNames.punctuation = "punctuation"; + ClassificationTypeNames.className = "class name"; + ClassificationTypeNames.enumName = "enum name"; + ClassificationTypeNames.interfaceName = "interface name"; + ClassificationTypeNames.moduleName = "module name"; + ClassificationTypeNames.typeParameterName = "type parameter name"; + return ClassificationTypeNames; + })(); + ts.ClassificationTypeNames = ClassificationTypeNames; + var ClassifiedSpan = (function () { + function ClassifiedSpan(textSpan, classificationType) { + this.textSpan = textSpan; + this.classificationType = classificationType; + } + return ClassifiedSpan; + })(); + ts.ClassifiedSpan = ClassifiedSpan; var NavigationBarItem = (function () { function NavigationBarItem(text, kind, kindModifiers, spans, childItems, indent, bolded, grayed) { if (childItems === void 0) { childItems = null; } @@ -31075,13 +31981,6 @@ var ts; return SignatureHelpState; })(); ts.SignatureHelpState = SignatureHelpState; - (function (EmitOutputResult) { - EmitOutputResult[EmitOutputResult["Succeeded"] = 0] = "Succeeded"; - EmitOutputResult[EmitOutputResult["FailedBecauseOfSyntaxErrors"] = 1] = "FailedBecauseOfSyntaxErrors"; - EmitOutputResult[EmitOutputResult["FailedBecauseOfCompilerOptionsErrors"] = 2] = "FailedBecauseOfCompilerOptionsErrors"; - EmitOutputResult[EmitOutputResult["FailedToGenerateDeclarationsBecauseOfSemanticErrors"] = 3] = "FailedToGenerateDeclarationsBecauseOfSemanticErrors"; - })(ts.EmitOutputResult || (ts.EmitOutputResult = {})); - var EmitOutputResult = ts.EmitOutputResult; (function (OutputFileType) { OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript"; OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap"; @@ -31093,7 +31992,6 @@ var ts; EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; - EndOfLineState[EndOfLineState["EndingWithDotToken"] = 4] = "EndingWithDotToken"; })(ts.EndOfLineState || (ts.EndOfLineState = {})); var EndOfLineState = ts.EndOfLineState; (function (TokenClass) { @@ -31149,16 +32047,13 @@ var ts; return ScriptElementKindModifier; })(); ts.ScriptElementKindModifier = ScriptElementKindModifier; - var MatchKind = (function () { - function MatchKind() { - } - MatchKind.none = null; - MatchKind.exact = "exact"; - MatchKind.subString = "substring"; - MatchKind.prefix = "prefix"; - return MatchKind; - })(); - ts.MatchKind = MatchKind; + var MatchKind; + (function (MatchKind) { + MatchKind[MatchKind["none"] = 0] = "none"; + MatchKind[MatchKind["exact"] = 1] = "exact"; + MatchKind[MatchKind["substring"] = 2] = "substring"; + MatchKind[MatchKind["prefix"] = 3] = "prefix"; + })(MatchKind || (MatchKind = {})); function getDefaultCompilerOptions() { return { target: 1 /* ES5 */, @@ -31450,7 +32345,7 @@ var ts; ts.createDocumentRegistry = createDocumentRegistry; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 159 /* LabelledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 164 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -31458,69 +32353,72 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 55 /* Identifier */ && (node.parent.kind === 153 /* BreakStatement */ || node.parent.kind === 152 /* ContinueStatement */) && node.parent.label === node; + return node.kind === 59 /* Identifier */ && (node.parent.kind === 158 /* BreakStatement */ || node.parent.kind === 157 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 55 /* Identifier */ && node.parent.kind === 159 /* LabelledStatement */ && node.parent.label === node; + return node.kind === 59 /* Identifier */ && node.parent.kind === 164 /* LabeledStatement */ && node.parent.label === node; + } + function isLabeledBy(node, labelName) { + for (var owner = node.parent; owner.kind === 164 /* LabeledStatement */; owner = owner.parent) { + if (owner.label.text === labelName) { + return true; + } + } + return false; } function isLabelName(node) { return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isCallExpressionTarget(node) { - if (node.parent.kind === 130 /* PropertyAccess */ && node.parent.right === node) + if (node.parent.kind === 135 /* PropertyAccess */ && node.parent.right === node) node = node.parent; - return node.parent.kind === 132 /* CallExpression */ && node.parent.func === node; + return node.parent.kind === 137 /* CallExpression */ && node.parent.func === node; } function isNewExpressionTarget(node) { - if (node.parent.kind === 130 /* PropertyAccess */ && node.parent.right === node) + if (node.parent.kind === 135 /* PropertyAccess */ && node.parent.right === node) node = node.parent; - return node.parent.kind === 133 /* NewExpression */ && node.parent.func === node; - } - function isAnyFunction(node) { - switch (node.kind) { - case 136 /* FunctionExpression */: - case 167 /* FunctionDeclaration */: - case 137 /* ArrowFunction */: - case 116 /* Method */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 117 /* Constructor */: - return true; - } - return false; + return node.parent.kind === 138 /* NewExpression */ && node.parent.func === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 55 /* Identifier */ && isAnyFunction(node.parent) && node.parent.name === node; + return node.kind === 59 /* Identifier */ && ts.isAnyFunction(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 55 /* Identifier */ || node.kind === 3 /* StringLiteral */ || node.kind === 2 /* NumericLiteral */) && node.parent.kind === 129 /* PropertyAssignment */ && node.parent.name === node; + return (node.kind === 59 /* Identifier */ || node.kind === 7 /* StringLiteral */ || node.kind === 6 /* NumericLiteral */) && node.parent.kind === 134 /* PropertyAssignment */ && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { - if (node.kind === 3 /* StringLiteral */ || node.kind === 2 /* NumericLiteral */) { + if (node.kind === 7 /* StringLiteral */ || node.kind === 6 /* NumericLiteral */) { switch (node.parent.kind) { - case 115 /* Property */: - case 129 /* PropertyAssignment */: - case 176 /* EnumMember */: - case 116 /* Method */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 172 /* ModuleDeclaration */: + case 119 /* Property */: + case 134 /* PropertyAssignment */: + case 181 /* EnumMember */: + case 120 /* Method */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 177 /* ModuleDeclaration */: return node.parent.name === node; - case 131 /* IndexedAccess */: + case 136 /* IndexedAccess */: return node.parent.index === node; } } return false; } function isNameOfExternalModuleImportOrDeclaration(node) { - return node.kind === 3 /* StringLiteral */ && ((node.parent.kind === 172 /* ModuleDeclaration */ && node.parent.name === node) || (node.parent.kind === 174 /* ImportDeclaration */ && node.parent.externalModuleName === node)); + return node.kind === 7 /* StringLiteral */ && ((node.parent.kind === 177 /* ModuleDeclaration */ && node.parent.name === node) || (node.parent.kind === 179 /* ImportDeclaration */ && node.parent.externalModuleName === node)); } var SearchMeaning; (function (SearchMeaning) { + SearchMeaning[SearchMeaning["None"] = 0x0] = "None"; SearchMeaning[SearchMeaning["Value"] = 0x1] = "Value"; SearchMeaning[SearchMeaning["Type"] = 0x2] = "Type"; SearchMeaning[SearchMeaning["Namespace"] = 0x4] = "Namespace"; })(SearchMeaning || (SearchMeaning = {})); + var BreakContinueSearchType; + (function (BreakContinueSearchType) { + BreakContinueSearchType[BreakContinueSearchType["None"] = 0x0] = "None"; + BreakContinueSearchType[BreakContinueSearchType["Unlabeled"] = 0x1] = "Unlabeled"; + BreakContinueSearchType[BreakContinueSearchType["Labeled"] = 0x2] = "Labeled"; + BreakContinueSearchType[BreakContinueSearchType["All"] = BreakContinueSearchType.Unlabeled | BreakContinueSearchType.Labeled] = "All"; + })(BreakContinueSearchType || (BreakContinueSearchType = {})); var keywordCompletions = []; for (var i = ts.SyntaxKind.FirstKeyword; i <= ts.SyntaxKind.LastKeyword; i++) { keywordCompletions.push({ @@ -31541,6 +32439,7 @@ var ts; var documentRegistry = documentRegistry; var cancellationToken = new CancellationTokenObject(host.getCancellationToken()); var activeCompletionSession; + var writer = undefined; if (!TypeScript.LocalizedDiagnosticMessages) { TypeScript.LocalizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); } @@ -31561,13 +32460,13 @@ var ts; useCaseSensitiveFileNames: function () { return useCaseSensitivefilenames; }, getNewLine: function () { return "\r\n"; }, getDefaultLibFilename: function () { - throw Error("TOD:: getDefaultLibfilename"); + return host.getDefaultLibFilename(); }, writeFile: function (filename, data, writeByteOrderMark) { - throw Error("TODO: write file"); + writer(filename, data, writeByteOrderMark); }, getCurrentDirectory: function () { - throw Error("TODO: getCurrentDirectory"); + return host.getCurrentDirectory(); } }; } @@ -31657,7 +32556,18 @@ var ts; function getSemanticDiagnostics(filename) { synchronizeHostData(); filename = TypeScript.switchToForwardSlashes(filename); - return getFullTypeCheckChecker().getDiagnostics(getSourceFile(filename)); + var compilerOptions = program.getCompilerOptions(); + var checker = getFullTypeCheckChecker(); + var targetSourceFile = getSourceFile(filename); + var allDiagnostics = checker.getDiagnostics(targetSourceFile); + if (compilerOptions.declaration) { + var savedWriter = writer; + writer = function (filename, data, writeByteOrderMark) { + }; + allDiagnostics = allDiagnostics.concat(checker.emitFiles(targetSourceFile).errors); + writer = savedWriter; + } + return allDiagnostics; } function getCompilerOptionsDiagnostics() { synchronizeHostData(); @@ -31665,11 +32575,15 @@ var ts; } function getValidCompletionEntryDisplayName(displayName, target) { if (displayName && displayName.length > 0) { - var firstChar = displayName.charCodeAt(0); - if (firstChar === 39 /* singleQuote */ || firstChar === 34 /* doubleQuote */) { - displayName = TypeScript.stripStartAndEndQuotes(displayName); + var firstCharCode = displayName.charCodeAt(0); + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) { + displayName = displayName.substring(1, displayName.length - 1); } - if (TypeScript.Scanner.isValidIdentifier(TypeScript.SimpleText.fromString(displayName), target)) { + var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); + for (var i = 1, n = displayName.length; isValid && i < n; i++) { + isValid = ts.isIdentifierPart(displayName.charCodeAt(i), target); + } + if (isValid) { return displayName; } } @@ -31681,7 +32595,6 @@ var ts; return undefined; } var declarations = symbol.getDeclarations(); - var firstDeclaration = [0]; return { name: displayName, kind: getSymbolKind(symbol), @@ -31692,7 +32605,7 @@ var ts; function getCompletionEntriesFromSymbols(symbols, session) { ts.forEach(symbols, function (symbol) { var entry = createCompletionEntry(symbol); - if (entry) { + if (entry && !ts.lookUp(session.symbols, entry.name)) { session.entries.push(entry); session.symbols[entry.name] = symbol; } @@ -31714,7 +32627,7 @@ var ts; if (parent && parent.kind() === 2 /* SeparatedList */) { parent = parent.parent; } - if (parent && parent.kind() === 215 /* ObjectLiteralExpression */) { + if (parent && parent.kind() === 216 /* ObjectLiteralExpression */) { return parent; } break; @@ -31728,16 +32641,16 @@ var ts; var containingNodeKind = TypeScript.Syntax.containingNode(positionedToken) && TypeScript.Syntax.containingNode(positionedToken).kind(); switch (positionedToken.kind()) { case 79 /* CommaToken */: - return containingNodeKind === 227 /* ParameterList */ || containingNodeKind === 224 /* VariableDeclaration */ || containingNodeKind === 132 /* EnumDeclaration */; + return containingNodeKind === 228 /* ParameterList */ || containingNodeKind === 225 /* VariableDeclaration */ || containingNodeKind === 133 /* EnumDeclaration */; case 72 /* OpenParenToken */: - return containingNodeKind === 227 /* ParameterList */ || containingNodeKind === 236 /* CatchClause */; + return containingNodeKind === 228 /* ParameterList */ || containingNodeKind === 237 /* CatchClause */; case 70 /* OpenBraceToken */: - return containingNodeKind === 132 /* EnumDeclaration */; + return containingNodeKind === 133 /* EnumDeclaration */; case 57 /* PublicKeyword */: case 55 /* PrivateKeyword */: case 58 /* StaticKeyword */: case 77 /* DotDotDotToken */: - return containingNodeKind === 242 /* Parameter */; + return containingNodeKind === 243 /* Parameter */; case 44 /* ClassKeyword */: case 65 /* ModuleKeyword */: case 46 /* EnumKeyword */: @@ -31782,6 +32695,39 @@ var ts; } return false; } + function isPunctuation(kind) { + return (ts.SyntaxKind.FirstPunctuation <= kind && kind <= ts.SyntaxKind.LastPunctuation); + } + function isVisibleWithinClassDeclaration(symbol, containingClass) { + var declaration = symbol.declarations && symbol.declarations[0]; + if (declaration && (declaration.flags & 32 /* Private */)) { + var declarationClass = ts.getAncestor(declaration, 174 /* ClassDeclaration */); + return containingClass === declarationClass; + } + return true; + } + function filterContextualMembersList(contextualMemberSymbols, existingMembers) { + if (!existingMembers || existingMembers.length === 0) { + return contextualMemberSymbols; + } + var existingMemberNames = {}; + ts.forEach(existingMembers, function (m) { + if (m.kind !== 134 /* PropertyAssignment */) { + return; + } + if (m.getStart() <= position && position <= m.getEnd()) { + return; + } + existingMemberNames[m.name.text] = true; + }); + var filteredMembers = []; + ts.forEach(contextualMemberSymbols, function (s) { + if (!existingMemberNames[s.name]) { + filteredMembers.push(s); + } + }); + return filteredMembers; + } synchronizeHostData(); filename = TypeScript.switchToForwardSlashes(filename); var sourceFile = getSourceFile(filename); @@ -31795,7 +32741,7 @@ var ts; node = node.parent; } var isRightOfDot = false; - if (node && node.kind() === 212 /* MemberAccessExpression */ && TypeScript.end(node.expression) < position) { + if (node && node.kind() === 213 /* MemberAccessExpression */ && TypeScript.end(node.expression) < position) { isRightOfDot = true; node = node.expression; } @@ -31803,7 +32749,7 @@ var ts; isRightOfDot = true; node = node.left; } - else if (node && node.parent && node.kind() === 11 /* IdentifierName */ && node.parent.kind() === 212 /* MemberAccessExpression */ && node.parent.name === node) { + else if (node && node.parent && node.kind() === 11 /* IdentifierName */ && node.parent.kind() === 213 /* MemberAccessExpression */ && node.parent.name === node) { isRightOfDot = true; node = node.parent.expression; } @@ -31812,6 +32758,9 @@ var ts; node = node.parent.left; } var mappedNode = getNodeAtPosition(sourceFile, TypeScript.end(node) - 1); + if (isPunctuation(mappedNode.kind)) { + mappedNode = mappedNode.parent; + } ts.Debug.assert(mappedNode, "Could not map a Fidelity node to an AST node"); activeCompletionSession = { filename: filename, @@ -31822,26 +32771,45 @@ var ts; typeChecker: typeInfoResolver }; if (isRightOfDot) { - var type = typeInfoResolver.getApparentType(typeInfoResolver.getTypeOfNode(mappedNode)); - if (!type) { - return undefined; - } - var symbols = type.getApparentProperties(); + var symbols = []; + var containingClass = ts.getAncestor(mappedNode, 174 /* ClassDeclaration */); isMemberCompletion = true; + if (mappedNode.kind === 59 /* Identifier */ || mappedNode.kind === 116 /* QualifiedName */ || mappedNode.kind === 135 /* PropertyAccess */) { + var symbol = typeInfoResolver.getSymbolInfo(mappedNode); + if (symbol && symbol.flags & ts.SymbolFlags.HasExports) { + ts.forEachValue(symbol.exports, function (symbol) { + if (isVisibleWithinClassDeclaration(symbol, containingClass)) { + symbols.push(symbol); + } + }); + } + } + var type = typeInfoResolver.getTypeOfNode(mappedNode); + var apparentType = type && typeInfoResolver.getApparentType(type); + if (apparentType) { + ts.forEach(apparentType.getApparentProperties(), function (symbol) { + if (isVisibleWithinClassDeclaration(symbol, containingClass)) { + symbols.push(symbol); + } + }); + } getCompletionEntriesFromSymbols(symbols, activeCompletionSession); } else { var containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(sourceFile.getSyntaxTree().sourceUnit(), position); if (containingObjectLiteral) { - var searchPosition = Math.min(position, TypeScript.end(containingObjectLiteral)); - var path = TypeScript.ASTHelpers.getAstAtPosition(sourceUnit, searchPosition); - while (node && node.kind() !== 215 /* ObjectLiteralExpression */) { - node = node.parent; - } - if (!node || node.kind() !== 215 /* ObjectLiteralExpression */) { - return null; - } + var objectLiteral = (mappedNode.kind === 133 /* ObjectLiteral */ ? mappedNode : ts.getAncestor(mappedNode, 133 /* ObjectLiteral */)); + ts.Debug.assert(objectLiteral); isMemberCompletion = true; + var contextualType = typeInfoResolver.getContextualType(objectLiteral); + if (!contextualType) { + return undefined; + } + var contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType); + if (contextualTypeMembers && contextualTypeMembers.length > 0) { + var filteredMembers = filterContextualMembersList(contextualTypeMembers, objectLiteral.properties); + getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); + } } else { isMemberCompletion = false; @@ -31898,8 +32866,18 @@ var ts; current = child; continue outer; } - if (child.end > position) { - break; + } + return current; + } + } + function getTokenAtPosition(sourceFile, position) { + var current = sourceFile; + outer: while (true) { + for (var i = 0, n = current.getChildCount(); i < n; i++) { + var child = current.getChildAt(i); + if (child.getFullStart() <= position && position < child.getEnd()) { + current = child; + continue outer; } } return current; @@ -31912,22 +32890,22 @@ var ts; return node; } switch (node.kind) { - case 177 /* SourceFile */: - case 116 /* Method */: - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 169 /* ClassDeclaration */: - case 170 /* InterfaceDeclaration */: - case 171 /* EnumDeclaration */: - case 172 /* ModuleDeclaration */: + case 182 /* SourceFile */: + case 120 /* Method */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 174 /* ClassDeclaration */: + case 175 /* InterfaceDeclaration */: + case 176 /* EnumDeclaration */: + case 177 /* ModuleDeclaration */: return node; } } } function getSymbolKind(symbol) { - var flags = symbol.getFlags(); + var flags = typeInfoResolver.getRootSymbol(symbol).getFlags(); if (flags & ts.SymbolFlags.Module) return ScriptElementKind.moduleElement; if (flags & 16 /* Class */) @@ -31978,6 +32956,45 @@ var ts; return ScriptElementKind.primitiveType; return ScriptElementKind.unknown; } + function getNodeKind(node) { + switch (node.kind) { + case 177 /* ModuleDeclaration */: + return ScriptElementKind.moduleElement; + case 174 /* ClassDeclaration */: + return ScriptElementKind.classElement; + case 175 /* InterfaceDeclaration */: + return ScriptElementKind.interfaceElement; + case 176 /* EnumDeclaration */: + return ScriptElementKind.enumElement; + case 171 /* VariableDeclaration */: + return ScriptElementKind.variableElement; + case 172 /* FunctionDeclaration */: + return ScriptElementKind.functionElement; + case 122 /* GetAccessor */: + return ScriptElementKind.memberGetAccessorElement; + case 123 /* SetAccessor */: + return ScriptElementKind.memberSetAccessorElement; + case 120 /* Method */: + return ScriptElementKind.memberFunctionElement; + case 119 /* Property */: + return ScriptElementKind.memberVariableElement; + case 126 /* IndexSignature */: + return ScriptElementKind.indexSignatureElement; + case 125 /* ConstructSignature */: + return ScriptElementKind.constructSignatureElement; + case 124 /* CallSignature */: + return ScriptElementKind.callSignatureElement; + case 121 /* Constructor */: + return ScriptElementKind.constructorImplementationElement; + case 117 /* TypeParameter */: + return ScriptElementKind.typeParameterElement; + case 181 /* EnumMember */: + return ScriptElementKind.variableElement; + case 118 /* Parameter */: + return (node.flags & ts.NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + return ScriptElementKind.unknown; + } + } function getNodeModifiers(node) { var flags = node.flags; var result = []; @@ -31985,7 +33002,7 @@ var ts; result.push(ScriptElementKindModifier.privateMemberModifier); if (flags & 16 /* Public */) result.push(ScriptElementKindModifier.publicMemberModifier); - if (flags & 64 /* Static */) + if (flags & 128 /* Static */) result.push(ScriptElementKindModifier.staticModifier); if (flags & 1 /* Export */) result.push(ScriptElementKindModifier.exportedModifier); @@ -32016,7 +33033,7 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 117 /* Constructor */) || (!selectConstructors && (d.kind === 167 /* FunctionDeclaration */ || d.kind === 116 /* Method */))) { + if ((selectConstructors && d.kind === 121 /* Constructor */) || (!selectConstructors && (d.kind === 172 /* FunctionDeclaration */ || d.kind === 120 /* Method */))) { declarations.push(d); if (d.body) definition = d; @@ -32033,10 +33050,10 @@ var ts; return false; } function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { - if (isNewExpressionTarget(location) || location.kind === 103 /* ConstructorKeyword */) { + if (isNewExpressionTarget(location) || location.kind === 107 /* ConstructorKeyword */) { if (symbol.flags & 16 /* Class */) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 169 /* ClassDeclaration */); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 174 /* ClassDeclaration */); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -32094,94 +33111,229 @@ var ts; if (!node) { return undefined; } - if (node.kind === 55 /* Identifier */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind === 59 /* Identifier */ || node.kind === 87 /* ThisKeyword */ || node.kind === 85 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { return getReferencesForNode(node, [sourceFile]); } switch (node.kind) { - case 86 /* TryKeyword */: - case 58 /* CatchKeyword */: - case 71 /* FinallyKeyword */: - if (hasKind(parent(parent(node)), 161 /* TryStatement */)) { + case 78 /* IfKeyword */: + case 70 /* ElseKeyword */: + if (hasKind(node.parent, 152 /* IfStatement */)) { + return getIfElseOccurrences(node.parent); + } + break; + case 84 /* ReturnKeyword */: + if (hasKind(node.parent, 159 /* ReturnStatement */)) { + return getReturnOccurrences(node.parent); + } + break; + case 90 /* TryKeyword */: + case 62 /* CatchKeyword */: + case 75 /* FinallyKeyword */: + if (hasKind(parent(parent(node)), 166 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; - case 82 /* SwitchKeyword */: - if (hasKind(node.parent, 156 /* SwitchStatement */)) { + case 86 /* SwitchKeyword */: + if (hasKind(node.parent, 161 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; - case 57 /* CaseKeyword */: - case 63 /* DefaultKeyword */: - if (hasKind(parent(parent(node)), 156 /* SwitchStatement */)) { + case 61 /* CaseKeyword */: + case 67 /* DefaultKeyword */: + if (hasKind(parent(parent(node)), 161 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent); } break; - case 56 /* BreakKeyword */: - if (hasKind(node.parent, 153 /* BreakStatement */)) { - return getBreakStatementOccurences(node.parent); + case 60 /* BreakKeyword */: + case 65 /* ContinueKeyword */: + if (hasKind(node.parent, 158 /* BreakStatement */) || hasKind(node.parent, 157 /* ContinueStatement */)) { + return getBreakOrContinueStatementOccurences(node.parent); + } + break; + case 76 /* ForKeyword */: + if (hasKind(node.parent, 155 /* ForStatement */) || hasKind(node.parent, 156 /* ForInStatement */)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case 94 /* WhileKeyword */: + case 69 /* DoKeyword */: + if (hasKind(node.parent, 154 /* WhileStatement */) || hasKind(node.parent, 153 /* DoStatement */)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case 107 /* ConstructorKeyword */: + if (hasKind(node.parent, 121 /* Constructor */)) { + return getConstructorOccurrences(node.parent); } break; } return undefined; + function getIfElseOccurrences(ifStatement) { + var keywords = []; + while (hasKind(ifStatement.parent, 152 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 78 /* IfKeyword */); + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 70 /* ElseKeyword */)) { + break; + } + } + if (!hasKind(ifStatement.elseStatement, 152 /* IfStatement */)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 70 /* ElseKeyword */ && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; + var shouldHighlightNextKeyword = true; + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpace(sourceFile.text.charCodeAt(j))) { + shouldHighlightNextKeyword = false; + break; + } + } + if (shouldHighlightNextKeyword) { + result.push(new ReferenceEntry(filename, TypeScript.TextSpan.fromBounds(elseKeyword.getStart(), ifKeyword.end), false)); + i++; + continue; + } + } + result.push(getReferenceEntryFromNode(keywords[i])); + } + return result; + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + if (!(func && hasKind(func.body, 173 /* FunctionBlock */))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 84 /* ReturnKeyword */); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } function getTryCatchFinallyOccurrences(tryStatement) { var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 86 /* TryKeyword */); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 90 /* TryKeyword */); if (tryStatement.catchBlock) { - pushKeywordIf(keywords, tryStatement.catchBlock.getFirstToken(), 58 /* CatchKeyword */); + pushKeywordIf(keywords, tryStatement.catchBlock.getFirstToken(), 62 /* CatchKeyword */); } if (tryStatement.finallyBlock) { - pushKeywordIf(keywords, tryStatement.finallyBlock.getFirstToken(), 71 /* FinallyKeyword */); + pushKeywordIf(keywords, tryStatement.finallyBlock.getFirstToken(), 75 /* FinallyKeyword */); } - return keywordsToReferenceEntries(keywords); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 76 /* ForKeyword */, 94 /* WhileKeyword */, 69 /* DoKeyword */)) { + if (loopNode.kind === 153 /* DoStatement */) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 94 /* WhileKeyword */)) { + break; + } + } + } + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 60 /* BreakKeyword */, 65 /* ContinueKeyword */); + } + }); + return ts.map(keywords, getReferenceEntryFromNode); } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 82 /* SwitchKeyword */); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 86 /* SwitchKeyword */); + var breakSearchType = BreakContinueSearchType.All; ts.forEach(switchStatement.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 57 /* CaseKeyword */, 63 /* DefaultKeyword */); - ts.forEachChild(clause, function aggregateBreakKeywords(node) { - switch (node.kind) { - case 153 /* BreakStatement */: - if (!node.label) { - pushKeywordIf(keywords, node.getFirstToken(), 56 /* BreakKeyword */); - } - case 150 /* ForStatement */: - case 151 /* ForInStatement */: - case 148 /* DoStatement */: - case 149 /* WhileStatement */: - case 156 /* SwitchStatement */: - return; - } - if (!isAnyFunction(node)) { - ts.forEachChild(node, aggregateBreakKeywords); + pushKeywordIf(keywords, clause.getFirstToken(), 61 /* CaseKeyword */, 67 /* DefaultKeyword */); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 60 /* BreakKeyword */); } }); }); - return keywordsToReferenceEntries(keywords); + return ts.map(keywords, getReferenceEntryFromNode); } - function getBreakStatementOccurences(breakStatement) { - if (breakStatement.label) { - return undefined; - } - for (var owner = node.parent; owner; owner = owner.parent) { + function getBreakOrContinueStatementOccurences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { switch (owner.kind) { - case 150 /* ForStatement */: - case 151 /* ForInStatement */: - case 148 /* DoStatement */: - case 149 /* WhileStatement */: - return undefined; - case 156 /* SwitchStatement */: + case 155 /* ForStatement */: + case 156 /* ForInStatement */: + case 153 /* DoStatement */: + case 154 /* WhileStatement */: + return getLoopBreakContinueOccurrences(owner); + case 161 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); - default: - if (isAnyFunction(owner)) { - return undefined; - } } } return undefined; } + function aggregateAllBreakAndContinueStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 158 /* BreakStatement */ || node.kind === 157 /* ContinueStatement */) { + statementAccumulator.push(node); + } + else if (!ts.isAnyFunction(node)) { + ts.forEachChild(node, aggregate); + } + } + ; + } + function ownsBreakOrContinueStatement(owner, statement) { + var actualOwner = getBreakOrContinueOwner(statement); + return actualOwner && actualOwner === owner; + } + function getBreakOrContinueOwner(statement) { + for (var node = statement.parent; node; node = node.parent) { + switch (node.kind) { + case 161 /* SwitchStatement */: + if (statement.kind === 157 /* ContinueStatement */) { + continue; + } + case 155 /* ForStatement */: + case 156 /* ForInStatement */: + case 154 /* WhileStatement */: + case 153 /* DoStatement */: + if (!statement.label || isLabeledBy(node, statement.label.text)) { + return node; + } + break; + default: + if (ts.isAnyFunction(node)) { + return undefined; + } + break; + } + } + return undefined; + } + function getConstructorOccurrences(constructorDeclaration) { + var declarations = constructorDeclaration.symbol.getDeclarations(); + var keywords = []; + ts.forEach(declarations, function (declaration) { + ts.forEach(declaration.getChildren(), function (token) { + return pushKeywordIf(keywords, token, 107 /* ConstructorKeyword */); + }); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } function hasKind(node, kind) { - return !!(node && node.kind === kind); + return node !== undefined && node.kind === kind; } function parent(node) { return node && node.parent; @@ -32191,15 +33343,11 @@ var ts; for (var _i = 2; _i < arguments.length; _i++) { expected[_i - 2] = arguments[_i]; } - if (!token) { - return; - } - if (ts.contains(expected, token.kind)) { + if (token && ts.contains(expected, token.kind)) { keywordList.push(token); + return true; } - } - function keywordsToReferenceEntries(keywords) { - return ts.map(keywords, function (keyword) { return new ReferenceEntry(filename, TypeScript.TextSpan.fromBounds(keyword.getStart(), keyword.end), false); }); + return false; } } function getReferencesAtPosition(filename, position) { @@ -32210,7 +33358,7 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 55 /* Identifier */ && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind !== 59 /* Identifier */ && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } return getReferencesForNode(node, program.getSourceFiles()); @@ -32219,15 +33367,21 @@ var ts; if (isLabelName(node)) { if (isJumpStatementTarget(node)) { var labelDefinition = getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntry(node)]; + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; } else { return getLabelReferencesInNode(node.parent, node); } } + if (node.kind === 87 /* ThisKeyword */) { + return getReferencesForThisKeyword(node, sourceFiles); + } + if (node.kind === 85 /* SuperKeyword */) { + return getReferencesForSuperKeyword(node); + } var symbol = typeInfoResolver.getSymbolInfo(node); if (!symbol) { - return [getReferenceEntry(node)]; + return [getReferenceEntryFromNode(node)]; } if (!symbol.getDeclarations()) { return undefined; @@ -32251,7 +33405,7 @@ var ts; } return result; function getNormalizedSymbolName(symbol) { - var functionExpression = ts.getDeclarationOfKind(symbol, 136 /* FunctionExpression */); + var functionExpression = ts.getDeclarationOfKind(symbol, 141 /* FunctionExpression */); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -32282,7 +33436,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 177 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 182 /* SourceFile */ && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -32322,7 +33476,7 @@ var ts; return; } if (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { - result.push(getReferenceEntry(node)); + result.push(getReferenceEntryFromNode(node)); } }); return result; @@ -32330,14 +33484,14 @@ var ts; function isValidReferencePosition(node, searchSymbolName) { if (node) { switch (node.kind) { - case 55 /* Identifier */: + case 59 /* Identifier */: return node.getWidth() === searchSymbolName.length; - case 3 /* StringLiteral */: + case 7 /* StringLiteral */: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { return node.getWidth() === searchSymbolName.length + 2; } break; - case 2 /* NumericLiteral */: + case 6 /* NumericLiteral */: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { return node.getWidth() === searchSymbolName.length; } @@ -32365,7 +33519,105 @@ var ts; return; } if (isRelatableToSearchSet(searchSymbols, referenceSymbol, referenceLocation)) { - result.push(getReferenceEntry(referenceLocation)); + result.push(getReferenceEntryFromNode(referenceLocation)); + } + }); + } + } + function getReferencesForSuperKeyword(superKeyword) { + var searchSpaceNode = ts.getSuperContainer(superKeyword); + if (!searchSpaceNode) { + return undefined; + } + var staticFlag = 128 /* Static */; + switch (searchSpaceNode.kind) { + case 119 /* Property */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + staticFlag &= searchSpaceNode.flags; + searchSpaceNode = searchSpaceNode.parent; + break; + default: + return undefined; + } + var result = []; + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = getNodeAtPosition(sourceFile, position); + if (!node || node.kind !== 85 /* SuperKeyword */) { + return; + } + var container = ts.getSuperContainer(node); + if (container && (128 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + }); + return result; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); + var staticFlag = 128 /* Static */; + switch (searchSpaceNode.kind) { + case 119 /* Property */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + staticFlag &= searchSpaceNode.flags; + searchSpaceNode = searchSpaceNode.parent; + break; + case 182 /* SourceFile */: + if (ts.isExternalModule(searchSpaceNode)) { + return undefined; + } + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + break; + default: + return undefined; + } + var result = []; + if (searchSpaceNode.kind === 182 /* SourceFile */) { + ts.forEach(sourceFiles, function (sourceFile) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); + }); + } + else { + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result); + } + return result; + function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = getNodeAtPosition(sourceFile, position); + if (!node || node.kind !== 87 /* ThisKeyword */) { + return; + } + var container = ts.getThisContainer(node, false); + switch (searchSpaceNode.kind) { + case 141 /* FunctionExpression */: + case 172 /* FunctionDeclaration */: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 174 /* ClassDeclaration */: + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 182 /* SourceFile */: + if (container.kind === 182 /* SourceFile */ && !ts.isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } + break; } }); } @@ -32389,11 +33641,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol.flags & (16 /* Class */ | 32 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 169 /* ClassDeclaration */) { + if (declaration.kind === 174 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(declaration.baseType); ts.forEach(declaration.implementedTypes, getPropertySymbolFromTypeReference); } - else if (declaration.kind === 170 /* InterfaceDeclaration */) { + else if (declaration.kind === 175 /* InterfaceDeclaration */) { ts.forEach(declaration.baseTypes, getPropertySymbolFromTypeReference); } }); @@ -32439,40 +33691,31 @@ var ts; } return undefined; } - function getReferenceEntry(node) { - var start = node.getStart(); - var end = node.getEnd(); - if (node.kind === 3 /* StringLiteral */) { - start += 1; - end -= 1; - } - return new ReferenceEntry(node.getSourceFile().filename, TypeScript.TextSpan.fromBounds(start, end), isWriteAccess(node)); - } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 114 /* Parameter */: - case 166 /* VariableDeclaration */: - case 115 /* Property */: - case 129 /* PropertyAssignment */: - case 176 /* EnumMember */: - case 116 /* Method */: - case 117 /* Constructor */: - case 118 /* GetAccessor */: - case 119 /* SetAccessor */: - case 167 /* FunctionDeclaration */: - case 136 /* FunctionExpression */: - case 137 /* ArrowFunction */: - case 163 /* CatchBlock */: + case 118 /* Parameter */: + case 171 /* VariableDeclaration */: + case 119 /* Property */: + case 134 /* PropertyAssignment */: + case 181 /* EnumMember */: + case 120 /* Method */: + case 121 /* Constructor */: + case 122 /* GetAccessor */: + case 123 /* SetAccessor */: + case 172 /* FunctionDeclaration */: + case 141 /* FunctionExpression */: + case 142 /* ArrowFunction */: + case 168 /* CatchBlock */: return 1 /* Value */; - case 113 /* TypeParameter */: - case 170 /* InterfaceDeclaration */: - case 125 /* TypeLiteral */: + case 117 /* TypeParameter */: + case 175 /* InterfaceDeclaration */: + case 129 /* TypeLiteral */: return 2 /* Type */; - case 169 /* ClassDeclaration */: - case 171 /* EnumDeclaration */: + case 174 /* ClassDeclaration */: + case 176 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 172 /* ModuleDeclaration */: - if (node.name.kind === 3 /* StringLiteral */) { + case 177 /* ModuleDeclaration */: + if (node.name.kind === 7 /* StringLiteral */) { return 4 /* Namespace */ | 1 /* Value */; } else if (ts.isInstantiated(node)) { @@ -32482,41 +33725,41 @@ var ts; return 4 /* Namespace */; } break; - case 174 /* ImportDeclaration */: + case 179 /* ImportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } - ts.Debug.fail("Unkown declaration type"); + ts.Debug.fail("Unknown declaration type"); } function isTypeReference(node) { - if (node.parent.kind === 112 /* QualifiedName */ && node.parent.right === node) + if (node.parent.kind === 116 /* QualifiedName */ && node.parent.right === node) node = node.parent; - return node.parent.kind === 123 /* TypeReference */; + return node.parent.kind === 127 /* TypeReference */; } function isNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 112 /* QualifiedName */) { - while (root.parent && root.parent.kind === 112 /* QualifiedName */) + if (root.parent.kind === 116 /* QualifiedName */) { + while (root.parent && root.parent.kind === 116 /* QualifiedName */) root = root.parent; isLastClause = root.right === node; } - return root.parent.kind === 123 /* TypeReference */ && !isLastClause; + return root.parent.kind === 127 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 112 /* QualifiedName */) { + while (node.parent.kind === 116 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 174 /* ImportDeclaration */ && node.parent.entityName === node; + return node.parent.kind === 179 /* ImportDeclaration */ && node.parent.entityName === node; } function getMeaningFromRightHandSideOfImport(node) { - ts.Debug.assert(node.kind === 55 /* Identifier */); - if (node.parent.kind === 112 /* QualifiedName */ && node.parent.right === node && node.parent.parent.kind === 174 /* ImportDeclaration */) { + ts.Debug.assert(node.kind === 59 /* Identifier */); + if (node.parent.kind === 116 /* QualifiedName */ && node.parent.right === node && node.parent.parent.kind === 179 /* ImportDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 175 /* ExportAssignment */) { + if (node.parent.kind === 180 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -32549,36 +33792,136 @@ var ts; } return meaning; } - function isWriteAccess(node) { - if (node.kind === 55 /* Identifier */ && ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + } + function getReferenceEntryFromNode(node) { + var start = node.getStart(); + var end = node.getEnd(); + if (node.kind === 7 /* StringLiteral */) { + start += 1; + end -= 1; + } + return new ReferenceEntry(node.getSourceFile().filename, TypeScript.TextSpan.fromBounds(start, end), isWriteAccess(node)); + } + function isWriteAccess(node) { + if (node.kind === 59 /* Identifier */ && ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return true; + } + var parent = node.parent; + if (parent) { + if (parent.kind === 144 /* PostfixOperator */ || parent.kind === 143 /* PrefixOperator */) { return true; } - var parent = node.parent; - if (parent) { - if (parent.kind === 139 /* PostfixOperator */ || parent.kind === 138 /* PrefixOperator */) { - return true; - } - else if (parent.kind === 140 /* BinaryExpression */ && parent.left === node) { - var operator = parent.operator; - switch (operator) { - case 46 /* AsteriskEqualsToken */: - case 47 /* SlashEqualsToken */: - case 48 /* PercentEqualsToken */: - case 45 /* MinusEqualsToken */: - case 49 /* LessThanLessThanEqualsToken */: - case 50 /* GreaterThanGreaterThanEqualsToken */: - case 51 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 53 /* BarEqualsToken */: - case 54 /* CaretEqualsToken */: - case 52 /* AmpersandEqualsToken */: - case 44 /* PlusEqualsToken */: - case 43 /* EqualsToken */: - return true; - } - } - return false; + else if (parent.kind === 145 /* BinaryExpression */ && parent.left === node) { + var operator = parent.operator; + return ts.SyntaxKind.FirstAssignment <= operator && operator <= ts.SyntaxKind.LastAssignment; } } + return false; + } + function getNavigateToItems(searchValue) { + synchronizeHostData(); + var terms = searchValue.split(" "); + var searchTerms = ts.map(terms, function (t) { return ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }); }); + var items = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); + var filename = sourceFile.filename; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + var name = declaration.name.text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== 0 /* none */) { + var container = getContainerNode(declaration); + items.push({ + name: name, + kind: getNodeKind(declaration), + kindModifiers: getNodeModifiers(declaration), + matchKind: MatchKind[matchKind], + fileName: filename, + textSpan: TypeScript.TextSpan.fromBounds(declaration.getStart(), declaration.getEnd()), + containerName: container.name ? container.name.text : "", + containerKind: container.name ? getNodeKind(container) : "" + }); + } + } + }); + return items; + function hasAnyUpperCaseCharacter(s) { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((65 /* A */ <= c && c <= 90 /* Z */) || (c >= 127 /* maxAsciiCharacter */ && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + return false; + } + function getMatchKind(searchTerms, name) { + var matchKind = 0 /* none */; + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + return 0 /* none */; + } + var termKind = 2 /* substring */; + if (index === 0) { + termKind = name.length === searchTerm.term.length ? 1 /* exact */ : 3 /* prefix */; + } + if (matchKind === 0 /* none */ || termKind < matchKind) { + matchKind = termKind; + } + } + } + return matchKind; + } + } + function containErrors(diagnostics) { + return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1 /* Error */; }); + } + function getEmitOutput(filename) { + synchronizeHostData(); + filename = TypeScript.switchToForwardSlashes(filename); + var compilerOptions = program.getCompilerOptions(); + var targetSourceFile = program.getSourceFile(filename); + var emitToSingleFile = ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions); + var emitDeclaration = compilerOptions.declaration; + var emitOutput = { + outputFiles: [], + emitOutputStatus: undefined + }; + function getEmitOutputWriter(filename, data, writeByteOrderMark) { + emitOutput.outputFiles.push({ + name: filename, + writeByteOrderMark: writeByteOrderMark, + text: data + }); + } + writer = getEmitOutputWriter; + var syntacticDiagnostics = []; + var containSyntacticErrors = false; + if (emitToSingleFile) { + containSyntacticErrors = containErrors(program.getDiagnostics(targetSourceFile)); + } + else { + containSyntacticErrors = ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (!ts.isExternalModuleOrDeclarationFile(sourceFile)) { + return containErrors(program.getDiagnostics(sourceFile)); + } + return false; + }); + } + if (containSyntacticErrors) { + emitOutput.emitOutputStatus = 1 /* AllOutputGenerationSkipped */; + writer = undefined; + return emitOutput; + } + var emitFilesResult = emitToSingleFile ? getFullTypeCheckChecker().emitFiles(targetSourceFile) : getFullTypeCheckChecker().emitFiles(); + emitOutput.emitOutputStatus = emitFilesResult.emitResultStatus; + writer = undefined; + return emitOutput; } function getSyntaxTree(filename) { filename = TypeScript.switchToForwardSlashes(filename); @@ -32596,13 +33939,13 @@ var ts; if (ast === null) { return null; } - if (ast.kind() === 227 /* ParameterList */ && ast.parent.kind() === 142 /* CallSignature */ && ast.parent.parent.kind() === 137 /* ConstructorDeclaration */) { + if (ast.kind() === 228 /* ParameterList */ && ast.parent.kind() === 143 /* CallSignature */ && ast.parent.parent.kind() === 138 /* ConstructorDeclaration */) { ast = ast.parent.parent; } switch (ast.kind()) { default: return null; - case 137 /* ConstructorDeclaration */: + case 138 /* ConstructorDeclaration */: var constructorAST = ast; if (!isConstructorValidPosition || !(position >= TypeScript.start(constructorAST) && position <= TypeScript.start(constructorAST) + "constructor".length)) { return null; @@ -32610,9 +33953,9 @@ var ts; else { return ast; } - case 129 /* FunctionDeclaration */: + case 130 /* FunctionDeclaration */: return null; - case 212 /* MemberAccessExpression */: + case 213 /* MemberAccessExpression */: case 121 /* QualifiedName */: case 50 /* SuperKeyword */: case 14 /* StringLiteral */: @@ -32645,6 +33988,161 @@ var ts; var syntaxTree = getSyntaxTree(filename); return new TypeScript.Services.NavigationBarItemGetter().getItems(syntaxTree.sourceUnit()); } + function getSemanticClassifications(fileName, span) { + synchronizeHostData(); + fileName = TypeScript.switchToForwardSlashes(fileName); + var sourceFile = getSourceFile(fileName); + var result = []; + processNode(sourceFile); + return result; + function classifySymbol(symbol) { + var flags = symbol.getFlags(); + if (flags & 16 /* Class */) { + return ClassificationTypeNames.className; + } + else if (flags & 64 /* Enum */) { + return ClassificationTypeNames.enumName; + } + else if (flags & 32 /* Interface */) { + return ClassificationTypeNames.interfaceName; + } + else if (flags & ts.SymbolFlags.Module) { + return ClassificationTypeNames.moduleName; + } + else if (flags & 262144 /* TypeParameter */) { + return ClassificationTypeNames.typeParameterName; + } + } + function processNode(node) { + if (node && span.intersectsWith(node.getStart(), node.getWidth())) { + if (node.kind === 59 /* Identifier */ && node.getWidth() > 0) { + var symbol = typeInfoResolver.getSymbolInfo(node); + if (symbol) { + var type = classifySymbol(symbol); + if (type) { + result.push(new ClassifiedSpan(new TypeScript.TextSpan(node.getStart(), node.getWidth()), type)); + } + } + } + ts.forEachChild(node, processNode); + } + } + } + function getSyntacticClassifications(fileName, span) { + fileName = TypeScript.switchToForwardSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + var result = []; + processElement(sourceFile.getSourceUnit()); + return result; + function classifyTrivia(trivia) { + if (trivia.isComment() && span.intersectsWith(trivia.fullStart(), trivia.fullWidth())) { + result.push(new ClassifiedSpan(new TypeScript.TextSpan(trivia.fullStart(), trivia.fullWidth()), ClassificationTypeNames.comment)); + } + } + function classifyTriviaList(trivia) { + for (var i = 0, n = trivia.count(); i < n; i++) { + classifyTrivia(trivia.syntaxTriviaAt(i)); + } + } + function classifyToken(token) { + if (token.hasLeadingComment()) { + classifyTriviaList(token.leadingTrivia()); + } + if (TypeScript.width(token) > 0) { + var type = classifyTokenType(token); + if (type) { + result.push(new ClassifiedSpan(new TypeScript.TextSpan(TypeScript.start(token), TypeScript.width(token)), type)); + } + } + if (token.hasTrailingComment()) { + classifyTriviaList(token.trailingTrivia()); + } + } + function classifyTokenType(token) { + var tokenKind = token.kind(); + if (TypeScript.SyntaxFacts.isAnyKeyword(token.kind())) { + return ClassificationTypeNames.keyword; + } + if (tokenKind === 80 /* LessThanToken */ || tokenKind === 81 /* GreaterThanToken */) { + var tokenParentKind = token.parent.kind(); + if (tokenParentKind === 229 /* TypeArgumentList */ || tokenParentKind === 230 /* TypeParameterList */) { + return ClassificationTypeNames.punctuation; + } + } + if (TypeScript.SyntaxFacts.isBinaryExpressionOperatorToken(tokenKind) || TypeScript.SyntaxFacts.isPrefixUnaryExpressionOperatorToken(tokenKind)) { + return ClassificationTypeNames.operator; + } + else if (TypeScript.SyntaxFacts.isAnyPunctuation(tokenKind)) { + return ClassificationTypeNames.punctuation; + } + else if (tokenKind === 13 /* NumericLiteral */) { + return ClassificationTypeNames.numericLiteral; + } + else if (tokenKind === 14 /* StringLiteral */) { + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === 12 /* RegularExpressionLiteral */) { + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === 11 /* IdentifierName */) { + var current = token; + var parent = token.parent; + while (parent.kind() === 121 /* QualifiedName */) { + current = parent; + parent = parent.parent; + } + switch (parent.kind()) { + case 241 /* SimplePropertyAssignment */: + if (parent.propertyName === token) { + return ClassificationTypeNames.identifier; + } + return; + case 132 /* ClassDeclaration */: + if (parent.identifier === token) { + return ClassificationTypeNames.className; + } + return; + case 239 /* TypeParameter */: + if (parent.identifier === token) { + return ClassificationTypeNames.typeParameterName; + } + return; + case 129 /* InterfaceDeclaration */: + if (parent.identifier === token) { + return ClassificationTypeNames.interfaceName; + } + return; + case 133 /* EnumDeclaration */: + if (parent.identifier === token) { + return ClassificationTypeNames.enumName; + } + return; + case 131 /* ModuleDeclaration */: + if (parent.name === current) { + return ClassificationTypeNames.moduleName; + } + return; + default: + return ClassificationTypeNames.text; + } + } + } + function processElement(element) { + if (!TypeScript.isShared(element) && span.intersectsWith(TypeScript.fullStart(element), TypeScript.fullWidth(element))) { + for (var i = 0, n = TypeScript.childCount(element); i < n; i++) { + var child = TypeScript.childAt(element, i); + if (child) { + if (TypeScript.isToken(child)) { + classifyToken(child); + } + else { + processElement(child); + } + } + } + } + } + } function getOutliningSpans(filename) { filename = TypeScript.switchToForwardSlashes(filename); var sourceFile = getCurrentSourceFile(filename); @@ -32657,12 +34155,9 @@ var ts; } function getIndentationAtPosition(filename, position, editorOptions) { filename = TypeScript.switchToForwardSlashes(filename); - var syntaxTree = getSyntaxTree(filename); - var scriptSnapshot = syntaxTreeCache.getCurrentScriptSnapshot(filename); - var scriptText = TypeScript.SimpleText.fromScriptSnapshot(scriptSnapshot); - var textSnapshot = new TypeScript.Services.Formatting.TextSnapshot(scriptText); + var sourceFile = getCurrentSourceFile(filename); var options = new TypeScript.FormattingOptions(!editorOptions.ConvertTabsToSpaces, editorOptions.TabSize, editorOptions.IndentSize, editorOptions.NewLineCharacter); - return TypeScript.Services.Formatting.SingleTokenIndenter.getIndentationAmount(position, syntaxTree.sourceUnit(), textSnapshot, options); + return ts.formatting.SmartIndenter.getIndentation(position, sourceFile, options); } function getFormattingManager(filename, options) { if (formattingRulesProvider == null) { @@ -32700,32 +34195,15 @@ var ts; } return []; } - function escapeRegExp(str) { - return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); - } - function getTodoCommentsRegExp(descriptors) { - var singleLineCommentStart = /(?:\/\/+\s*)/.source; - var multiLineCommentStart = /(?:\/\*+\s*)/.source; - var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; - var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; - var literals = "(?:" + descriptors.map(function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; - var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; - var messageRemainder = /(?:.*?)/.source; - var messagePortion = "(" + literals + messageRemainder + ")"; - var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; - return new RegExp(regExpString, "gim"); - } - function getTodoComments(fileName, descriptors) { - fileName = TypeScript.switchToForwardSlashes(fileName); - var sourceFile = getCurrentSourceFile(fileName); - var syntaxTree = sourceFile.getSyntaxTree(); + function getTodoComments(filename, descriptors) { + filename = TypeScript.switchToForwardSlashes(filename); + var sourceFile = getCurrentSourceFile(filename); cancellationToken.throwIfCancellationRequested(); - var text = syntaxTree.text; - var fileContents = text.substr(0, text.length()); + var fileContents = sourceFile.text; cancellationToken.throwIfCancellationRequested(); var result = []; if (descriptors.length > 0) { - var regExp = getTodoCommentsRegExp(descriptors); + var regExp = getTodoCommentsRegExp(); var matchArray; while (matchArray = regExp.exec(fileContents)) { cancellationToken.throwIfCancellationRequested(); @@ -32733,13 +34211,11 @@ var ts; ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex); var preamble = matchArray[1]; var matchPosition = matchArray.index + preamble.length; - var token = TypeScript.findToken(syntaxTree.sourceUnit(), matchPosition); - if (matchPosition >= TypeScript.start(token) && matchPosition < TypeScript.end(token)) { + var token = getTokenAtPosition(sourceFile, matchPosition); + if (token.getStart() <= matchPosition && matchPosition < token.getEnd()) { continue; } - var triviaList = matchPosition < TypeScript.start(token) ? token.leadingTrivia(syntaxTree.text) : token.trailingTrivia(syntaxTree.text); - var trivia = findContainingComment(triviaList, matchPosition); - if (trivia === null) { + if (!getContainingComment(ts.getTrailingComments(fileContents, token.getFullStart()), matchPosition) && !getContainingComment(ts.getLeadingComments(fileContents, token.getFullStart()), matchPosition)) { continue; } var descriptor = undefined; @@ -32757,19 +34233,51 @@ var ts; } } return result; + function escapeRegExp(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + function getTodoCommentsRegExp() { + var singleLineCommentStart = /(?:\/\/+\s*)/.source; + var multiLineCommentStart = /(?:\/\*+\s*)/.source; + var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; + var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; + var messageRemainder = /(?:.*?)/.source; + var messagePortion = "(" + literals + messageRemainder + ")"; + var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + return new RegExp(regExpString, "gim"); + } + function getContainingComment(comments, position) { + if (comments) { + for (var i = 0, n = comments.length; i < n; i++) { + var comment = comments[i]; + if (comment.pos <= position && position < comment.end) { + return comment; + } + } + } + return undefined; + } + function isLetterOrDigit(char) { + return (char >= 97 /* a */ && char <= 122 /* z */) || (char >= 65 /* A */ && char <= 90 /* Z */) || (char >= 48 /* _0 */ && char <= 57 /* _9 */); + } } - function isLetterOrDigit(char) { - return (char >= 97 /* a */ && char <= 122 /* z */) || (char >= 65 /* A */ && char <= 90 /* Z */) || (char >= 48 /* _0 */ && char <= 57 /* _9 */); - } - function findContainingComment(triviaList, position) { - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - var fullEnd = trivia.fullStart() + trivia.fullWidth(); - if (trivia.isComment() && trivia.fullStart() <= position && position < fullEnd) { - return trivia; + function getRenameInfo(fileName, position) { + synchronizeHostData(); + fileName = TypeScript.switchToForwardSlashes(fileName); + var sourceFile = getSourceFile(fileName); + var node = getNodeAtPosition(sourceFile, position); + if (node && node.kind === 59 /* Identifier */) { + var symbol = typeInfoResolver.getSymbolInfo(node); + if (symbol && symbol.getDeclarations() && symbol.getDeclarations().length > 0) { + var kind = getSymbolKind(symbol); + if (kind) { + return RenameInfo.Create(symbol.name, typeInfoResolver.getFullyQualifiedName(symbol), kind, getNodeModifiers(symbol.getDeclarations()[0]), new TypeScript.TextSpan(node.getStart(), node.getWidth())); + } } } - return null; + return RenameInfo.CreateError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element.key)); } return { dispose: dispose, @@ -32777,6 +34285,8 @@ var ts; getSyntacticDiagnostics: getSyntacticDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, + getSyntacticClassifications: getSyntacticClassifications, + getSemanticClassifications: getSemanticClassifications, getCompletionsAtPosition: getCompletionsAtPosition, getCompletionEntryDetails: getCompletionEntryDetails, getTypeAtPosition: getTypeAtPosition, @@ -32788,8 +34298,8 @@ var ts; getImplementorsAtPosition: function (filename, position) { return []; }, getNameOrDottedNameSpan: getNameOrDottedNameSpan, getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, - getNavigateToItems: function (searchValue) { return []; }, - getRenameInfo: function (fileName, position) { return RenameInfo.CreateError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element.key)); }, + getNavigateToItems: getNavigateToItems, + getRenameInfo: getRenameInfo, getNavigationBarItems: getNavigationBarItems, getOutliningSpans: getOutliningSpans, getTodoComments: getTodoComments, @@ -32798,7 +34308,7 @@ var ts; getFormattingEditsForRange: getFormattingEditsForRange, getFormattingEditsForDocument: getFormattingEditsForDocument, getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, - getEmitOutput: function (filename) { return null; } + getEmitOutput: getEmitOutput }; } ts.createLanguageService = createLanguageService; @@ -32807,18 +34317,18 @@ var ts; var noRegexTable; if (!noRegexTable) { noRegexTable = []; - noRegexTable[55 /* Identifier */] = true; - noRegexTable[3 /* StringLiteral */] = true; - noRegexTable[2 /* NumericLiteral */] = true; - noRegexTable[4 /* RegularExpressionLiteral */] = true; - noRegexTable[83 /* ThisKeyword */] = true; - noRegexTable[29 /* PlusPlusToken */] = true; - noRegexTable[30 /* MinusMinusToken */] = true; - noRegexTable[8 /* CloseParenToken */] = true; - noRegexTable[10 /* CloseBracketToken */] = true; - noRegexTable[6 /* CloseBraceToken */] = true; - noRegexTable[85 /* TrueKeyword */] = true; - noRegexTable[70 /* FalseKeyword */] = true; + noRegexTable[59 /* Identifier */] = true; + noRegexTable[7 /* StringLiteral */] = true; + noRegexTable[6 /* NumericLiteral */] = true; + noRegexTable[8 /* RegularExpressionLiteral */] = true; + noRegexTable[87 /* ThisKeyword */] = true; + noRegexTable[33 /* PlusPlusToken */] = true; + noRegexTable[34 /* MinusMinusToken */] = true; + noRegexTable[12 /* CloseParenToken */] = true; + noRegexTable[14 /* CloseBracketToken */] = true; + noRegexTable[10 /* CloseBraceToken */] = true; + noRegexTable[89 /* TrueKeyword */] = true; + noRegexTable[74 /* FalseKeyword */] = true; } function getClassificationsForLine(text, lexState) { var offset = 0; @@ -32838,25 +34348,22 @@ var ts; text = "/*\n" + text; offset = 3; break; - case 4 /* EndingWithDotToken */: - lastToken = 11 /* DotToken */; - break; } var result = { finalLexState: 0 /* Start */, entries: [] }; - scanner = ts.createScanner(1 /* ES5 */, text, onError, processComment); + scanner = ts.createScanner(1 /* ES5 */, true, text, onError, processComment); var token = 0 /* Unknown */; do { token = scanner.scan(); - if ((token === 27 /* SlashToken */ || token === 47 /* SlashEqualsToken */) && !noRegexTable[lastToken]) { - if (scanner.reScanSlashToken() === 4 /* RegularExpressionLiteral */) { - token = 4 /* RegularExpressionLiteral */; + if ((token === 31 /* SlashToken */ || token === 51 /* SlashEqualsToken */) && !noRegexTable[lastToken]) { + if (scanner.reScanSlashToken() === 8 /* RegularExpressionLiteral */) { + token = 8 /* RegularExpressionLiteral */; } } - else if (lastToken === 11 /* DotToken */) { - token = 55 /* Identifier */; + else if (lastToken === 15 /* DotToken */) { + token = 59 /* Identifier */; } lastToken = token; processToken(); @@ -32878,16 +34385,13 @@ var ts; if (inUnterminatedMultiLineComment) { result.finalLexState = 1 /* InMultiLineCommentTrivia */; } - else if (token === 3 /* StringLiteral */) { + else if (token === 7 /* StringLiteral */) { var tokenText = scanner.getTokenText(); if (tokenText.length > 0 && tokenText.charCodeAt(tokenText.length - 1) === 92 /* backslash */) { var quoteChar = tokenText.charCodeAt(0); result.finalLexState = quoteChar === 34 /* doubleQuote */ ? 3 /* InDoubleQuoteStringLiteral */ : 2 /* InSingleQuoteStringLiteral */; } } - else if (token === 11 /* DotToken */) { - result.finalLexState = 4 /* EndingWithDotToken */; - } } } function addLeadingWhiteSpace(start, end) { @@ -32907,42 +34411,42 @@ var ts; } function isBinaryExpressionOperatorToken(token) { switch (token) { - case 26 /* AsteriskToken */: - case 27 /* SlashToken */: - case 28 /* PercentToken */: - case 24 /* PlusToken */: - case 25 /* MinusToken */: - case 31 /* LessThanLessThanToken */: - case 32 /* GreaterThanGreaterThanToken */: - case 33 /* GreaterThanGreaterThanGreaterThanToken */: - case 15 /* LessThanToken */: - case 16 /* GreaterThanToken */: - case 17 /* LessThanEqualsToken */: - case 18 /* GreaterThanEqualsToken */: - case 77 /* InstanceOfKeyword */: - case 76 /* InKeyword */: - case 19 /* EqualsEqualsToken */: - case 20 /* ExclamationEqualsToken */: - case 21 /* EqualsEqualsEqualsToken */: - case 22 /* ExclamationEqualsEqualsToken */: - case 34 /* AmpersandToken */: - case 36 /* CaretToken */: - case 35 /* BarToken */: - case 39 /* AmpersandAmpersandToken */: - case 40 /* BarBarToken */: - case 53 /* BarEqualsToken */: - case 52 /* AmpersandEqualsToken */: - case 54 /* CaretEqualsToken */: - case 49 /* LessThanLessThanEqualsToken */: - case 50 /* GreaterThanGreaterThanEqualsToken */: - case 51 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 44 /* PlusEqualsToken */: - case 45 /* MinusEqualsToken */: - case 46 /* AsteriskEqualsToken */: - case 47 /* SlashEqualsToken */: - case 48 /* PercentEqualsToken */: - case 43 /* EqualsToken */: - case 14 /* CommaToken */: + case 30 /* AsteriskToken */: + case 31 /* SlashToken */: + case 32 /* PercentToken */: + case 28 /* PlusToken */: + case 29 /* MinusToken */: + case 35 /* LessThanLessThanToken */: + case 36 /* GreaterThanGreaterThanToken */: + case 37 /* GreaterThanGreaterThanGreaterThanToken */: + case 19 /* LessThanToken */: + case 20 /* GreaterThanToken */: + case 21 /* LessThanEqualsToken */: + case 22 /* GreaterThanEqualsToken */: + case 81 /* InstanceOfKeyword */: + case 80 /* InKeyword */: + case 23 /* EqualsEqualsToken */: + case 24 /* ExclamationEqualsToken */: + case 25 /* EqualsEqualsEqualsToken */: + case 26 /* ExclamationEqualsEqualsToken */: + case 38 /* AmpersandToken */: + case 40 /* CaretToken */: + case 39 /* BarToken */: + case 43 /* AmpersandAmpersandToken */: + case 44 /* BarBarToken */: + case 57 /* BarEqualsToken */: + case 56 /* AmpersandEqualsToken */: + case 58 /* CaretEqualsToken */: + case 53 /* LessThanLessThanEqualsToken */: + case 54 /* GreaterThanGreaterThanEqualsToken */: + case 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 48 /* PlusEqualsToken */: + case 49 /* MinusEqualsToken */: + case 50 /* AsteriskEqualsToken */: + case 51 /* SlashEqualsToken */: + case 52 /* PercentEqualsToken */: + case 47 /* EqualsToken */: + case 18 /* CommaToken */: return true; default: return false; @@ -32950,12 +34454,12 @@ var ts; } function isPrefixUnaryExpressionOperatorToken(token) { switch (token) { - case 24 /* PlusToken */: - case 25 /* MinusToken */: - case 38 /* TildeToken */: - case 37 /* ExclamationToken */: - case 29 /* PlusPlusToken */: - case 30 /* MinusMinusToken */: + case 28 /* PlusToken */: + case 29 /* MinusToken */: + case 42 /* TildeToken */: + case 41 /* ExclamationToken */: + case 33 /* PlusPlusToken */: + case 34 /* MinusMinusToken */: return true; default: return false; @@ -32975,13 +34479,13 @@ var ts; return 0 /* Punctuation */; } switch (token) { - case 2 /* NumericLiteral */: + case 6 /* NumericLiteral */: return 6 /* NumberLiteral */; - case 3 /* StringLiteral */: + case 7 /* StringLiteral */: return 7 /* StringLiteral */; - case 4 /* RegularExpressionLiteral */: + case 8 /* RegularExpressionLiteral */: return 8 /* RegExpLiteral */; - case 55 /* Identifier */: + case 59 /* Identifier */: default: return 5 /* Identifier */; } @@ -32996,7 +34500,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 177 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); + var proto = kind === 182 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -33142,12 +34646,12 @@ var ts; LanguageVersion[LanguageVersion["EcmaScript3"] = 0] = "EcmaScript3"; LanguageVersion[LanguageVersion["EcmaScript5"] = 1] = "EcmaScript5"; })(LanguageVersion || (LanguageVersion = {})); - var ModuleGenTarget; (function (ModuleGenTarget) { ModuleGenTarget[ModuleGenTarget["Unspecified"] = 0] = "Unspecified"; ModuleGenTarget[ModuleGenTarget["Synchronous"] = 1] = "Synchronous"; ModuleGenTarget[ModuleGenTarget["Asynchronous"] = 2] = "Asynchronous"; - })(ModuleGenTarget || (ModuleGenTarget = {})); + })(ts.ModuleGenTarget || (ts.ModuleGenTarget = {})); + var ModuleGenTarget = ts.ModuleGenTarget; function languageVersionToScriptTarget(languageVersion) { if (typeof languageVersion === "undefined") return undefined; @@ -33157,7 +34661,7 @@ var ts; case 1 /* EcmaScript5 */: return 1 /* ES5 */; default: - throw Error("unsuported LanguageVersion value: " + languageVersion); + throw Error("unsupported LanguageVersion value: " + languageVersion); } } function moduleGenTargetToModuleKind(moduleGenTarget) { @@ -33171,7 +34675,7 @@ var ts; case 0 /* Unspecified */: return 0 /* None */; default: - throw Error("unsuported ModuleGenTarget value: " + moduleGenTarget); + throw Error("unsupported ModuleGenTarget value: " + moduleGenTarget); } } function scriptTargetTolanguageVersion(scriptTarget) { @@ -33183,7 +34687,7 @@ var ts; case 1 /* ES5 */: return 1 /* EcmaScript5 */; default: - throw Error("unsuported ScriptTarget value: " + scriptTarget); + throw Error("unsupported ScriptTarget value: " + scriptTarget); } } function moduleKindToModuleGenTarget(moduleKind) { @@ -33197,7 +34701,7 @@ var ts; case 0 /* None */: return 0 /* Unspecified */; default: - throw Error("unsuported ModuleKind value: " + moduleKind); + throw Error("unsupported ModuleKind value: " + moduleKind); } } function compilationSettingsToCompilerOptions(settings) { @@ -33313,6 +34817,12 @@ var ts; LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { return this.shimHost.getCancellationToken(); }; + LanguageServiceShimHostAdapter.prototype.getDefaultLibFilename = function () { + return this.shimHost.getDefaultLibFilename(); + }; + LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { + return this.shimHost.getCurrentDirectory(); + }; return LanguageServiceShimHostAdapter; })(); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; @@ -33406,6 +34916,20 @@ var ts; category: ts.DiagnosticCategory[diagnostic.category].toLowerCase() }; }; + LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + var classifications = _this.languageService.getSyntacticClassifications(fileName, new TypeScript.TextSpan(start, length)); + return classifications; + }); + }; + LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + var classifications = _this.languageService.getSemanticClassifications(fileName, new TypeScript.TextSpan(start, length)); + return classifications; + }); + }; LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { var _this = this; return this.forwardJSONCall("getSyntacticDiagnostics('" + fileName + "')", function () { diff --git a/doc/TypeScript Language Specification (Change Markup) .pdf b/doc/TypeScript Language Specification (Change Markup) .pdf deleted file mode 100644 index 2b37fc55f3c..00000000000 Binary files a/doc/TypeScript Language Specification (Change Markup) .pdf and /dev/null differ diff --git a/doc/TypeScript Language Specification (Change Markup).docx b/doc/TypeScript Language Specification (Change Markup).docx index b3a0384f926..5bc24af5ec8 100644 Binary files a/doc/TypeScript Language Specification (Change Markup).docx and b/doc/TypeScript Language Specification (Change Markup).docx differ diff --git a/doc/TypeScript Language Specification (Change Markup).pdf b/doc/TypeScript Language Specification (Change Markup).pdf new file mode 100644 index 00000000000..52998e9ec79 Binary files /dev/null and b/doc/TypeScript Language Specification (Change Markup).pdf differ diff --git a/doc/TypeScript Language Specification.docx b/doc/TypeScript Language Specification.docx index 7fce1932d80..381ac186a4b 100644 Binary files a/doc/TypeScript Language Specification.docx and b/doc/TypeScript Language Specification.docx differ diff --git a/doc/TypeScript Language Specification.pdf b/doc/TypeScript Language Specification.pdf index b9223f922d2..049f7e06fb3 100644 Binary files a/doc/TypeScript Language Specification.pdf and b/doc/TypeScript Language Specification.pdf differ diff --git a/doc/header.md b/doc/header.md new file mode 100644 index 00000000000..3cf5b569800 --- /dev/null +++ b/doc/header.md @@ -0,0 +1,2 @@ +# TypeScript Language Specification + diff --git a/doc/spec.md b/doc/spec.md new file mode 100644 index 00000000000..5635c100a40 --- /dev/null +++ b/doc/spec.md @@ -0,0 +1,5438 @@ +# TypeScript Language Specification + +Version 1.3 + +September, 2014 + +
+ +Microsoft is making this Specification available under the Open Web Foundation Final Specification Agreement Version 1.0 (“OWF 1.0”) as of October 1, 2012. The OWF 1.0 is available at http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. + +TypeScript is a trademark of Microsoft Corporation. + +
+ +## Table of Contents + +* [1 Introduction](#1) + * [1.1 Ambient Declarations](#1.1) + * [1.2 Function Types](#1.2) + * [1.3 Object Types](#1.3) + * [1.4 Structural Subtyping](#1.4) + * [1.5 Contextual Typing](#1.5) + * [1.6 Classes](#1.6) + * [1.7 Enum Types](#1.7) + * [1.8 Overloading on String Parameters](#1.8) + * [1.9 Generic Types and Functions](#1.9) + * [1.10 Modules](#1.10) +* [2 Basic Concepts](#2) + * [2.1 Grammar Conventions](#2.1) + * [2.2 Namespaces and Named Types](#2.2) + * [2.3 Declarations](#2.3) + * [2.4 Scopes](#2.4) +* [3 Types](#3) + * [3.1 The Any Type](#3.1) + * [3.2 Primitive Types](#3.2) + * [3.2.1 The Number Type](#3.2.1) + * [3.2.2 The Boolean Type](#3.2.2) + * [3.2.3 The String Type](#3.2.3) + * [3.2.4 The Void Type](#3.2.4) + * [3.2.5 The Null Type](#3.2.5) + * [3.2.6 The Undefined Type](#3.2.6) + * [3.2.7 Enum Types](#3.2.7) + * [3.2.8 String Literal Types](#3.2.8) + * [3.3 Object Types](#3.3) + * [3.3.1 Named Type References](#3.3.1) + * [3.3.2 Array Types](#3.3.2) + * [3.3.3 Tuple Types](#3.3.3) + * [3.3.4 Function Types](#3.3.4) + * [3.3.5 Constructor Types](#3.3.5) + * [3.3.6 Members](#3.3.6) + * [3.4 Type Parameters](#3.4) + * [3.4.1 Type Parameter Lists](#3.4.1) + * [3.4.2 Type Argument Lists](#3.4.2) + * [3.5 Named Types](#3.5) + * [3.5.1 Instance Types](#3.5.1) + * [3.6 Specifying Types](#3.6) + * [3.6.1 Predefined Types](#3.6.1) + * [3.6.2 Type References](#3.6.2) + * [3.6.3 Object Type Literals](#3.6.3) + * [3.6.4 Array Type Literals](#3.6.4) + * [3.6.5 Tuple Type Literals](#3.6.5) + * [3.6.6 Function Type Literals](#3.6.6) + * [3.6.7 Constructor Type Literals](#3.6.7) + * [3.6.8 Type Queries](#3.6.8) + * [3.7 Specifying Members](#3.7) + * [3.7.1 Property Signatures](#3.7.1) + * [3.7.2 Call Signatures](#3.7.2) + * [3.7.3 Construct Signatures](#3.7.3) + * [3.7.4 Index Signatures](#3.7.4) + * [3.7.5 Method Signatures](#3.7.5) + * [3.8 Type Relationships](#3.8) + * [3.8.1 Apparent Type](#3.8.1) + * [3.8.2 Type and Member Identity](#3.8.2) + * [3.8.3 Subtypes and Supertypes](#3.8.3) + * [3.8.4 Assignment Compatibility](#3.8.4) + * [3.8.5 Contextual Signature Instantiation](#3.8.5) + * [3.8.6 Type Inference](#3.8.6) + * [3.8.7 Recursive Types](#3.8.7) + * [3.9 Widened Types](#3.9) + * [3.10 Best Common Type](#3.10) +* [4 Expressions](#4) + * [4.1 Values and References](#4.1) + * [4.2 The this Keyword](#4.2) + * [4.3 Identifiers](#4.3) + * [4.4 Literals](#4.4) + * [4.5 Object Literals](#4.5) + * [4.6 Array Literals](#4.6) + * [4.7 Parentheses](#4.7) + * [4.8 The super Keyword](#4.8) + * [4.8.1 Super Calls](#4.8.1) + * [4.8.2 Super Property Access](#4.8.2) + * [4.9 Function Expressions](#4.9) + * [4.9.1 Standard Function Expressions](#4.9.1) + * [4.9.2 Arrow Function Expressions](#4.9.2) + * [4.9.3 Contextually Typed Function Expressions](#4.9.3) + * [4.10 Property Access](#4.10) + * [4.11 The new Operator](#4.11) + * [4.12 Function Calls](#4.12) + * [4.12.1 Overload Resolution](#4.12.1) + * [4.12.2 Type Argument Inference](#4.12.2) + * [4.12.3 Grammar Ambiguities](#4.12.3) + * [4.13 Type Assertions](#4.13) + * [4.14 Unary Operators](#4.14) + * [4.14.1 The ++ and -- operators](#4.14.1) + * [4.14.2 The +, –, and ~ operators](#4.14.2) + * [4.14.3 The ! operator](#4.14.3) + * [4.14.4 The delete Operator](#4.14.4) + * [4.14.5 The void Operator](#4.14.5) + * [4.14.6 The typeof Operator](#4.14.6) + * [4.15 Binary Operators](#4.15) + * [4.15.1 The *, /, %, –, <<, >>, >>>, &, ^, and | operators](#4.15.1) + * [4.15.2 The + operator](#4.15.2) + * [4.15.3 The <, >, <=, >=, ==, !=, ===, and !== operators](#4.15.3) + * [4.15.4 The instanceof operator](#4.15.4) + * [4.15.5 The in operator](#4.15.5) + * [4.15.6 The && operator](#4.15.6) + * [4.15.7 The || operator](#4.15.7) + * [4.16 The Conditional Operator](#4.16) + * [4.17 Assignment Operators](#4.17) + * [4.18 The Comma Operator](#4.18) + * [4.19 Contextually Typed Expressions](#4.19) +* [5 Statements](#5) + * [5.1 Variable Statements](#5.1) + * [5.2 If, Do, and While Statements](#5.2) + * [5.3 For Statements](#5.3) + * [5.4 For-In Statements](#5.4) + * [5.5 Continue Statements](#5.5) + * [5.6 Break Statements](#5.6) + * [5.7 Return Statements](#5.7) + * [5.8 With Statements](#5.8) + * [5.9 Switch Statements](#5.9) + * [5.10 Throw Statements](#5.10) + * [5.11 Try Statements](#5.11) +* [6 Functions](#6) + * [6.1 Function Declarations](#6.1) + * [6.2 Function Overloads](#6.2) + * [6.3 Function Implementations](#6.3) + * [6.4 Generic Functions](#6.4) + * [6.5 Code Generation](#6.5) +* [7 Interfaces](#7) + * [7.1 Interface Declarations](#7.1) + * [7.2 Declaration Merging](#7.2) + * [7.3 Interfaces Extending Classes](#7.3) + * [7.4 Dynamic Type Checks](#7.4) +* [8 Classes](#8) + * [8.1 Class Declarations](#8.1) + * [8.1.1 Class Heritage Specification](#8.1.1) + * [8.1.2 Class Body](#8.1.2) + * [8.2 Members](#8.2) + * [8.2.1 Instance and Static Members](#8.2.1) + * [8.2.2 Accessibility](#8.2.2) + * [8.2.3 Inheritance and Overriding](#8.2.3) + * [8.2.4 Class Types](#8.2.4) + * [8.2.5 Constructor Function Types](#8.2.5) + * [8.3 Constructor Declarations](#8.3) + * [8.3.1 Constructor Parameters](#8.3.1) + * [8.3.2 Super Calls](#8.3.2) + * [8.3.3 Automatic Constructors](#8.3.3) + * [8.4 Property Member Declarations](#8.4) + * [8.4.1 Member Variable Declarations](#8.4.1) + * [8.4.2 Member Function Declarations](#8.4.2) + * [8.4.3 Member Accessor Declarations](#8.4.3) + * [8.5 Index Member Declarations](#8.5) + * [8.6 Code Generation](#8.6) + * [8.6.1 Classes Without Extends Clauses](#8.6.1) + * [8.6.2 Classes With Extends Clauses](#8.6.2) +* [9 Enums](#9) + * [9.1 Enum Declarations](#9.1) + * [9.2 Enum Members](#9.2) + * [9.3 Declaration Merging](#9.3) + * [9.4 Code Generation](#9.4) +* [10 Internal Modules](#10) + * [10.1 Module Declarations](#10.1) + * [10.2 Module Body](#10.2) + * [10.3 Import Declarations](#10.3) + * [10.4 Export Declarations](#10.4) + * [10.5 Declaration Merging](#10.5) + * [10.6 Code Generation](#10.6) +* [11 Source Files and External Modules](#11) + * [11.1 Source Files](#11.1) + * [11.1.1 Source Files Dependencies](#11.1.1) + * [11.2 External Modules](#11.2) + * [11.2.1 External Module Names](#11.2.1) + * [11.2.2 External Import Declarations](#11.2.2) + * [11.2.3 Export Declarations](#11.2.3) + * [11.2.4 Export Assignments](#11.2.4) + * [11.2.5 CommonJS Modules](#11.2.5) + * [11.2.6 AMD Modules](#11.2.6) +* [12 Ambients](#12) + * [12.1 Ambient Declarations](#12.1) + * [12.1.1 Ambient Variable Declarations](#12.1.1) + * [12.1.2 Ambient Function Declarations](#12.1.2) + * [12.1.3 Ambient Class Declarations](#12.1.3) + * [12.1.4 Ambient Enum Declarations](#12.1.4) + * [12.1.5 Ambient Module Declarations](#12.1.5) + * [12.2 Ambient External Module Declarations](#12.2) +* [A Grammar](#A) + * [A.1 Types](#A.1) + * [A.2 Expressions](#A.2) + * [A.3 Statements](#A.3) + * [A.4 Functions](#A.4) + * [A.5 Interfaces](#A.5) + * [A.6 Classes](#A.6) + * [A.7 Enums](#A.7) + * [A.8 Internal Modules](#A.8) + * [A.9 Source Files and External Modules](#A.9) + * [A.10 Ambients](#A.10) + +
+ +# 1 Introduction + +JavaScript applications such as web e-mail, maps, document editing, and collaboration tools are becoming an increasingly important part of the everyday computing. We designed TypeScript to meet the needs of the JavaScript programming teams that build and maintain large JavaScript programs. TypeScript helps programming teams to define interfaces between software components and to gain insight into the behavior of existing JavaScript libraries. TypeScript also enables teams to reduce naming conflicts by organizing their code into dynamically-loadable modules. TypeScript’s optional type system enables JavaScript programmers to use highly-productive development tools and practices: static checking, symbol-based navigation, statement completion, and code re-factoring. + +TypeScript is a syntactic sugar for JavaScript. TypeScript syntax is a superset of Ecmascript 5 (ES5) syntax. Every JavaScript program is also a TypeScript program. The TypeScript compiler performs only file-local transformations on TypeScript programs and does not re-order variables declared in TypeScript. This leads to JavaScript output that closely matches the TypeScript input. TypeScript does not transform variable names, making tractable the direct debugging of emitted JavaScript. TypeScript optionally provides source maps, enabling source-level debugging. TypeScript tools typically emit JavaScript upon file save, preserving the test, edit, refresh cycle commonly used in JavaScript development. + +TypeScript syntax includes several proposed features of Ecmascript 6 (ES6), including classes and modules. Classes enable programmers to express common object-oriented patterns in a standard way, making features like inheritance more readable and interoperable. Modules enable programmers to organize their code into components while avoiding naming conflicts. The TypeScript compiler provides module code generation options that support either static or dynamic loading of module contents. + +TypeScript also provides to JavaScript programmers a system of optional type annotations. These type annotations are like the JSDoc comments found in the Closure system, but in TypeScript they are integrated directly into the language syntax. This integration makes the code more readable and reduces the maintenance cost of synchronizing type annotations with their corresponding variables. + +The TypeScript type system enables programmers to express limits on the capabilities of JavaScript objects, and to use tools that enforce these limits. To minimize the number of annotations needed for tools to become useful, the TypeScript type system makes extensive use of type inference. For example, from the following statement, TypeScript will infer that the variable ‘i’ has the type number. + +```TypeScript +var i = 0; +``` + +TypeScript will infer from the following function definition that the function f has return type string. + +```TypeScript +function f() { + return "hello"; +} +``` + +To benefit from this inference, a programmer can use the TypeScript language service. For example, a code editor can incorporate the TypeScript language service and use the service to find the members of a string object as in the following screen shot. + +/ + +In this example, the programmer benefits from type inference without providing type annotations. Some beneficial tools, however, do require the programmer to provide type annotations. In TypeScript, we can express a parameter requirement as in the following code fragment. + +```TypeScript +function f(s: string) { + return s; +} + +f({}); // Error +f("hello"); // Ok +``` + +This optional type annotation on the parameter ‘s’ lets the TypeScript type checker know that the programmer expects parameter ‘s’ to be of type ‘string’. Within the body of function ‘f’, tools can assume ‘s’ is of type ‘string’ and provide operator type checking and member completion consistent with this assumption. Tools can also signal an error on the first call to ‘f’, because ‘f’ expects a string, not an object, as its parameter. For the function ‘f’, the TypeScript compiler will emit the following JavaScript code: + +```TypeScript +function f(s) { + return s; +} +``` + +In the JavaScript output, all type annotations have been erased. In general, TypeScript erases all type information before emiting JavaScript. + +## 1.1 Ambient Declarations + +An ambient declaration introduces a variable into a TypeScript scope, but has zero impact on the emitted JavaScript program. Programmers can use ambient declarations to tell the TypeScript compiler that some other component will supply a variable. For example, by default the TypeScript compiler will print an error for uses of undefined variables. To add some of the common variables defined by browsers, a TypeScript programmer can use ambient declarations. The following example declares the ‘document’ object supplied by browsers. Because the declaration does not specify a type, the type ‘any’ is inferred. The type ‘any’ means that a tool can assume nothing about the shape or behavior of the document object. Some of the examples below will illustrate how programmers can use types to further characterize the expected behavior of an object. + +```TypeScript +declare var document; +document.title = "Hello"; // Ok because document has been declared +``` + +In the case of ‘document’, the TypeScript compiler automatically supplies a declaration, because TypeScript by default includes a file ‘lib.d.ts’ that provides interface declarations for the built-in JavaScript library as well as the Document Object Model. + +The TypeScript compiler does not include by default an interface for jQuery, so to use jQuery, a programmer could supply a declaration such as: + +```TypeScript +declare var $; +``` + +Section [1.3](#1.3) provides a more extensive example of how a programmer can add type information for jQuery and other libraries. + +## 1.2 Function Types + +Function expressions are a powerful feature of JavaScript. They enable function definitions to create closures: functions that capture information from the lexical scope surrounding the function’s definition. Closures are currently JavaScript’s only way of enforcing data encapsulation. By capturing and using environment variables, a closure can retain information that cannot be accessed from outside the closure. JavaScript programmers often use closures to express event handlers and other asynchronous callbacks, in which another software component, such as the DOM, will call back into JavaScript through a handler function. + +TypeScript function types make it possible for programmers to express the expected *signature* of a function. A function signature is a sequence of parameter types plus a return type. The following example uses function types to express the callback signature requirements of an asynchronous voting mechanism. + +```TypeScript +function vote(candidate: string, callback: (result: string) => any) { + // ... +} + +vote("BigPig", + function(result: string) { + if (result === "BigPig") { + // ... + } + } +); +``` + +In this example, the second parameter to ‘vote’ has the function type + +```TypeScript +(result: string) => any +``` + +which means the second parameter is a function returning type ‘any’ that has a single parameter of type ‘string’ named ‘result’. + +Section [3.7.2](#3.7.2) provides additional information about function types. + +## 1.3 Object Types + +TypeScript programmers use *object types* to declare their expectations of object behavior. The following code uses an *object type literal* to specify the return type of the ‘MakePoint’ function. + +```TypeScript +var MakePoint: () => { + x: number; y: number; +}; +``` + +Programmers can give names to object types; we call named object types *interfaces*. For example, in the following code, an interface declares one required field (name) and one optional field (favoriteColor). + +```TypeScript +interface Friend { + name: string; + favoriteColor?: string; +} + +function add(friend: Friend) { + var name = friend.name; +} + +add({ name: "Fred" }); // Ok +add({ favoriteColor: "blue" }); // Error, name required +add({ name: "Jill", favoriteColor: "green" }); // Ok +``` + +TypeScript object types model the diversity of behaviors that a JavaScript object can exhibit. For example, the jQuery library defines an object, ‘$’, that has methods, such as ‘get’ (which sends an Ajax message), and fields, such as ‘browser’ (which gives browser vendor information). However, jQuery clients can also call ‘$’ as a function. The behavior of this function depends on the type of parameters passed to the function. + +The following code fragment captures a small subset of jQuery behavior, just enough to use jQuery in a simple way. + +```TypeScript +interface JQuery { + text(content: string); +} + +interface JQueryStatic { + get(url: string, callback: (data: string) => any); + (query: string): JQuery; +} + +declare var $: JQueryStatic; + +$.get("http://mysite.org/divContent", + function (data: string) { + $("div").text(data); + } +); +``` + +The ‘JQueryStatic’ interface references another interface: ‘JQuery’. This interface represents a collection of one or more DOM elements. The jQuery library can perform many operations on such a collection, but in this example the jQuery client only needs to know that it can set the text content of each jQuery element in a collection by passing a string to the ‘text’ method. The ‘JQueryStatic’ interface also contains a method, ‘get’, that performs an Ajax get operation on the provided URL and arranges to invoke the provided callback upon receipt of a response. + +Finally, the ‘JQueryStatic’ interface contains a bare function signature + +```TypeScript +(query: string): JQuery; +``` + +The bare signature indicates that instances of the interface are callable. This example illustrates that TypeScript function types are just special cases of TypeScript object types. Specifically, function types are object types that contain one or more call signatures. For this reason we can write any function type as an object type literal. The following example uses both forms to describe the same type. + +```TypeScript +var f: { (): string; }; +var sameType: () => string = f; // Ok +var nope: () => number = sameType; // Error: type mismatch +``` + +We mentioned above that the ‘$’ function behaves differently depending on the type of its parameter. So far, our jQuery typing only captures one of these behaviors: return an object of type ‘JQuery’ when passed a string. To specify multiple behaviors, TypeScript supports *overloading* of function signatures in object types. For example, we can add an additional call signature to the ‘JQueryStatic’ interface. + +```TypeScript +(ready: () => any): any; +``` + +This signature denotes that a function may be passed as the parameter of the ‘$’ function. When a function is passed to ‘$’, the jQuery library will invoke that function when a DOM document is ready. Because TypeScript supports overloading, tools can use TypeScript to show all available function signatures with their documentation tips and to give the correct documentation once a function has been called with a particular signature. + +A typical client would not need to add any additional typing but could just use a community-supplied typing to discover (through statement completion with documentation tips) and verify (through static checking) correct use of the library, as in the following screen shot. + +/ + +Section [3.3](#3.3) provides additional information about object types. + +## 1.4 Structural Subtyping + +Object types are compared *structurally*. For example, in the code fragment below, class ‘CPoint’ matches interface ‘Point’ because ‘CPoint’ has all of the required members of ‘Point’. A class may optionally declare that it implements an interface, so that the compiler will check the declaration for structural compatibility. The example also illustrates that an object type can match the type inferred from an object literal, as long as the object literal supplies all of the required members. + +```TypeScript +interface Point { + x: number; + y: number; +} + +function getX(p: Point) { + return p.x; +} + +class CPoint { + x: number; + y: number; + constructor(x: number, y: number) { + this.x = x; + this.y = y; + } +} + +getX(new CPoint(0, 0)); // Ok, fields match + +getX({ x: 0, y: 0, color: "red" }); // Extra fields Ok + +getX({ x: 0 }); // Error: supplied parameter does not match +``` + +See section [3.8](#3.8) for more information about type comparisons. + +## 1.5 Contextual Typing + +Ordinarily, TypeScript type inference proceeds “bottom-up”: from the leaves of an expression tree to its root. In the following example, TypeScript infers ‘number’ as the return type of the function ‘mul’ by flowing type information bottom up in the return expression. + +```TypeScript +function mul(a: number, b: number) { + return a * b; +} +``` + +For variables and parameters without a type annotation or a default value, TypeScript infers type ‘any’, ensuring that compilers do not need non-local information about a function’s call sites to infer the function’s return type. Generally, this bottom-up approach provides programmers with a clear intuition about the flow of type information. + +However, in some limited contexts, inference proceeds “top-down” from the context of an expression. Where this happens, it is called contextual typing. Contextual typing helps tools provide excellent information when a programmer is using a type but may not know all of the details of the type. For example, in the jQuery example, above, the programmer supplies a function expression as the second parameter to the ‘get’ method. During typing of that expression, tools can assume that the type of the function expression is as given in the ‘get’ signature and can provide a template that includes parameter names and types. + +```TypeScript +$.get("http://mysite.org/divContent", + function (data) { + $("div").text(data); // TypeScript infers data is a string + } +); +``` + +Contextual typing is also useful for writing out object literals. As the programmer types the object literal, the contextual type provides information that enables tools to provide completion for object member names. + +Section [4.19](#4.19) provides additional information about contextually typed expressions. + +## 1.6 Classes + +JavaScript practice has at least two common design patterns: the module pattern and the class pattern. Roughly speaking, the module pattern uses closures to hide names and to encapsulate private data, while the class pattern uses prototype chains to implement many variations on object-oriented inheritance mechanisms. Libraries such as ‘prototype.js’ are typical of this practice. + +This section and the module section below will show how TypeScript emits consistent, idiomatic JavaScript code to implement classes and modules that are closely aligned with the current ES6 proposal. The goal of TypeScript’s translation is to emit exactly what a programmer would type when implementing a class or module unaided by a tool. This section will also describe how TypeScript infers a type for each class declaration. We’ll start with a simple BankAccount class. + +```TypeScript +class BankAccount { + balance = 0; + deposit(credit: number) { + this.balance += credit; + return this.balance; + } +} +``` + +This class generates the following JavaScript code. + +```TypeScript +var BankAccount = (function () { + function BankAccount() { + this.balance = 0; + } + BankAccount.prototype.deposit = function(credit) { + this.balance += credit; + return this.balance; + }; + return BankAccount; +})(); +``` + +This TypeScript class declaration creates a variable named ‘BankAccount’ whose value is the constructor function for ‘BankAccount’ instances. This declaration also creates an instance type of the same name. If we were to write this type as an interface it would look like the following. + +```TypeScript +interface BankAccount { + balance: number; + deposit(credit: number): number; +} +``` + +If we were to write out the function type declaration for the ‘BankAccount’ constructor variable, it would have the following form. + +```TypeScript +var BankAccount: new() => BankAccount; +``` + +The function signature is prefixed with the keyword ‘new’ indicating that the ‘BankAccount’ function must be called as a constructor. It is possible for a function’s type to have both call and constructor signatures. For example, the type of the built-in JavaScript Date object includes both kinds of signatures. + +If we want to start our bank account with an initial balance, we can add to the ‘BankAccount’ class a constructor declaration. + +```TypeScript +class BankAccount { + balance: number; + constructor(initially: number) { + this.balance = initially; + } + deposit(credit: number) { + this.balance += credit; + return this.balance; + } +} +``` + +This version of the ‘BankAccount’ class requires us to introduce a constructor parameter and then assign it to the ‘balance’ field. To simplify this common case, TypeScript accepts the following shorthand syntax. + +```TypeScript +class BankAccount { + constructor(public balance: number) { + } + deposit(credit: number) { + this.balance += credit; + return this.balance; + } +} +``` + +The ‘public’ keyword denotes that the constructor parameter is to be retained as a field. Public is the default accessibility for class members, but a programmer can also specify private or protected accessibility for a class member. Accessibility is a design-time construct; it is enforced during static type checking but does not imply any runtime enforcement. + +TypeScript classes also support inheritance, as in the following example.* * + +```TypeScript +class CheckingAccount extends BankAccount { + constructor(balance: number) { + super(balance); + } + writeCheck(debit: number) { + this.balance -= debit; + } +} +``` + +In this example, the class ‘CheckingAccount’ *derives* from class ‘BankAccount’. The constructor for ‘CheckingAccount’ calls the constructor for class ‘BankAccount’ using the ‘super’ keyword. In the emitted JavaScript code, the prototype of ‘CheckingAccount’ will chain to the prototype of ‘BankingAccount’. + +TypeScript classes may also specify static members. Static class members become properties of the class constructor. + +Section [8](#8) provides additional information about classes. + +## 1.7 Enum Types + +TypeScript enables programmers to summarize a set of numeric constants as an *enum type*. The example below creates an enum type to represent operators in a calculator application. + +```TypeScript +enum Operator { + ADD, + DIV, + MUL, + SUB +} + +function compute(op: Operator, a: number, b: number) { + console.log("the operator is" + Operator[op]); + // ... +} +``` + +In this example, the compute function logs the operator ‘op’ using a feature of enum types: reverse mapping from the enum value (‘op’) to the string corresponding to that value. For example, the declaration of ‘Operator’ automatically assigns integers, starting from zero, to the listed enum members. Section [9](#9) describes how programmers can also explicitly assign integers to enum members, and can use any string to name an enum member. + +If all enum members have explicitly assigned literal integers, or if an enum has all members automatically assigned, the TypeScript compiler will emit for an enum member a JavaScript constant corresponding to that member’s assigned value (annotated with a comment). This improves performance on many JavaScript engines. + +For example, the ‘compute’ function could contain a switch statement like the following. + +```TypeScript +switch (op) { + case Operator.ADD: + // execute add + break; + case Operator.DIV: + // execute div + break; + // ... +} +``` + +For this switch statement, the compiler will generate the following code. + +```TypeScript +switch (op) { + case 0 /* Operator.ADD */: + // execute add + break; + case 1 /* Operator.DIV */: + // execute div + break; + // ... +} +``` + +JavaScript implementations can use these explicit constants to generate efficient code for this switch statement, for example by building a jump table indexed by case value. + +## 1.8 Overloading on String Parameters + +An important goal of TypeScript is to provide accurate and straightforward types for existing JavaScript programming patterns. To that end, TypeScript includes generic types, discussed in the next section, and *overloading on string parameters*, the topic of this section. + +JavaScript programming interfaces often include functions whose behavior is discriminated by a string constant passed to the function. The Document Object Model makes heavy use of this pattern. For example, the following screen shot shows that the ‘createElement’ method of the ‘document’ object has multiple signatures, some of which identify the types returned when specific strings are passed into the method. + +/ + +The following code fragment uses this feature. Because the ‘span’ variable is inferred to have the type ‘HTMLSpanElement’, the code can reference without static error the ‘isMultiline’ property of ‘span’. + +```TypeScript +var span = document.createElement("span"); +span.isMultiLine = false; // OK: HTMLSpanElement has isMultiline property +``` + +In the following screen shot, a programming tool combines information from overloading on string parameters with contextual typing to infer that the type of the variable ‘e’ is ‘MouseEvent’ and that therefore ‘e’ has a ‘clientX’ property. + +/ + +Section [3.7.2.4](#3.7.2.4) provides details on how to use string literals in function signatures. + +## 1.9 Generic Types and Functions + +Like overloading on string parameters, *generic types* make it easier for TypeScript to accurately capture the behavior of JavaScript libraries. Because they enable type information to flow from client code, through library code, and back into client code, generic types may do more than any other TypeScript feature to support detailed API descriptions. + +To illustrate this, let’s take a look at part of the TypeScript interface for the built-in JavaScript array type. You can find this interface in the ‘lib.d.ts’ file that accompanies a TypeScript distribution. + +```TypeScript +interface Array { + reverse(): T[]; + sort(compareFn?: (a: T, b: T) => number): T[]; + // ... +} +``` + +Interface definitions, like the one above, can have one or more *type parameters*. In this case the ‘Array’ interface has a single parameter, ‘T’, that defines the element type for the array. The ‘reverse’ method returns an array with the same element type. The sort method takes an optional parameter, ‘compareFn’, whose type is a function that takes two parameters of type ‘T’ and returns a number. Finally, sort returns an array with element type ‘T’. + +Functions can also have generic parameters. For example, the array interface contains a ‘map’ method, defined as follows: + +```TypeScript +map(func: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; +``` + +The map method, invoked on an array ‘a’ with element type ‘T’, will apply function ‘func’ to each element of ‘a’, returning a value of type ‘U’. + +The TypeScript compiler can often infer generic method parameters, making it unnecessary for the programmer to explicitly provide them. In the following example, the compiler infers that parameter ‘U’ of the map method has type ‘string’, because the function passed to map returns a string. + +```TypeScript +function numberToString(a: number[]) { + var stringArray = a.map(v => v.toString()); + return stringArray; +} +``` + +The compiler infers in this example that the ‘numberToString’ function returns an array of strings. + +In TypeScript, classes can also have type parameters. The following code declares a class that implements a linked list of items of type ‘T’. This code illustrates how programmers can *constrain* type parameters to extend a specific type. In this case, the items on the list must extend the type ‘NamedItem’. This enables the programmer to implement the ‘log’ function, which logs the name of the item. + +```TypeScript +interface NamedItem { + name: string; +} + +class List { + next: List = null; + + constructor(public item: T) { + } + + insertAfter(item: T) { + var temp = this.next; + this.next = new List(item); + this.next.next = temp; + } + + log() { + console.log(this.item.name); + } + + // ... +} +``` + +Section [3.5](#3.5) provides further information about generic types. + +## 1.10 Modules + +Classes and interfaces support large-scale JavaScript development by providing a mechanism for describing how to use a software component that can be separated from that component’s implementation. TypeScript enforces *encapsulation* of implementation in classes at design time (by restricting use of private and protected members), but cannot enforce encapsulation at runtime because all object properties are accessible at runtime. Future versions of JavaScript may provide *private names* which would enable runtime enforcement of private and protected members. + +In the current version of JavaScript, the only way to enforce encapsulation at runtime is to use the module pattern: encapsulate private fields and methods using closure variables. The module pattern is a natural way to provide organizational structure and dynamic loading options by drawing a boundary around a software component. A module can also provide the ability to introduce namespaces, avoiding use of the global namespace for most software components. + +The following example illustrates the JavaScript module pattern. + +```TypeScript +(function(exports) { + var key = generateSecretKey(); + function sendMessage(message) { + sendSecureMessage(message, key); + } + exports.sendMessage = sendMessage; +})(MessageModule); +``` + +This example illustrates the two essential elements of the module pattern: a *module closure* and a *module* *object*. The module closure is a function that encapsulates the module’s implementation, in this case the variable ‘key’ and the function ‘sendMessage’. The module object contains the exported variables and functions of the module. Simple modules may create and return the module object. The module above takes the module object as a parameter, ‘exports’, and adds the ‘sendMessage’ property to the module object. This *augmentation* approach simplifies dynamic loading of modules and also supports separation of module code into multiple files. + +The example assumes that an outer lexical scope defines the functions ‘generateSecretKey’ and ‘sendSecureMessage’; it also assumes that the outer scope has assigned the module object to the variable ‘MessageModule’. + +TypeScript modules provide a mechanism for succinctly expressing the module pattern. In TypeScript, programmers can combine the module pattern with the class pattern by nesting modules and classes within an outer module. + +The following example shows the definition and use of a simple module. + +```TypeScript +module M { + var s = "hello"; + export function f() { + return s; + } +} + +M.f(); +M.s; // Error, s is not exported +``` + +In this example, variable ‘s’ is a private feature of the module, but function ‘f’ is exported from the module and accessible to code outside of the module. If we were to describe the effect of module ‘M’ in terms of interfaces and variables, we would write + +```TypeScript +interface M { + f(): string; +} + +var M: M; +``` + +The interface ‘M’ summarizes the externally visible behavior of module ‘M’. In this example, we can use the same name for the interface as for the initialized variable because in TypeScript type names and variable names do not conflict: each lexical scope contains a variable declaration space and type declaration space (see section [2.3](#2.3) for more details). + +Module ‘M’ is an example of an *internal* module, because it is nested within the *global* module (see section [10](#10) for more details). The TypeScript compiler emits the following JavaScript code for this module. + +```TypeScript +var M; +(function(M) { + var s = "hello"; + function f() { + return s; + } + M.f = f; +})(M || (M = {})); +``` + +In this case, the compiler assumes that the module object resides in global variable ‘M’, which may or may not have been initialized to the desired module object. + +TypeScript also supports *external* modules, which are files that contain top-level *export* and *import *directives. For this type of module the TypeScript compiler will emit code whose module closure and module object implementation vary according to the specified dynamic loading system, for example, the Asynchronous Module Definition system. + +
+ +#
2 Basic Concepts + +The remainder of this document is the formal specification of the TypeScript programming language and is intended to be read as an adjunct to the ECMAScript Language Specification (specifically, the ECMA-262 Standard, 5th Edition). This document describes the syntactic grammar added by TypeScript along with the compile-time processing and type checking performed by the TypeScript compiler, but it only minimally discusses the run-time behavior of programs since that is covered by the ECMAScript specification. + +## 2.1 Grammar Conventions + +The syntactic grammar added by TypeScript language is specified throughout this document using the existing conventions and production names of the ECMAScript grammar. In places where TypeScript augments an existing grammar production it is so noted. For example: + +  *CallExpression:* *( Modified )* +   … +   `super` `(` *ArgumentListopt* `)` +   `super` `.` *IdentifierName* + +The ‘*( Modified )*’ annotation indicates that an existing grammar production is being replaced, and the ‘…’ references the contents of the original grammar production. + +Similar to the ECMAScript grammar, if the phrase “*[no LineTerminator here]*” appears in the right-hand side of a production of the syntactic grammar, it indicates that the production is not a match if a *LineTerminator* occurs in the input stream at the indicated position. + +## 2.2 Namespaces and Named Types + +TypeScript supports ***named types*** that can be organized in hierarchical ***namespaces***. Namespaces are introduced by module declarations and named types are introduced by class, interface, and enum declarations. Named types are denoted by qualified names that extend from some root module (possibly the global module) to the point of their declaration. The example + +```TypeScript +module X { + export module Y { + export interface Z { } + } + export interface Y { } +} +``` + +declares two interface types with the qualified names ‘X.Y.Z’ and ‘X.Y’ relative to the root module in which ‘X’ is declared. + +In a qualified type name all identifiers but the last one refer to namespaces and the last identifier refers to a named type. Named type and namespace names are in separate declaration spaces and it is therefore possible for a named type and a namespace to have the same name, as in the example above. + +The hierarchy formed by namespace and named type names partially mirrors that formed by module instances and members. The example + +```TypeScript +module A { + export module B { + export class C { } + } +} +``` + +introduces a named type with the qualified name ‘A.B.C’ and also introduces a constructor function that can be accessed using the expression ‘A.B.C’. Thus, in the example + +```TypeScript +var c: A.B.C = new A.B.C(); +``` + +the two occurrences of ‘A.B.C’ in fact refer to different entities. It is the context of the occurrences that determines whether ‘A.B.C’ is processed as a type name or an expression. + +## 2.3 Declarations + +Declarations introduce names in the ***declaration spaces*** to which they belong. It is an error to have two names with same spelling in the same declaration space. Declaration spaces exist as follows: + +* The global module and each external or internal module has a declaration space for variables (including functions, modules, class constructor functions, and enum objects), a declaration space for named types (classes, interfaces, and enums), and a declaration space for namespaces (containers of named types). Every declaration (whether local or exported) in a module contributes to one or more of these declaration spaces. +* Each external or internal module has a declaration space for exported members, a declaration space for exported named types, and a declaration space for exported namespaces. All export declarations in the module contribute to these declaration spaces. Each internal module’s export declaration spaces are shared with other internal modules that have the same root module and the same qualified name starting from that root module. +* Each class declaration has a declaration space for instance members, a declaration space for static members, and a declaration space for type parameters. +* Each interface declaration has a declaration space for members and a declaration space for type parameters. An interface’s declaration space is shared with other interfaces that have the same root module and the same qualified name starting from that root module. +* Each enum declaration has a declaration space for its enum members. An enum’s declaration space is shared with other enums that have the same root module and the same qualified name starting from that root module. +* Each function declaration (including constructor, member function, and member accessor declarations) and each function expression has a declaration space for variables (parameters, local variables, and local functions) and a declaration space for type parameters. +* Each object literal has a declaration space for its properties. +* Each object type literal has a declaration space for its members. + +Top-level declarations in a source file with no top-level import or export declarations belong to the ***global module***. Top-level declarations in a source file with one or more top-level import or export declarations belong to the ***external module*** represented by that source file. + +An internal module declaration contributes a namespace name (representing a container of types) and possibly a member name (representing the module instance) to the containing module. A class declaration contributes both a member name (representing the constructor function) and a type name (representing the class type) to the containing module. An interface declaration contributes a type name to the containing module. An enum declaration contributes both a member name (representing the enum object) and a type name (representing the enum type) to the containing module. Any other declaration contributes a member name to the declaration space to which it belongs. + +The ***parent module*** of an entity is defined as follows: + +* The parent module of an entity declared in an internal module is that internal module. +* The parent module of an entity declared in an external module is that external module. +* The parent module of an entity declared in the global module is the global module. +* The parent module of an external module is the global module. + +The ***root module*** of an entity is defined as follows: + +* The root module of a non-exported entity is the entity’s parent module. +* The root module of an exported entity is the root module of the entity’s parent module. + +Intuitively, the root module of an entity is the outermost module body from within which the entity is reachable. + +Interfaces, enums, and internal modules are “open ended,” meaning that interface, enum, and internal module declarations with the same qualified name relative to a common root are automatically merged. For further details, see sections [7.2](#7.2), [9.3](#9.3), and [10.5](#10.5). + +Namespace, type, and member names exist in separate declaration spaces. Furthermore, declarations of non-instantiated modules (modules that contain only interfaces or modules at all levels of nesting) do not introduce a member name in their containing declaration space. This means that the following is permitted, provided module ‘X’ contains only interface or module declarations at all levels of nesting: + +```TypeScript +module M { + module X { ... } // Namespace + interface X { ... } // Type + var X; // Member +} +``` + +If module ‘X’ above was an instantiated module (section [10.1](#10.1)) it would cause a member ‘X’ to be introduced in ‘M’. This member would conflict with the variable ‘X’ and thus cause an error. + +Instance and static members in a class are likewise in separate declaration spaces. Thus the following is permitted: + +```TypeScript +class C { + x: number; // Instance member + static x: string; // Static member +} +``` + +## 2.4 Scopes + +The ***scope*** of a name is the region of program text within which it is possible to refer to the entity declared by that name without qualification of the name. The scope of a name depends on the context in which the name is declared. The contexts are listed below in order from outermost to innermost: + +* The scope of an entity declared in the global module is the entire program text. +* The scope of an entity declared in an external module is the source file of that external module. +* The scope of an exported entity declared in an internal module is the body of that module and every internal module with the same root and the same qualified name relative to that root. +* The scope of a non-exported entity declared within an internal module declaration is the body of that internal module declaration. +* The scope of a type parameter declared in a class or interface declaration is that entire declaration, including constraints, extends clause, implements clause, and declaration body, but not including static member declarations. +* The scope of a member declared in an enum declaration is the body of that declaration and every enum declaration with the same root and the same qualified name relative to that root. +* The scope of a type parameter declared in a call or construct signature is that entire signature declaration, including constraints, parameter list, and return type. If the signature is part of a function implementation, the scope includes the function body. +* The scope of a parameter, local variable, or local function declared within a function declaration (including a constructor, member function, or member accessor declaration) or function expression is the body of that function declaration or function expression. + +Scopes may overlap, for example through nesting of modules and functions. When the scopes of two entities with the same name overlap, the entity with the innermost declaration takes precedence and access to the outer entity is either not possible or only possible by qualifying its name. + +When an identifier is resolved as a *TypeName* (section [3.6.2](#3.6.2)), only classes, interfaces, enums, and type parameters are considered and other entities in scope are ignored. + +When an identifier is resolved as a *ModuleName* (section [3.6.2](#3.6.2)), only modules are considered and other entities in scope are ignored. + +When an identifier is resolved as a *PrimaryExpression* (section [4.3](#4.3)), only instantiated modules (section [10.1](#10.1)), classes, enums, functions, variables, and parameters are considered and other entities in scope are ignored. + +Note that class and enum members are never directly in scope—they can only be accessed by applying the dot (‘.’) operator to a class instance or enum object. This even includes members of the current instance in a constructor or member function, which are accessed by applying the dot operator to `this`. + +As the rules above imply, locally declared entities in an internal module are closer in scope than exported entities declared in other module declarations for the same internal module. For example: + +```TypeScript +var x = 1; +module M { + export var x = 2; + console.log(x); // 2 +} +module M { + console.log(x); // 2 +} +module M { + var x = 3; + console.log(x); // 3 +} +``` + +
+ +#
3 Types + +TypeScript adds optional static types to JavaScript. Types are used to place static constraints on program entities such as functions, variables, and properties so that compilers and development tools can offer better verification and assistance during software development. TypeScript’s *static* compile-time type system closely models the *dynamic* run-time type system of JavaScript, allowing programmers to accurately express the type relationships that are expected to exist when their programs run and have those assumptions pre-validated by the TypeScript compiler. TypeScript’s type analysis occurs entirely at compile-time and adds no run-time overhead to program execution. + +All types in TypeScript are subtypes of a single top type called the Any type. The `any` keyword references this type. The Any type is the one type that can represent *any* JavaScript value with no constraints. All other types are categorized as ***primitive types***, ***object types***, or ***type parameters***. These types introduce various static constraints on their values. + +The primitive types are the Number, Boolean, String, Void, Null, and Undefined types along with user defined enum types. The `number`, `boolean`, `string`, and `void` keywords reference the Number, Boolean, String, and Void primitive types respectively. The Void type exists purely to indicate the absence of a value, such as in a function with no return value. It is not possible to explicitly reference the Null and Undefined types—only *values* of those types can be referenced, using the `null` and `undefined` literals. + +The object types are all class, interface, array, and literal types. Class and interface types are introduced through class and interface declarations and are referenced by the name given to them in their declarations. Class and interface types may be ***generic types*** which have one or more type parameters. Literal types are written as object, array, function, or constructor type literals and are used to compose new types from other types. + +Declarations of modules, classes, properties, functions, variables and other language entities associate types with those entities. The mechanism by which a type is formed and associated with a language entity depends on the particular kind of entity. For example, a module declaration associates the module with an anonymous type containing a set of properties corresponding to the exported variables and functions in the module, and a function declaration associates the function with an anonymous type containing a call signature corresponding to the parameters and return type of the function. Types can be associated with variables through explicit ***type annotations***, such as + +```TypeScript +var x: number; +``` + +or through implicit ***type inference***, as in + +```TypeScript +var x = 1; +``` + +which infers the type of ‘x’ to be the Number primitive type because that is the type of the value used to initialize ‘x’. + +## 3.1 The Any Type + +The Any type is used to represent any JavaScript value. A value of the Any type supports the same operations as a value in JavaScript and minimal static type checking is performed for operations on Any values. Specifically, properties of any name can be accessed through an Any value and Any values can be called as functions or constructors with any argument list. + +The `any` keyword references the Any type. In general, in places where a type is not explicitly provided and TypeScript cannot infer one, the Any type is assumed. + +The Any type is a supertype of all types, and is assignable to and from all types. + +Some examples: + +```TypeScript +var x: any; // Explicitly typed +var y; // Same as y: any +var z: { a; b; }; // Same as z: { a: any; b: any; } + +function f(x) { // Same as f(x: any): void + console.log(x); +} +``` + +## 3.2 Primitive Types + +The primitive types are the Number, Boolean, String, Void, Null, and Undefined types and all user defined enum types. + +### 3.2.1 The Number Type + +The Number primitive type corresponds to the similarly named JavaScript primitive type and represents double-precision 64-bit format IEEE 754 floating point values. + +The `number` keyword references the Number primitive type and numeric literals may be used to write values of the Number primitive type. + +For purposes of determining type relationships (section [3.8](#3.8)) and accessing properties (section [4.10](#4.10)), the Number primitive type behaves as an object type with the same properties as the global interface type ‘Number’. + +Some examples: + +```TypeScript +var x: number; // Explicitly typed +var y = 0; // Same as y: number = 0 +var z = 123.456; // Same as z: number = 123.456 +var s = z.toFixed(2); // Property of Number interface +``` + +### 3.2.2 The Boolean Type + +The Boolean primitive type corresponds to the similarly named JavaScript primitive type and represents logical values that are either true or false. + +The `boolean` keyword references the Boolean primitive type and the `true` and `false` literals reference the two Boolean truth values. + +For purposes of determining type relationships (section [3.8](#3.8)) and accessing properties (section [4.10](#4.10)), the Boolean primitive type behaves as an object type with the same properties as the global interface type ‘Boolean’. + +Some examples: + +```TypeScript +var b: boolean; // Explicitly typed +var yes = true; // Same as yes: boolean = true +var no = false; // Same as no: boolean = false +``` + +### 3.2.3 The String Type + +The String primitive type corresponds to the similarly named JavaScript primitive type and represents sequences of characters stored as Unicode UTF-16 code units. + +The `string` keyword references the String primitive type and string literals may be used to write values of the String primitive type. + +For purposes of determining type relationships (section [3.8](#3.8)) and accessing properties (section [4.10](#4.10)), the String primitive type behaves as an object type with the same properties as the global interface type ‘String’. + +Some examples: + +```TypeScript +var s: string; // Explicitly typed +var empty = ""; // Same as empty: string = "" +var abc = 'abc'; // Same as abc: string = "abc" +var c = abc.charAt(2); // Property of String interface +``` + +### 3.2.4 The Void Type + +The Void type, referenced by the `void` keyword, represents the absence of a value and is used as the return type of functions with no return value. + +The only possible values for the Void type are `null` and `undefined`. The Void type is a subtype of the Any type and a supertype of the Null and Undefined types, but otherwise Void is unrelated to all other types. + +*NOTE: We might consider disallowing declaring variables of type Void as they serve no useful purpose. However, because Void is permitted as a type argument to a generic type or function it is not feasible to disallow Void properties or parameters*. + +### 3.2.5 The Null Type + +The Null type corresponds to the similarly named JavaScript primitive type and is the type of the `null` literal. + +The `null` literal references the one and only value of the Null type. It is not possible to directly reference the Null type itself. + +The Null type is a subtype of all types, except the Undefined type. This means that `null` is considered a valid value for all primitive types, object types, and type parameters, including even the Number and Boolean primitive types. + +Some examples: + +```TypeScript +var n: number = null; // Primitives can be null +var x = null; // Same as x: any = null +var e: Null; // Error, can't reference Null type +``` + +### 3.2.6 The Undefined Type + +The Undefined type corresponds to the similarly named JavaScript primitive type and is the type of the `undefined` literal. + +The `undefined` literal denotes the value given to all uninitialized variables and is the one and only value of the Undefined type. It is not possible to directly reference the Undefined type itself. + +The undefined type is a subtype of all types. This means that `undefined` is considered a valid value for all primitive types, object types, and type parameters. + +Some examples: + +```TypeScript +var n: number; // Same as n: number = undefined +var x = undefined; // Same as x: any = undefined +var e: Undefined; // Error, can't reference Undefined type +``` + +### 3.2.7 Enum Types + +Enum types are distinct user defined subtypes of the Number primitive type. Enum types are declared using enum declarations (section [9.1](#9.1)) and referenced using type references (section [3.6.2](#3.6.2)). + +Enum types are assignable to the Number primitive type, and vice versa, but different enum types are not assignable to each other. + +### 3.2.8 String Literal Types + +Specialized signatures (section [3.7.2.4](#3.7.2.4)) permit string literals to be used as types in parameter type annotations. String literal types are permitted only in that context and nowhere else. + +All string literal types are subtypes of the String primitive type. + +## 3.3 Object Types + +Object types are composed from properties, call signatures, construct signatures, and index signatures, collectively called members. + +Class and interface type references, array types, tuple types, function types, and constructor types are all classified as object types. Multiple constructs in the TypeScript language create object types, including: + +* Object type literals (section [3.6.3](#3.6.3)). +* Array type literals (section [3.6.4](#3.6.4)). +* Tuple type literals (section [3.6.5](#3.6.5)). +* Function type literals (section [3.6.6](#3.6.6)). +* Constructor type literals (section [3.6.7](#3.6.7)). +* Object literals (section [4.5](#4.5)). +* Array literals (section [4.6](#4.6)). +* Function expressions (section [4.9](#4.9)) and function declarations ([6.1](#6.1)). +* Constructor function types created by class declarations (section [8.2.5](#8.2.5)). +* Module instance types created by module declarations (section [10.3](#10.3)). + +### 3.3.1 Named Type References + +Type references (section [3.6.2](#3.6.2)) to class and interface types are classified as object types. Type references to generic class and interface types include type arguments that are substituted for the type parameters of the class or interface to produce an actual object type. + +### 3.3.2 Array Types + +***Array types*** represent JavaScript arrays with a common element type. Array types are named type references created from the generic interface type ‘Array’ in the global module with the array element type as a type argument. Array type literals (section [3.6.4](#3.6.4)) provide a shorthand notation for creating such references. + +The declaration of the ‘Array’ interface includes a property ‘length’ and a numeric index signature for the element type, along with other members: + +```TypeScript +interface Array { + length: number; + [x: number]: T; + // Other members +} +``` + +Array literals (section [4.6](#4.6)) may be used to create values of array types. For example + +```TypeScript +var a: string[] = ["hello", "world"]; +``` + +### 3.3.3 Tuple Types + +***Tuple types*** represent JavaScript arrays with individually tracked element types. Tuple types are written using tuple type literals (section [3.6.5](#3.6.5)). A tuple type combines a set of numerically named properties with the members of an array type. Specifically, a tuple type + +```TypeScript +[ T0, T1, ..., Tn ] +``` + +combines the set of properties + +```TypeScript +{ + 0: T0; + 1: T1; + ... + n: Tn; +} +``` + +with the members of an array type whose element type is the best common type (section [3.10](#3.10)) of the tuple element types. + +Array literals (section [4.6](#4.6)) may be used to create values of tuple types. For example + +```TypeScript +var t: [number, string] = [1, "one"]; +``` + +### 3.3.4 Function Types + +An object type containing one or more call signatures is said to be a ***function type***. Function types may be written using function type literals (section [3.6.6](#3.6.6)) or by including call signatures in object type literals. + +### 3.3.5 Constructor Types + +An object type containing one or more construct signatures is said to be a ***constructor type***. Constructor types may be written using constructor type literals (section [3.6.7](#3.6.7)) or by including construct signatures in object type literals. + +### 3.3.6 Members + +Every object type is composed from zero or more of the following kinds of members: + +* ***Properties***, which define the names and types of the properties of objects of the given type. Property names are unique within their type. +* ***Call signatures***, which define the possible parameter lists and return types associated with applying call operations to objects of the given type. +* ***Construct signatures***, which define the possible parameter lists and return types associated with applying the `new` operator to objects of the given type. +* ***Index signatures***, which define type constraints for properties in the given type. An object type can have at most one string index signature and one numeric index signature. + +Properties are either ***public***, ***private***, or ***protected*** and are either ***required*** or ***optional***: + +* Properties in a class declaration may be designated public, private, or protected, while properties declared in other contexts are always considered public. Private members are only accessible within their declaring class, as described in section [8.2.2](#8.2.2), and private properties match only themselves in subtype and assignment compatibility checks, as described in section [3.8](#3.8). Protected members are only accessible within their declaring class and classes derived from it, as described in section [8.2.2](#8.2.2), and protected properties match only themselves and overrides in subtype and assignment compatibility checks, as described in section [3.8](#3.8). +* Properties in an object type literal or interface declaration may be designated required or optional, while properties declared in other contexts are always considered required. Properties that are optional in the target type of an assignment may be omitted from source objects, as described in section [3.8.4](#3.8.4). + +Call and construct signatures may be ***specialized*** (section [3.7.2.4](#3.7.2.4)) by including parameters with string literal types. Specialized signatures are used to express patterns where specific string values for some parameters cause the types of other parameters or the function result to become further specialized. + +## 3.4 Type Parameters + +A type parameter represents an actual type that the parameter is bound to in a generic type reference or a generic function call. Type parameters have constraints that establish upper bounds for their actual type arguments. + +Since a type parameter represents a multitude of different type arguments, type parameters have certain restrictions compared to other types. In particular, a type parameter cannot be used as a base class or interface. + +### 3.4.1 Type Parameter Lists + +Class, interface, and function declarations may optionally include lists of type parameters enclosed in < and > brackets. Type parameters are also permitted in call signatures of object, function, and constructor type literals. + +  *TypeParameters:* +   `<` *TypeParameterList* `>` + +  *TypeParameterList:* +   *TypeParameter* +   *TypeParameterList* `,` *TypeParameter* + +  *TypeParameter:* +   *Identifier* *Constraintopt* + +  *Constraint:* +   `extends` *Type* + +Type parameter names must be unique. A compile-time error occurs if two or more type parameters in the same *TypeParameterList* have the same name. + +The scope of a type parameter extends over the entire declaration with which the type parameter list is associated, with the exception of static member declarations in classes. + +Each type parameter has an associated type parameter ***constraint*** that establishes an upper bound for type arguments. Omitting a constraint corresponds to specifying the empty object type `{}`. Type parameters declared in a particular type parameter list may not be referenced in constraints in that type parameter list. + +The ***base constraint*** of a type parameter *T* is defined as follows: + +* If *T* has no declared constraint, *T*’s base constraint is the empty object type `{}`. +* If *T*’s declared constraint is a type parameter, *T*’s base constraint is that of the type parameter. +* Otherwise, *T*’s base constraint is *T*’s declared constraint. + +In the example + +```TypeScript +interface G { + f(x: V): V; +} +``` + +the base constraint of ‘T’ is the empty object type, and the base constraint of ‘U’ and ‘V’ is ‘Function’. + +For purposes of determining type relationships (section [3.8](#3.8)), type parameters appear to be subtypes of their base constraint. Likewise, in property accesses (section [4.10](#4.10)), `new` operations (section [4.11](#4.11)), and function calls (section [4.12](#4.12)), type parameters appear to have the members of their base constraint, but no other members. + +### 3.4.2 Type Argument Lists + +A type reference (section [3.6.2](#3.6.2)) to a generic type must include a list of type arguments enclosed in angle brackets and separated by commas. Similarly, a call (section [4.12](#4.12)) to a generic function may explicitly include a type argument list instead of relying on type inference. + +  *TypeArguments:* +   `<` *TypeArgumentList* `>` + +  *TypeArgumentList:* +   *TypeArgument* +   *TypeArgumentList* `,` *TypeArgument* + +  *TypeArgument:* +   *Type* + +Type arguments correspond one-to-one with type parameters of the generic type or function being referenced. A type argument list is required to specify exactly one type argument for each corresponding type parameter, and each type argument is required to ***satisfy*** the constraint of its corresponding type parameter. A type argument satisfies a type parameter constraint if the type argument is assignable to (section [3.8.4](#3.8.4)) the constraint type once type arguments are substituted for type parameters. + +Given the declaration + +```TypeScript +interface G { } +``` + +a type reference of the form ‘G<A, B>’ places no requirements on ‘A’ but requires ‘B’ to be assignable to ‘Function’. + +The process of substituting type arguments for type parameters in a generic type or generic signature is known as ***instantiating*** the generic type or signature. Instantiation of a generic type or signature can fail if the supplied type arguments do not satisfy the constraints of their corresponding type parameters. + +## 3.5 Named Types + +Class, interface, and enum types are ***named types*** that are introduced through class declarations (section [8.1](#8.1)), interface declarations (section [7.1](#7.1)), and enum declarations ([9.1](#9.1)). Class and interface types may have type parameters and are then called ***generic types***. Conversely, named types without type parameters are called ***non-generic types***. + +Interface declarations only introduce named types, whereas class declarations introduce named types *and* constructor functions that create instances of implementations of those named types. The named types introduced by class and interface declarations have only minor differences (classes can’t declare optional members and interfaces can’t declare private or protected members) and are in most contexts interchangeable. In particular, class declarations with only public members introduce named types that function exactly like those created by interface declarations. + +Named types are referenced through ***type references*** (section [3.6.2](#3.6.2)) that specify a type name and, if applicable, the type arguments to be substituted for the type parameters of the named type. + +Named types are technically not types—only *references* to named types are. This distinction is particularly evident with generic types: Generic types are “templates” from which multiple *actual* types can be created by writing type references that supply type arguments to substitute in place of the generic type’s type parameters. This substitution process is known as ***instantiating*** a generic type. Only once a generic type is instantiated does it denote an actual type. + +TypeScript has a structural type system, and therefore an instantiation of a generic type is indistinguishable from an equivalent manually written expansion. For example, given the declaration + +```TypeScript +interface Pair { first: T1; second: T2; } +``` + +the type reference + +```TypeScript +Pair +``` + +is indistinguishable from the type + +```TypeScript +{ first: string; second: Entity; } +``` + +### 3.5.1 Instance Types + +Each named type has an associated actual type known as the ***instance type***. For a non-generic type, the instance type is simply a type reference to the non-generic type. For a generic type, the instance type is an instantiation of the generic type where each of the type arguments is the corresponding type parameter. Since the instance type uses the type parameters it can be used only where the type parameters are in scope—that is, inside the declaration of the generic type. Within the constructor and instance member functions of a class, the type of `this` is the instance type of the class. + +The following example illustrates the concept of an instance type: + +```TypeScript +class G { // Introduce type parameter T + self: G; // Use T as type argument to form instance type + f() { + this.self = this; // self and this are both of type G + } +} +``` + +## 3.6 Specifying Types + +Types are specified either by referencing their keyword or name, or by writing object type literals, array type literals, tuple type literals, function type literals, constructor type literals, or type queries. + +  *Type:* +   *PredefinedType* +   *TypeReference* +   *ObjectType* +   *ArrayType* +   *TupleType* +   *FunctionType* +   *ConstructorType* +   *TypeQuery* + +The different forms of type notations are described in the following sections. + +### 3.6.1 Predefined Types + +The `any`, `number`, `boolean`, `string`, and `void` keywords reference the Any type and the Number, Boolean, String, and Void primitive types respectively. + +  *PredefinedType:* +   `any` +   `number` +   `boolean` +   `string` +   `void` + +The predefined type keywords are reserved and cannot be used as names of user defined types. + +### 3.6.2 Type References + +A type reference references a named type or type parameter through its name and, in the case of a generic type, supplies a type argument list. + +  *TypeReference:* +   *TypeName* *[no LineTerminator here]* *TypeArgumentsopt* + +  *TypeName:* +   *Identifier* +   *ModuleName* `.` *Identifier* + +  *ModuleName:* +   *Identifier* +   *ModuleName* `.` *Identifier* + +A *TypeReference* consists of a *TypeName* that a references a named type or type parameter. A reference to a generic type must be followed by a list of *TypeArguments* (section [3.4.2](#3.4.2)). + +Resolution of a *TypeName* consisting of a single identifier is described in section [2.4](#2.4). + +Resolution of a *TypeName* of the form *M.N*, where *M* is a *ModuleName* and *N* is an *Identifier*, proceeds by first resolving the module name *M*. If the resolution of *M* is successful and the resulting module contains an exported named type *N*, then *M.N* refers to that member. Otherwise, *M.N* is undefined. + +Resolution of a *ModuleName* consisting of a single identifier is described in section [2.4](#2.4). + +Resolution of a *ModuleName* of the form *M.N*, where *M* is a *ModuleName* and *N* is an *Identifier*, proceeds by first resolving the module name *M*. If the resolution of *M* is successful and the resulting module contains an exported module member *N*, then *M.N* refers to that member. Otherwise, *M.N* is undefined. + +A type reference to a generic type is required to specify exactly one type argument for each type parameter of the referenced generic type, and each type argument must be assignable to (section [3.8.4](#3.8.4)) the constraint of the corresponding type parameter or otherwise an error occurs. An example: + +```TypeScript +interface A { a: string; } + +interface B extends A { b: string; } + +interface C extends B { c: string; } + +interface G { + x: T; + y: U; +} + +var v1: G; // Ok +var v2: G<{ a: string }, C>; // Ok, equivalent to G +var v3: G; // Error, A not valid argument for U +var v4: G, C>; // Ok +var v5: G; // Ok +var v6: G; // Error, wrong number of arguments +var v7: G; // Error, no arguments +``` + +A type argument is simply a *Type* and may itself be a type reference to a generic type, as demonstrated by ‘v4’ in the example above. + +As described in section [3.5](#3.5), a type reference to a generic type *G* designates a type wherein all occurrences of *G*’s type parameters have been replaced with the actual type arguments supplied in the type reference. For example, the declaration of ‘v1’ above is equivalent to: + +```TypeScript +var v1: { + x: { a: string; } + y: { a: string; b: string; c: string }; +}; +``` + +### 3.6.3 Object Type Literals + +An object type literal defines an object type by specifying the set of members that are statically considered to be present in instances of the type. Object type literals can be given names using interface declarations but are otherwise anonymous. + +  *ObjectType:* +   `{` *TypeBodyopt* `}` + +  *TypeBody:* +   *TypeMemberList* `;`*opt* + +  *TypeMemberList:* +   *TypeMember* +   *TypeMemberList* `;` *TypeMember* + +  *TypeMember:* +   *PropertySignature* +   *CallSignature* +   *ConstructSignature* +   *IndexSignature* +   *MethodSignature* + +The members of an object type literal are specified as a combination of property, call, construct, index, and method signatures. Object type members are described in section [3.7](#3.7). + +### 3.6.4 Array Type Literals + +An array type literal is written as an element type followed by an open and close square bracket. + +  *ArrayType:* +   *ElementType* *[no LineTerminator here]* `[` `]` + +  *ElementType:* +   *PredefinedType* +   *TypeReference* +   *ObjectType* +   *ArrayType* +   *TupleType* +   *TypeQuery* + +An array type literal references an array type (section [3.3.2](#3.3.2)) with the given element type. An array type literal is simply shorthand notation for a reference to the generic interface type ‘Array’ in the global module with the element type as a type argument. + +In order to avoid grammar ambiguities, array type literals permit only a restricted set of notations for the element type. Specifically, an *ArrayType* cannot start with a *FunctionType* or *ConstructorType*. To use one of those forms for the element type, an array type must be written using the ‘Array<T>’ notation. For example, the type + +```TypeScript +() => string[] +``` + +denotes a function returning a string array, not an array of functions returning string. The latter can be expressed using ‘Array<T>’ notation + +```TypeScript +Array<() => string> +``` + +or by writing the element type as an object type literal + +```TypeScript +{ (): string }[] +``` + +### 3.6.5 Tuple Type Literals + +A tuple type literal is written as a sequence of element types, separated by commas and enclosed in square brackets. + +  *TupleType:* +   `[` *TupleElementTypes* `]` + +  *TupleElementTypes:* +   *TupleElementType* +   *TupleElementTypes* `,` *TupleElementType* + +  *TupleElementType:* +   *Type* + +A tuple type literal references a tuple type (section [3.3.3](#3.3.3)). + +### 3.6.6 Function Type Literals + +A function type literal specifies the type parameters, regular parameters, and return type of a call signature. + +  *FunctionType:* +   *TypeParametersopt* `(` *ParameterListopt* `)` `=>` *Type* + +A function type literal is shorthand for an object type containing a single call signature. Specifically, a function type literal of the form + +```TypeScript +< T1, T2, ... > ( p1, p2, ... ) => R +``` + +is exactly equivalent to the object type literal + +```TypeScript +{ < T1, T2, ... > ( p1, p2, ... ) : R } +``` + +Note that function types with multiple call or construct signatures cannot be written as function type literals but must instead be written as object type literals. + +### 3.6.7 Constructor Type Literals + +A constructor type literal specifies the type parameters, regular parameters, and return type of a construct signature. + +  *ConstructorType:* +   `new` *TypeParametersopt* `(` *ParameterListopt* `)` `=>` *Type* + +A constructor type literal is shorthand for an object type containing a single construct signature. Specifically, a constructor type literal of the form + +```TypeScript +new < T1, T2, ... > ( p1, p2, ... ) => R +``` + +is exactly equivalent to the object type literal + +```TypeScript +{ new < T1, T2, ... > ( p1, p2, ... ) : R } +``` + +Note that constructor types with multiple construct signatures cannot be written as constructor type literals but must instead be written as object type literals. + +### 3.6.8 Type Queries + +A type query obtains the type of an expression. + +  *TypeQuery:* +   `typeof` *TypeQueryExpression* + +  *TypeQueryExpression:* +   *Identifier* +   *TypeQueryExpression* `.` *IdentifierName* + +A type query consists of the keyword `typeof` followed by an expression. The expression is restricted to a single identifier or a sequence of identifiers separated by periods. The expression is processed as an identifier expression (section [4.3](#4.3)) or property access expression (section [4.10](#4.10)), the widened type (section [3.9](#3.9)) of which becomes the result. Similar to other static typing constructs, type queries are erased from the generated JavaScript code and add no run-time overhead. + +Type queries are useful for capturing anonymous types that are generated by various constructs such as object literals, function declarations, and module declarations. For example: + +```TypeScript +var a = { x: 10, y: 20 }; +var b: typeof a; +``` + +Above, ‘b’ is given the same type as ‘a’, namely ‘{ x: number; y: number; }’. + +If a declaration includes a type annotation that references the entity being declared through a circular path of type queries or type references containing type queries, the resulting type is the Any type. For example, all of the following variables are given the type Any: + +```TypeScript +var c: typeof c; +var d: typeof e; +var e: typeof d; +var f: Array; +``` + +However, if a circular path of type queries includes at least one *ObjectType*, *FunctionType* or *ConstructorType*, the construct denotes a recursive type: + +```TypeScript +var g: { x: typeof g; }; +var h: () => typeof h; +``` + +Here, ‘g’ and ‘g.x’ have the same recursive type, and likewise ‘h’ and ‘h()’ have the same recursive type. + +## 3.7 Specifying Members + +The members of an object type literal (section [3.6.3](#3.6.3)) are specified as a combination of property, call, construct, index, and method signatures. + +### 3.7.1 Property Signatures + +A property signature declares the name and type of a property member. + +  *PropertySignature:* +   *PropertyName* `?`*opt* *TypeAnnotationopt* + +  *PropertyName:* +   *IdentifierName* +   *StringLiteral* +   *NumericLiteral* + +The *PropertyName* production, reproduced above from the ECMAScript grammar, permits a property name to be any identifier (including a reserved word), a string literal, or a numeric literal. String literals can be used to give properties names that are not valid identifiers, such as names containing blanks. Numeric literal property names are equivalent to string literal property names with the string representation of the numeric literal, as defined in the ECMAScript specification. + +The *PropertyName* of a property signature must be unique within its containing type. If the property name is followed by a question mark, the property is optional. Otherwise, the property is required. + +If a property signature omits a *TypeAnnotation*, the Any type is assumed. + +### 3.7.2 Call Signatures + +A call signature defines the type parameters, parameter list, and return type associated with applying a call operation (section [4.12](#4.12)) to an instance of the containing type. A type may ***overload*** call operations by defining multiple different call signatures. + +  *CallSignature:* +   *TypeParametersopt* `(` *ParameterListopt* `)` *TypeAnnotationopt* + +A call signature that includes *TypeParameters* (section [3.4.1](#3.4.1)) is called a ***generic call signature***. Conversely, a call signature with no *TypeParameters* is called a non-generic call signature. + +As well as being members of object type literals, call signatures occur in method signatures (section [3.7.5](#3.7.5)), function expressions (section [4.9](#4.9)), and function declarations (section [6.1](#6.1)). + +An object type containing call signatures is said to be a ***function type***. + +#### 3.7.2.1 Type Parameters + +Type parameters (section [3.4.1](#3.4.1)) in call signatures provide a mechanism for expressing the relationships of parameter and return types in call operations. For example, a signature might introduce a type parameter and use it as both a parameter type and a return type, in effect describing a function that returns a value of the same type as its argument. + +Type parameters may be referenced in parameter types and return type annotations, but not in type parameter constraints, of the call signature in which they are introduced. + +Type arguments (section [3.4.2](#3.4.2)) for call signature type parameters may be explicitly specified in a call operation or may, when possible, be inferred (section [4.12.2](#4.12.2)) from the types of the regular arguments in the call. An ***instantiation*** of a generic call signature for a particular set of type arguments is the call signature formed by replacing each type parameter with its corresponding type argument. + +Some examples of call signatures with type parameters follow below. + +A function taking an argument of any type, returning a value of that same type: + +```TypeScript +(x: T): T +``` + +A function taking two values of the same type, returning an array of that type: + +```TypeScript +(x: T, y: T): T[] +``` + +A function taking two arguments of different types, returning an object with properties ‘x’ and ‘y’ of those types: + +```TypeScript +(x: T, y: U): { x: T; y: U; } +``` + +A function taking an array of one type and a function argument, returning an array of another type, where the function argument takes a value of the first array element type and returns a value of the second array element type: + +```TypeScript +(a: T[], f: (x: T) => U): U[] +``` + +#### 3.7.2.2 Parameter List + +A signature’s parameter list consists of zero or more required parameters, followed by zero or more optional parameters, finally followed by an optional rest parameter. + +  *ParameterList:* +   *RequiredParameterList* +   *OptionalParameterList* +   *RestParameter* +   *RequiredParameterList* `,` *OptionalParameterList* +   *RequiredParameterList* `,` *RestParameter* +   *OptionalParameterList* `,` *RestParameter* +   *RequiredParameterList* `,` *OptionalParameterList* `,` *RestParameter* + +  *RequiredParameterList:* +   *RequiredParameter* +   *RequiredParameterList* `,` *RequiredParameter* + +  *RequiredParameter:* +   *AccessibilityModifieropt* *Identifier* *TypeAnnotationopt* +   *Identifier* `:` *StringLiteral* + +  *AccessibilityModifier:* +   `public` +   `private` +   `protected` + +  *OptionalParameterList:* +   *OptionalParameter* +   *OptionalParameterList* `,` *OptionalParameter* + +  *OptionalParameter:* +   *AccessibilityModifieropt* *Identifier* `?` *TypeAnnotationopt* +   *AccessibilityModifieropt* *Identifier* *TypeAnnotationopt* *Initialiser* +   *Identifier* `?` `:` *StringLiteral* + +  *RestParameter:* +   `...` *Identifier* *TypeAnnotationopt* + +Parameter names must be unique. A compile-time error occurs if two or more parameters have the same name. + +A parameter is permitted to include a `public`, `private`, or `protected` modifier only if it occurs in the parameter list of a *ConstructorImplementation* (section [8.3.1](#8.3.1)). + +A parameter with a type annotation is considered to be of that type. A type annotation for a rest parameter must denote an array type. + +A parameter with no type annotation or initializer is considered to be of type `any`, unless it is a rest parameter, in which case it is considered to be of type `any[]`. + +When a parameter type annotation specifies a string literal type, the containing signature is a specialized signature (section [3.7.2.4](#3.7.2.4)). Specialized signatures are not permitted in conjunction with a function body, i.e. the *FunctionExpression*, *FunctionImplementation*, *MemberFunctionImplementation*, and *ConstructorImplementation* grammar productions do not permit parameters with string literal types. + +A parameter can be marked optional by following its name with a question mark (`?`) or by including an initializer. The form that includes an initializer is permitted only in conjunction with a function body, i.e. only in a *FunctionExpression*, *FunctionImplementation*, *MemberFunctionImplementation*, or *ConstructorImplementation* grammar production. + +#### 3.7.2.3 Return Type + +If present, a call signature’s return type annotation specifies the type of the value computed and returned by a call operation. A `void` return type annotation is used to indicate that a function has no return value. + +When a call signature with no return type annotation occurs in a context without a function body, the return type is assumed to be the Any type. + +When a call signature with no return type annotation occurs in a context that has a function body (specifically, a function implementation, a member function implementation, or a member accessor declaration), the return type is inferred from the function body as described in section [6.3](#6.3). + +#### 3.7.2.4 Specialized Signatures + +When a parameter type annotation specifies a string literal type (section [3.2.8](#3.2.8)), the containing signature is considered a specialized signature. Specialized signatures are used to express patterns where specific string values for some parameters cause the types of other parameters or the function result to become further specialized. For example, the declaration + +```TypeScript +interface Document { + createElement(tagName: "div"): HTMLDivElement; + createElement(tagName: "span"): HTMLSpanElement; + createElement(tagName: "canvas"): HTMLCanvasElement; + createElement(tagName: string): HTMLElement; +} +``` + +states that calls to ‘createElement’ with the string literals “div”, “span”, and “canvas” return values of type ‘HTMLDivElement’, ‘HTMLSpanElement’, and ‘HTMLCanvasElement’ respectively, and that calls with all other string expressions return values of type ‘HTMLElement’. + +When writing overloaded declarations such as the one above it is important to list the non-specialized signature last. This is because overload resolution (section [4.12.1](#4.12.1)) processes the candidates in declaration order and picks the first one that matches. + +Every specialized call or construct signature in an object type must be assignable to at least one non-specialized call or construct signature in the same object type (where a call signature *A* is considered assignable to another call signature *B* if an object type containing only *A* would be assignable to an object type containing only *B*). For example, the ‘createElement’ property in the example above is of a type that contains three specialized signatures, all of which are assignable to the non-specialized signature in the type. + +### 3.7.3 Construct Signatures + +A construct signature defines the parameter list and return type associated with applying the `new` operator (section [4.11](#4.11)) to an instance of the containing type. A type may overload `new` operations by defining multiple construct signatures with different parameter lists. + +  *ConstructSignature:* +   `new` *TypeParametersopt* `(` *ParameterListopt* `)` *TypeAnnotationopt* + +The type parameters, parameter list, and return type of a construct signature are subject to the same rules as a call signature. + +A type containing construct signatures is said to be a ***constructor type***. + +### 3.7.4 Index Signatures + +An index signature defines a type constraint for properties in the containing type. + +  *IndexSignature:* +   `[` *Identifier* `:` `string` `]` *TypeAnnotation* +   `[` *Identifier* `:` `number` `]` *TypeAnnotation* + +There are two kinds of index signatures: + +* ***String index signatures***, specified using index type `string`, define type constraints for all properties and numeric index signatures in the containing type. Specifically, in a type with a string index signature of type *T*, all properties and numeric index signatures must have types that are assignable to *T*. +* ***Numeric index signatures***, specified using index type `number`, define type constraints for all numerically named properties in the containing type. Specifically, in a type with a numeric index signature of type *T*, all numerically named properties must have types that are assignable to *T*. + +A ***numerically named property*** is a property whose name is a valid numeric literal. Specifically, a property with a name *N* for which ToNumber(*N*) is not NaN, where ToNumber is the abstract operation defined in ECMAScript specification. + +An object type can contain at most one string index signature and one numeric index signature. + +Index signatures affect the determination of the type that results from applying a bracket notation property access to an instance of the containing type, as described in section [4.10](#4.10). + +### 3.7.5 Method Signatures + +A method signature is shorthand for declaring a property of a function type. + +  *MethodSignature:* +   *PropertyName* `?`*opt* *CallSignature* + +If the identifier is followed by a question mark, the property is optional. Otherwise, the property is required. Only object type literals and interfaces can declare optional properties. + +A method signature of the form + +```TypeScript +f < T1, T2, ... > ( p1, p2, ... ) : R +``` + +is equivalent to the property declaration + +```TypeScript +f : { < T1, T2, ... > ( p1, p2, ... ) : R } +``` + +A literal type may ***overload*** a method by declaring multiple method signatures with the same name but differing parameter lists. Overloads must either all be required (question mark omitted) or all be optional (question mark included). A set of overloaded method signatures correspond to a declaration of a single property with a type composed from an equivalent set of call signatures. Specifically + +```TypeScript +f < T1, T2, ... > ( p1, p2, ... ) : R ; +f < U1, U2, ... > ( q1, q2, ... ) : S ; +... +``` + +is equivalent to + +```TypeScript +f : { + < T1, T2, ... > ( p1, p2, ... ) : R ; + < U1, U2, ... > ( q1, q2, ... ) : S ; + ... +} ; +``` + +In the following example of an object type + +```TypeScript +{ + func1(x: number): number; // Method signature + func2: (x: number) => number; // Function type literal + func3: { (x: number): number }; // Object type literal +} +``` + +the properties ‘func1’, ‘func2’, and ‘func3’ are all of the same type, namely an object type with a single call signature taking a number and returning a number. Likewise, in the object type + +```TypeScript +{ + func4(x: number): number; + func4(s: string): string; + func5: { + (x: number): number; + (s: string): string; + }; +} +``` + +the properties ‘func4’ and ‘func5’ are of the same type, namely an object type with two call signatures taking and returning number and string respectively. + +## 3.8 Type Relationships + +Types in TypeScript have identity, subtype, supertype, and assignment compatibility relationships as defined in the following sections. + +For purposes of determining type relationships, all object types appear to have the members of the ‘Object’ interface unless those members are hidden by members with the same name in the object types, and object types with one or more call or construct signatures appear to have the members of the ‘Function’ interface unless those members are hidden by members with the same name in the object types. Apparent types (section [3.8.1](#3.8.1)) that are object types appear to have these extra members as well. + +### 3.8.1 Apparent Type + +In certain contexts a type appears to have the characteristics of a related type called the type’s ***apparent type***. Specifically, a type’s apparent type is used when determining subtype, supertype, and assignment compatibility relationships, as well as in the type checking of property accesses (section [4.10](#4.10)), `new` operations (section [4.11](#4.11)), and function calls (section [4.12](#4.12)). + +The apparent type of a type *T* is defined as follows: + +* If *T* is the primitive type Number, Boolean, or String, the apparent type of *T* is the augmented form (as defined below) of the global interface type ‘Number’, ‘Boolean’, or ‘String’. +* if *T* is an enum type, the apparent type of *T* is the augmented form of the global interface type ‘Number’. +* If *T* is an object type, the apparent type of *T* is the augmented form of *T*. +* If *T* is a type parameter, the apparent type of *T* is the apparent type of *T*’s base constraint (section [3.4.1](#3.4.1)). +* Otherwise, the apparent type of *T* is *T* itself. + +The augmented form of an object type *T* adds to *T* those properties of the global interface type ‘Object’ that aren’t hidden by properties in *T*. Furthermore, if *T* has one or more call or construct signatures, the augmented form of *T* adds to *T* the properties of the global interface type ‘Function’ that aren’t hidden by properties in *T*. Properties in *T* hide ‘Object’ or ‘Function’ interface properties with the same name. + +In effect, a type’s apparent type is a subtype of the ‘Object’ or ‘Function’ interface unless the type defines members that are incompatible with those of the ‘Object’ or ‘Function’ interface—which, for example, occurs if the type defines a property with the same name as a property in the ‘Object’ or ‘Function’ interface but with a type that isn’t a subtype of that in the ‘Object’ or ‘Function’ interface. + +Some examples: + +```TypeScript +var o: Object = { x: 10, y: 20 }; // Ok +var f: Function = (x: number) => x * x; // Ok +var err: Object = { toString: 0 }; // Error +``` + +The last assignment is an error because the apparent type of the object literal has a ‘toString’ method that isn’t compatible with that of ‘Object’. + +### 3.8.2 Type and Member Identity + +Two types are considered ***identical*** when + +* they are both the Any type, +* they are the same primitive type, +* they are the same type parameter, or +* they are object types with identical sets of members. + +Two members are considered identical when + +* they are public properties with identical names, optionality, and types, +* they are private or protected properties originating in the same declaration and having identical types, +* they are identical call signatures, +* they are identical construct signatures, or +* they are index signatures of identical kind with identical types. + +Two call or construct signatures are considered identical when they have the same number of type parameters with identical type parameter constraints and, after substituting type Any for the type parameters introduced by the signatures, identical number of parameters with identical kind (required, optional or rest) and types, and identical return types. + +Note that, except for primitive types and classes with private or protected members, it is structure, not naming, of types that determines identity. Also, note that parameter names are not significant when determining identity of signatures. + +Private and protected properties match only if they originate in the same declaration and have identical types. Two distinct types might contain properties that originate in the same declaration if the types are separate parameterized references to the same generic class. In the example + +```TypeScript +class C { private x: T; } + +interface X { f(): string; } + +interface Y { f(): string; } + +var a: C; +var b: C; +``` + +the variables ‘a’ and ‘b’ are of identical types because the two type references to ‘C’ create types with a private member ‘x’ that originates in the same declaration, and because the two private ‘x’ members have types with identical sets of members once the type arguments ‘X’ and ‘Y’ are substituted. + +### 3.8.3 Subtypes and Supertypes + +*S* is a ***subtype*** of a type *T*, and *T* is a ***supertype*** of *S*, if one of the following is true, where *S*’ denotes the apparent type (section [3.8.1](#3.8.1)) of *S*: + +* *S* and *T* are identical types. +* *T* is the Any type. +* *S* is the Undefined type. +* *S* is the Null type and *T* is not the Undefined type. +* *S* is an enum type and *T* is the primitive type Number. +* *S* is a string literal type and *T* is the primitive type String. +* *S* and *T* are type parameters, and *S* is directly or indirectly constrained to *T*. +* *S’* and *T* are object types and, for each member *M* in *T*, one of the following is true: + * *M* is a property and *S’* contains a property *N* where + * *M* and *N* have the same name, + * the type of *N* is a subtype of that of *M*, + * if *M* is a required property, *N* is also a required property, and + * *M* and *N* are both public, *M* and *N* are both private and originate in the same declaration, *M* and *N* are both protected and originate in the same declaration, or *M* is protected and *N* is declared in a class derived from the class in which *M* is declared. + * *M* is an optional property and *S’* contains no property of the same name as *M*. + * *M* is a non-specialized call or construct signature and *S*’ contains a call or construct signature *N* where, when *M* and *N* are instantiated using type Any as the type argument for all type parameters declared by *M* and *N* (if any), + * the signatures are of the same kind (call or construct), + * *M* has a rest parameter or the number of non-optional parameters in *N* is less than or equal to the total number of parameters in *M*, + * for parameter positions that are present in both signatures, each parameter type in *N* is a subtype or supertype of the corresponding parameter type in *M*, and + * the result type of *M* is Void, or the result type of *N* is a subtype of that of *M*. + * *M* is a string index signature of type *U* and *S’* contains a string index signature of a type that is a subtype of *U*. + * *M* is a numeric index signature of type *U* and *S’* contains a string or numeric index signature of a type that is a subtype of *U*. + +When comparing call or construct signatures, parameter names are ignored and rest parameters correspond to an unbounded expansion of optional parameters of the rest parameter element type. + +Note that specialized call and construct signatures (section [3.7.2.4](#3.7.2.4)) are not significant when determining subtype and supertype relationships. + +Also note that type parameters are not considered object types. Thus, the only subtypes of a type parameter *T* are *T* itself and other type parameters that are directly or indirectly constrained to *T*. + +### 3.8.4 Assignment Compatibility + +Types are required to be assignment compatible in certain circumstances, such as expression and variable types in assignment statements and argument and parameter types in function calls. + +*S* is ***assignable to*** a type *T*, and *T* is ***assignable from*** *S*, if one of the following is true, where *S*’ denotes the apparent type (section [3.8.1](#3.8.1)) of *S*: + +* *S* and *T* are identical types. +* *S* or *T* is the Any type. +* *S* is the Undefined type. +* *S* is the Null type and *T* is not the Undefined type. +* *S* or *T* is an enum type and* *the other is the primitive type Number. +* *S* is a string literal type and *T* is the primitive type String. +* *S* and *T* are type parameters, and *S* is directly or indirectly constrained to *T*. +* *S’* and *T* are object types and, for each member *M* in *T*, one of the following is true: + * *M* is a property and *S’* contains a property *N* where + * *M* and *N* have the same name, + * the type of *N* is assignable to that of *M*, + * if *M* is a required property, *N* is also a required property, and + * *M* and *N* are both public, *M* and *N* are both private and originate in the same declaration, *M* and *N* are both protected and originate in the same declaration, or *M* is protected and *N* is declared in a class derived from the class in which *M* is declared. + * *M* is an optional property and *S’* contains no property of the same name as *M*. + * *M* is a non-specialized call or construct signature and *S*’ contains a call or construct signature *N* where, when *M* and *N* are instantiated using type Any as the type argument for all type parameters declared by *M* and *N* (if any), + * the signatures are of the same kind (call or construct), + * *M* has a rest parameter or the number of non-optional parameters in *N* is less than or equal to the total number of parameters in *M*, + * for parameter positions that are present in both signatures, each parameter type in *N* is assignable to or from the corresponding parameter type in *M*, and + * the result type of *M* is Void, or the result type of *N* is assignable to that of *M*. + * *M* is a string index signature of type *U* and *S’* contains a string index signature of a type that is assignable to *U*. + * *M* is a numeric index signature of type *U* and *S’* contains a string or numeric index signature of a type that is assignable to *U*. + +When comparing call or construct signatures, parameter names are ignored and rest parameters correspond to an unbounded expansion of optional parameters of the rest parameter element type. + +Note that specialized call and construct signatures (section [3.7.2.4](#3.7.2.4)) are not significant when determining assignment compatibility. + +The assignment compatibility and subtyping rules differ only in that + +* the Any type is assignable to, but not a subtype of, all types, and +* the primitive type Number is assignable to, but not a subtype of, all enum types. + +The assignment compatibility rules imply that, when assigning values or passing parameters, optional properties must either be present and of a compatible type, or not be present at all. For example: + +```TypeScript +function foo(x: { id: number; name?: string; }) { } + +foo({ id: 1234 }); // Ok +foo({ id: 1234, name: "hello" }); // Ok +foo({ id: 1234, name: false }); // Error, name of wrong type +foo({ name: "hello" }); // Error, id required but missing +``` + +### 3.8.5 Contextual Signature Instantiation + +During type argument inference in a function call (section [4.12.2](#4.12.2)) it is in certain circumstances necessary to instantiate a generic call signature of an argument expression in the context of a non-generic call signature of a parameter such that further inferences can be made. A generic call signature *A* is ***instantiated in the context of*** non-generic call signature *B* as follows: + +* Using the process described in [3.8.6](#3.8.6), inferences for *A*’s type parameters are made from each parameter type in *B* to the corresponding parameter type in *A* for those parameter positions that are present in both signatures, where rest parameters correspond to an unbounded expansion of optional parameters of the rest parameter element type. +* The inferred type argument for each type parameter is the best common type (section [3.10](#3.10)) of the set of inferences made for that type parameter. However, if the best common type does not satisfy the constraint of the type parameter, the inferred type argument is instead the constraint. + +### 3.8.6 Type Inference + +In certain contexts, inferences for a given set of type parameters are made *from* a type *S*, in which those type parameters do not occur, *to* another type *T*, in which those type parameters do occur. Inferences consist of a set of candidate type arguments collected for each of the type parameters. The inference process recursively relates *S* and *T* to gather as many inferences as possible: + +* If *T* is one of the type parameters for which inferences are being made, *S* is added to the set of inferences for that type parameter. +* Otherwise, if *S* and *T* are object types, then for each member *M* in *T*: + * If *M* is a property and *S* contains a property *N* with the same name as *M*, inferences are made from the type of *N* to the type of *M*. + * If *M* is a call signature and a corresponding call signature *N* exists in *S*, *N* is instantiated with the Any type as an argument for each type parameter (if any) and inferences are made from parameter types in *N* to the corresponding parameter types in *M* for positions that are present in both signatures, and from the return type of *N* to the return type of *M*. + * If *M* is a construct signature and a corresponding construct signature *N* exists in *S*, *N* is instantiated with the Any type as an argument for each type parameter (if any) and inferences are made from parameter types in *N* to the corresponding parameter types in *M* for positions that are present in both signatures, and from the return type of *N* to the return type of *M*. + * If *M* is a string index signature and *S* contains a string index signature *N*, inferences are made from the type of *N* to the type of *M*. + * If *M* is a numeric index signature and *S* contains a numeric index signature *N*, inferences are made from the type of *N* to the type of *M*. + * If *M* is a numeric index signature and *S* contains a string index signature *N*, inferences are made from the type of *N* to the type of *M*. + +When comparing call or construct signatures, signatures in *S* correspond to signatures of the same kind in *T* pairwise in declaration order. If *S* and *T* have different numbers of a given kind of signature, the excess *first* signatures in declaration order of the longer list are ignored. + +### 3.8.7 Recursive Types + +Classes and interfaces can reference themselves in their internal structure, in effect creating recursive types with infinite nesting. For example, the type + +```TypeScript +interface A { next: A; } +``` + +contains an infinitely nested sequence of ‘next’ properties. Types such as this are perfectly valid but require special treatment when determining type relationships. Specifically, when comparing types *S* and *T* for a given relationship (identity, subtype, or assignability), the relationship in question is assumed to be true for every directly or indirectly nested occurrence of the same *S* and the same *T* (where same means originating in the same declaration and, if applicable, having identical type arguments). For example, consider the identity relationship between ‘A’ above and ‘B’ below: + +```TypeScript +interface B { next: C; } + +interface C { next: D; } + +interface D { next: B; } +``` + +To determine whether ‘A’ and ‘B’ are identical, first the ‘next’ properties of type ‘A’ and ‘C’ are compared. That leads to comparing the ‘next’ properties of type ‘A’ and ‘D’, which leads to comparing the ‘next’ properties of type ‘A’ and ‘B’. Since ‘A’ and ‘B’ are already being compared this relationship is by definition true. That in turn causes the other comparisons to be true, and therefore the final result is true. + +When this same technique is used to compare generic type references, two type references are considered the same when they originate in the same declaration and have identical type arguments. + +In certain circumstances, generic types that directly or indirectly reference themselves in a recursive fashion can lead to infinite series of distinct instantiations. For example, in the type + +```TypeScript +interface List { + data: T; + next: List; + owner: List>; +} +``` + +‘List<T>’ has a member ‘owner’ of type ‘List<List<T>>’, which has a member ‘owner’ of type ‘List<List<List<T>>>’, which has a member ‘owner’ of type ‘List<List<List<List<T>>>>’ and so on, ad infinitum. Since type relationships are determined structurally, possibly exploring the constituent types to their full depth, in order to determine type relationships involving infinitely expanding generic types it may be necessary for the compiler to terminate the recursion at some point with the assumption that no further exploration will change the outcome. + +## 3.9 Widened Types + +In several situations TypeScript infers types from context, alleviating the need for the programmer to explicitly specify types that appear obvious. For example + +```TypeScript +var name = "Steve"; +``` + +infers the type of ‘name’ to be the String primitive type since that is the type of the value used to initialize it. When inferring the type of a variable, property or function result from an expression, the ***widened*** form of the source type is used as the inferred type of the target. The widened form of a type is the type in which all occurrences of the Null and Undefined types have been replaced with the type `any`. + +The following example shows the results of widening types to produce inferred variable types. + +```TypeScript +var a = null; // var a: any +var b = undefined; // var b: any +var c = { x: 0, y: null }; // var c: { x: number, y: any } +var d = [ null, undefined ]; // var d: any[] +``` + +## 3.10 Best Common Type + +In several situations a ***best common type*** needs to be inferred from a set of types. In particular, return types of functions with multiple return statements and element types of array literals are found this way. The determination of a best common type may in some cases factor in a contextual type. + +Given a set of types { *T1*, *T2*, …, *Tn* } and a contextual type *C*, the best common type is determined as follows: + +* If the set of types is empty, the best common type is *C*. +* Otherwise, if C is a supertype of every *Tn*, the best common type is C. +* Otherwise, if one exists, the first *Tx* that is a supertype of every *Tn* is the best common type. +* Otherwise, the best common type is an empty object type (the type `{}`). + +Given a set of types { *T1*, *T2*, …, *Tn* } and no contextual type, the best common type is determined as follows: + +* If the set of types is empty, the best common type is an empty object type. +* Otherwise, if one exists, the first *Tx* that is a supertype of every *Tn* is the best common type. +* Otherwise, the best common type is an empty object type (the type `{}`). + +
+ +#
4 Expressions + +This chapter describes the manner in which TypeScript provides type inference and type checking for JavaScript expressions. TypeScript’s type analysis occurs entirely at compile-time and adds no run-time overhead to expression evaluation. + +TypeScript’s typing rules define a type for every expression construct. For example, the type of the literal 123 is the Number primitive type, and the type of the object literal { a: 10, b: "hello" } is { a: number; b: string; }. The sections in this chapter describe these rules in detail. + +In addition to type inference and type checking, TypeScript augments JavaScript expressions with the following constructs: + +* Optional parameter and return type annotations in function expressions. +* Default parameter values and rest parameters in function expressions. +* Arrow function expressions. +* Super calls and member access. +* Type assertions. + +Unless otherwise noted in the sections that follow, TypeScript expressions and the JavaScript expressions generated from them are identical. + +## 4.1 Values and References + +Expressions are classified as ***values*** or ***references***. References are the subset of expressions that are permitted as the target of an assignment. Specifically, references are combinations of identifiers (section [4.3](#4.3)), parentheses (section [4.7](#4.7)), and property accesses (section [4.10](#4.10)). All other expression constructs described in this chapter are classified as values. + +## 4.2 The this Keyword + +The type of `this` in an expression depends on the location in which the reference takes place: + +* In a constructor, instance member function, instance member accessor, or instance member variable initializer, `this` is of the class instance type of the containing class. +* In a static member function or static member accessor, the type of `this` is the constructor function type of the containing class. +* In a function declaration or a standard function expression, `this` is of type Any. +* In the global module, `this` is of type Any. + +In all other contexts it is a compile-time error to reference `this`. + +In the body of an arrow function expression, references to `this` are rewritten in the generated JavaScript code, as described in section [4.9.2](#4.9.2). + +## 4.3 Identifiers + +When an expression is an *Identifier*, the expression refers to the most nested module, class, enum, function, variable, or parameter with that name whose scope (section [2.4](#2.4)) includes the location of the reference. The type of such an expression is the type associated with the referenced entity: + +* For a module, the object type associated with the module instance. +* For a class, the constructor type associated with the constructor function object. +* For an enum, the object type associated with the enum object. +* For a function, the function type associated with the function object. +* For a variable, the type of the variable. +* For a parameter, the type of the parameter. + +An identifier expression that references a variable or parameter is classified as a reference. An identifier expression that references any other kind of entity is classified as a value (and therefore cannot be the target of an assignment). + +## 4.4 Literals + +Literals are typed as follows: + +* The type of the `null` literal is the Null primitive type. +* The type of the literals `true` and `false` is the Boolean primitive type. +* The type of numeric literals is the Number primitive type. +* The type of string literals is the String primitive type. +* The type of regular expression literals is the global interface type ‘RegExp’. + +## 4.5 Object Literals + +Object literals are extended to support type annotations in get and set accessors. + +  *PropertyAssignment:* *( Modified )* +   *PropertyName* `:` *AssignmentExpression* +   *PropertyName* *CallSignature* `{` *FunctionBody* `}` +   *GetAccessor* +   *SetAccessor* + +  *GetAccessor:* +   `get` *PropertyName* `(` `)` *TypeAnnotationopt* `{` *FunctionBody* `}` + +  *SetAccessor:* +   `set` *PropertyName* `(` *Identifier* *TypeAnnotationopt* `)` `{` *FunctionBody* `}` + +The type of an object literal is an object type with the set of properties specified by the property assignments in the object literal. A get and set accessor may specify the same property name, but otherwise it is an error to specify multiple property assignments for the same property. + +A property assignment of the form + +```TypeScript +f ( ... ) { ... } +``` + +is simply shorthand for + +```TypeScript +f : function ( ... ) { ... } +``` + +Each property assignment in an object literal is processed as follows: + +* If the object literal is contextually typed and the contextual type contains a property with a matching name, the property assignment is contextually typed by the type of that property. +* Otherwise, if the object literal is contextually typed, the contextual type contains a numeric index signature, and the property assignment specifies a numeric property name, the property assignment is contextually typed by the type of the numeric index signature. +* Otherwise, if the object literal is contextually typed and the contextual type contains a string index signature, the property assignment is contextually typed by the type of the string index signature. +* Otherwise, the property assignment is processed without a contextual type. + +The type of a property introduced by a property assignment of the form *Name* `:` *Expr* is the type of *Expr*. + +A get accessor declaration is processed in the same manner as an ordinary function declaration (section [6.1](#6.1)) with no parameters. A set accessor declaration is processed in the same manner as an ordinary function declaration with a single parameter and a Void return type. When both a get and set accessor is declared for a property: + +* If both accessors include type annotations, the specified types must be identical. +* If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. +* If neither accessor includes a type annotation, the inferred return type of the get accessor becomes the parameter type of the set accessor. + +If a get accessor is declared for a property, the return type of the get accessor becomes the type of the property. If only a set accessor is declared for a property, the parameter type (which may be type Any if no type annotation is present) of the set accessor becomes the type of the property. + +When an object literal is contextually typed by a type that includes a string index signature of type *T*, the resulting type of the object literal includes a string index signature with the widened form of the best common type of the contextual type *T* and the types of the properties declared in the object literal. Likewise, when an object literal is contextually typed by a type that includes a numeric index signature of type *T*, the resulting type of the object literal includes a numeric index signature with the widened form of the best common type of the contextual type *T* and the types of the numerically named properties (section [3.7.4](#3.7.4)) declared in the object literal. + +## 4.6 Array Literals + +An array literal + +```TypeScript +[expr1, expr2, ..., exprN] +``` + +denotes a value of an array type (section [3.3.2](#3.3.2)) or a tuple type (section [3.3.3](#3.3.3)) depending on context. + +Each element expression in a non-empty array literal is processed as follows: + +* If the array literal is contextually typed (section [4.19](#4.19)) by a type *T* and *T* has a property with the numeric name *N*, where *N* is the index of the element expression in the array literal, the element expression is contextually typed by the type of that property. +* Otherwise, if the array literal is contextually typed by a type *T* with a numeric index signature, the element expression is contextually typed by the type of the numeric index signature. +* Otherwise, the element expression is not contextually typed. + +The resulting type of a non-empty array literal expression is determined as follows: + +* If the array literal is contextually typed by a type *T* and *T* has at least one property with a numeric name that matches the index of an element expression in the array literal, the resulting type is a tuple type constructed from the types of the element expressions. +* Otherwise, if the array literal is contextually typed by a type T with a numeric index signature of type *S*, the resulting type is an array type where the element type is the best common type of the contextual type *S* and the types of the element expressions. +* Otherwise, if the array literal is not contextually typed, the resulting type is an array type where the element type is the best common type of the types of the element expressions. + +The resulting type of an empty array literal expression is determined as follows: + +* If the array literal is contextually typed by a type *T* with a numeric index signature of type *S*, the resulting type is an array type with element type *S*. +* Otherwise, the resulting type is an array type with the element type Undefined. + +The rules above mean that an array literal is always of an array type, unless it is contextually typed by a type with numerically named properties (such as a tuple type). For example + +```TypeScript +var a = [1, 2]; // number[] +var b = ["hello", true]; // {}[] +var c: [number, string] = [3, "three"]; // [number, string] +``` + +## 4.7 Parentheses + +A parenthesized expression + +```TypeScript +( expr ) +``` + +has the same type and classification as the contained expression itself. Specifically, if the contained expression is classified as a reference, so is the parenthesized expression. + +## 4.8 The super Keyword + +The `super` keyword can be used in expressions to reference base class properties and the base class constructor. + +  *CallExpression:* *( Modified )* +   … +   `super` `(` *ArgumentListopt* `)` +   `super` `.` *IdentifierName* + +### 4.8.1 Super Calls + +Super calls consist of the keyword `super` followed by an argument list enclosed in parentheses. Super calls are only permitted in constructors of derived classes, as described in section [8.3.2](#8.3.2). + +A super call invokes the constructor of the base class on the instance referenced by `this`. A super call is processed as a function call (section [4.12](#4.12)) using the construct signatures of the base class constructor function type as the initial set of candidate signatures for overload resolution. Type arguments cannot be explicitly specified in a super call. If the base class is a generic class, the type arguments used to process a super call are always those specified in the `extends` clause that references the base class. + +The type of a super call expression is Void. + +The JavaScript code generated for a super call is specified in section [8.6.2](#8.6.2). + +### 4.8.2 Super Property Access + +A super property access consists of the keyword `super` followed by a dot and an identifier. Super property accesses are used to access base class member functions from derived classes and are permitted in contexts where `this` (section [4.2](#4.2)) references a derived class instance or a derived class constructor function. Specifically: + +* In a constructor, instance member function, instance member accessor, or instance member variable initializer where `this` references a derived class instance, a super property access is permitted and must specify a public instance member function of the base class. +* In a static member function or static member accessor where `this` references the constructor function object of a derived class, a super property access is permitted and must specify a public static member function of the base class. + +Super property accesses are not permitted in other contexts, and it is not possible to access other kinds of base class members in a super property access. Note that super property accesses are not permitted inside standard function expressions nested in the above constructs because `this` is of type Any in such function expressions. + +Super property accesses are typically used to access overridden base class member functions from derived class member functions. For an example of this, see section [8.4.2](#8.4.2). + +The JavaScript code generated for a super property access is specified in section [8.6.2](#8.6.2). + +## 4.9 Function Expressions + +Function expressions are extended from JavaScript to optionally include parameter and return type annotations, and a new compact form, called arrow function expressions, is introduced. + +  *FunctionExpression:* *( Modified )* +   `function` *Identifieropt* *CallSignature* `{` *FunctionBody* `}` + +  *AssignmentExpression:* *( Modified )* +   … +   *ArrowFunctionExpression* + +  *ArrowFunctionExpression:* +   *ArrowFormalParameters* `=>` *Block* +   *ArrowFormalParameters* `=>` *AssignmentExpression* + +  *ArrowFormalParameters:* +   *CallSignature* +   *Identifier* + +The terms ***standard function expression*** and ***arrow function expression*** are used to refer to the *FunctionExpression* and *ArrowFunctionExpression* forms respectively. When referring to either, the generic term ***function expression*** is used. + +The type of a function expression is an object type containing a single call signature with parameter and return types inferred from the function expression’s signature and body. + +The descriptions of function declarations provided in section [6.1](#6.1) apply to function expressions as well, except that function expressions do not support overloading. + +### 4.9.1 Standard Function Expressions + +Standard function expressions are function expressions written with the `function` keyword. The type of `this` in a standard function expression is the Any type. + +Standard function expressions are transformed to JavaScript in the same manner as function declarations (see section [6.5](#6.5)). + +### 4.9.2 Arrow Function Expressions + +TypeScript supports ***arrow function expressions***, a new feature planned for ECMAScript 6. Arrow function expressions are a compact form of function expressions that omit the `function` keyword and have lexical scoping of `this`. + +An arrow function expression of the form + +```TypeScript +( ... ) => expr +``` + +is exactly equivalent to + +```TypeScript +( ... ) => { return expr ; } +``` + +Furthermore, arrow function expressions of the forms + +```TypeScript +id => { ... } +id => expr +``` + +are exactly equivalent to + +```TypeScript +( id ) => { ... } +( id ) => expr +``` + +Thus, the following examples are all equivalent: + +```TypeScript +(x) => { return Math.sin(x); } +(x) => Math.sin(x) +x => { return Math.sin(x); } +x => Math.sin(x) +``` + +A function expression using the `function` keyword introduces a new dynamically bound `this`, whereas an arrow function expression preserves the `this` of its enclosing context. Arrow function expressions are particularly useful for writing callbacks, which otherwise often have an undefined or unexpected `this`. + +In the example + +```TypeScript +class Messenger { + message = "Hello World"; + start() { + setTimeout(() => alert(this.message), 3000); + } +}; + +var messenger = new Messenger(); +messenger.start(); +``` + +the use of an arrow function expression causes the callback to have the same `this` as the surrounding ‘start’ method. Writing the callback as a standard function expression it becomes necessary to manually arrange access to the surrounding `this`, for example by copying it into a local variable: + +```TypeScript +class Messenger { + message = "Hello World"; + start() { + var _this = this; + setTimeout(function() { alert(_this.message); }, 3000); + } +}; + +var messenger = new Messenger(); +messenger.start(); +``` + +The TypeScript compiler applies this type of transformation to rewrite arrow function expressions into standard function expressions. + +A construct of the form + +```TypeScript +< T > ( ... ) => { ... } +``` + +could be parsed as an arrow function expression with a type parameter or a type assertion applied to an arrow function with no type parameter. It is resolved as the former, but parentheses can be used to select the latter meaning: + +```TypeScript +< T > ( ( ... ) => { ... } ) +``` + +### 4.9.3 Contextually Typed Function Expressions + +Function expressions with no type parameters and no parameter type annotations (but possibly with optional parameters and default parameter values) are contextually typed in certain circumstances, as described in section [4.19](#4.19). + +When a function expression is contextually typed by a function type *T*, the function expression is processed as if it had explicitly specified parameter type annotations as they exist in *T*. Parameters are matched by position and need not have matching names. If the function expression has fewer parameters than *T*, the additional parameters in *T* are ignored. If the function expression has more parameters than *T*, the additional parameters are all considered to have type Any. + +Furthermore, when a function expression has no return type annotation and is contextually typed by a function type *T*, expressions in contained return statements (section [5.7](#5.7)) are contextually typed by *T*’s return type. + +## 4.10 Property Access + +A property access uses either dot notation or bracket notation. A property access expression is always classified as a reference. + +A property access uses an object’s apparent type (section [3.8.1](#3.8.1)) to determine its properties. Furthermore, in a property access, an object’s apparent type includes the properties that originate in the ‘Object’ or ‘Function’ global interface types, as described in section [3.3](#3.3). + +A dot notation property access of the form + +```TypeScript +object . name +``` + +where *object* is an expression and *name* is an identifier (including, possibly, a reserved word), is used to access the property with the given name on the given object. A dot notation property access is processed as follows at compile-time: + +* If *object* is of type Any, any *name* is permitted and the property access is of type Any. +* Otherwise, if *name* denotes an accessible property member in the apparent type of *object*, the property access is of the type of that property. Public members are always accessible, but private and protected members of a class have restricted accessibility, as described in [8.2.2](#8.2.2). +* Otherwise, the property access is invalid and a compile-time error occurs. + +A bracket notation property access of the form + +```TypeScript +object [ index ] +``` + +where *object* and *index* are expressions, is used to access the property with the name computed by the index expression on the given object. A bracket notation property access is processed as follows at compile-time: + +* If *index* is a string literal or a numeric literal and *object*’s apparent type has a property with the name given by that literal (converted to its string representation in the case of a numeric literal), the property access is of the type of that property. +* Otherwise, if *object*’s apparent type has a numeric index signature and *index* is of type Any, the Number primitive type, or an enum type, the property access is of the type of that index signature. +* Otherwise, if *object*’s apparent type has a string index signature and *index* is of type Any, the String or Number primitive type, or an enum type, the property access is of the type of that index signature. +* Otherwise, if *index* is of type Any, the String or Number primitive type, or an enum type, the property access is of type Any. +* Otherwise, the property access is invalid and a compile-time error occurs. + +The rules above mean that properties are strongly typed when accessed using bracket notation with the literal representation of their name. For example: + +```TypeScript +var type = { + name: "boolean", + primitive: true +}; + +var s = type["name"]; // string +var b = type["primitive"]; // boolean +``` + +Tuple types assign numeric names to each of their elements and elements are therefore strongly typed when accessed using bracket notation with a numeric literal: + +```TypeScript +var data: [string, number] = ["five", 5]; +var s = data[0]; // string +var n = data[1]; // number +``` + +## 4.11 The new Operator + +A `new` operation has one of the following forms: + +```TypeScript +new C +new C ( ... ) +new C < ... > ( ... ) +``` + +where *C* is an expression. The first form is equivalent to supplying an empty argument list. *C* must be of type Any or of an object type with one or more construct or call signatures. The operation is processed as follows at compile-time: + +* If *C* is of type Any, any argument list is permitted and the result of the operation is of type Any. +* If *C*’s apparent type (section [3.8.1](#3.8.1)) is an object type with one or more construct signatures, the expression is processed in the same manner as a function call, but using the construct signatures as the initial set of candidate signatures for overload resolution. The result type of the function call becomes the result type of the operation. +* If *C*’s apparent type is an object type with no construct signatures but one or more call signatures, the expression is processed as a function call. A compile-time error occurs if the result of the function call is not Void. The type of the result of the operation is Any. + +## 4.12 Function Calls + +Function calls are extended from JavaScript to optionally include type arguments. + +  *Arguments:* *( Modified )* +   *TypeArgumentsopt* `(` *ArgumentListopt* `)` + +A function call takes one of the forms + +```TypeScript +func ( ... ) +func < ... > ( ... ) +``` + +where *func* is an expression of a function type or of type Any. The function expression is followed by an optional type argument list (section [3.4.2](#3.4.2)) and an argument list. + +If *func* is of type Any, or of an object type that has no call or construct signatures but is a subtype of the Function interface, the call is an ***untyped function call***. In an untyped function call no type arguments are permitted, argument expressions can be of any type and number, no contextual types are provided for the argument expressions, and the result is always of type Any. + +If *func*’s apparent type (section [3.8.1](#3.8.1)) is a function type, the call is a ***typed function call***. TypeScript employs ***overload resolution*** in typed function calls in order to support functions with multiple call signatures. Furthermore, TypeScript may perform ***type argument inference*** to automatically determine type arguments in generic function calls. + +### 4.12.1 Overload Resolution + +The purpose of overload resolution in a function call is to ensure that at least one signature is applicable, to provide contextual types for the arguments, and to determine the result type of the function call, which could differ between the multiple applicable signatures. Overload resolution has no impact on the run-time behavior of a function call. Since JavaScript doesn’t support function overloading, all that matters at run-time is the name of the function. + +The compile-time processing of a typed function call consists of the following steps: + +* First, a list of candidate signatures is constructed from the call signatures in the function type in declaration order. For classes and interfaces, inherited signatures are considered to follow explicitly declared signatures in `extends` clause order. + * A non-generic signature is a candidate when + * the function call has no type arguments, and + * the signature is applicable with respect to the argument list of the function call. + * A generic signature is a candidate in a function call without type arguments when + * type inference (section [4.12.2](#4.12.2)) succeeds in inferring a list of type arguments, + * the inferred type arguments satisfy their constraints, and + * once the inferred type arguments are substituted for their associated type parameters, the signature is applicable with respect to the argument list of the function call. + * A generic signature is a candidate in a function call with type arguments when + * The signature has the same number of type parameters as were supplied in the type argument list, + * the type arguments satisfy their constraints, and + * once the type arguments are substituted for their associated type parameters, the signature is applicable with respect to the argument list of the function call. +* If the list of candidate signatures is empty, the function call is an error. +* Otherwise, if the candidate list contains one or more signatures for which the type of each argument expression is a subtype of each corresponding parameter type, the return type of the first of those signatures becomes the return type of the function call. +* Otherwise, the return type of the first signature in the candidate list becomes the return type of the function call. + +A signature is said to be an ***applicable signature*** with respect to an argument list when + +* the number of arguments is not less than the number of required parameters, +* the number of arguments is not greater than the number of parameters, and +* for each argument expression *e* and its corresponding parameter *P,* when *e* is contextually typed (section [4.19](#4.19)) by the type of *P*, no errors ensue and the type of *e* is assignable to (section [3.8.4](#3.8.4)) the type of *P*. + +### 4.12.2 Type Argument Inference + +Given a signature < *T1* , *T2* , … , *Tn* > ( *p1* : *P1* , *p2* : *P2* , … , *pm* : *Pm* ), where each parameter type *P* references zero or more of the type parameters *T*, and an argument list ( *e1* , *e2* , … , *em* ), the task of type argument inference is to find a set of type arguments *A1*…*An* to substitute for *T1*…*Tn* such that the argument list becomes an applicable signature. + +The inferred type argument for a particular type parameter is determined from a set of candidate types. Given a type parameter *T*, let *C* denote the widened form (section [3.9](#3.9)) of the best common type (section [3.10](#3.10)) of the set of candidate types *T*. Then, + +* If *C* satisfies *T*’s constraint, the inferred type argument for *T* is *C*. +* Otherwise, the inferred type argument for *T* is *T*’s constraint. + +In order to compute candidate types, the argument list is processed as follows: + +* Initially all inferred type arguments are considered ***unfixed*** with an empty set of candidate types. +* Proceeding from left to right, each argument expression *e* is ***inferentially typed*** by its corresponding parameter type *P*, possibly causing some inferred type arguments to become ***fixed***, and candidate type inferences (section [3.8.6](#3.8.6)) are made for unfixed inferred type arguments from the type computed for *e* to *P*. + +The process of inferentially typing an expression *e* by a type *T* is the same as that of contextually typing *e* by *T*, with the following exceptions: + +* Where expressions contained within *e* would be contextually typed, they are instead inferentially typed. +* Where a contextual type would be included in a best common type determination (such as when inferentially typing an object or array literal), an inferential type is not. +* When a function expression is inferentially typed (section [4.9.3](#4.9.3)) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, the corresponding inferred type arguments to become ***fixed*** and no further candidate inferences are made for them. +* If *e* is an expression of a function type that contains exactly one generic call signature and no other members, and *T* is a function type with exactly one non-generic call signature and no other members, then any inferences made for type parameters referenced by the parameters of *T*’s call signature are ***fixed***, and *e*’s type is changed to a function type with *e*’s call signature instantiated in the context of *T*’s call signature (section [3.8.5](#3.8.5)). + +In the example + +```TypeScript +function choose(x: T, y: T): T { + return Math.random() < 0.5 ? x : y; +} + +var x = choose("Five", 5); +``` + +inferences for ‘T’ in the call to ‘choose’ are made as follows: For the first parameter, an inference is made from type ‘string’ to ‘T’. For the second parameter, an inference is made from type ‘number’ to ‘T’. Since the best common type (section [3.10](#3.10)) of ‘string’ and ‘number’ is the empty object type, the call to ‘choose’ is equivalent to + +```TypeScript +var x = choose<{}>("Five", 5); +``` + +and the resulting type of ‘x’ is therefore the empty object type. Note that had both arguments been of type ‘string’ or ‘number’, ‘x’ would have been of that type. + +In the example + +```TypeScript +function map(a: T[], f: (x: T) => U): U[] { + var result: U[] = []; + for (var i = 0; i < a.length; i++) result.push(f(a[i])); + return result; +} + +var names = ["Peter", "Paul", "Mary"]; +var lengths = map(names, s => s.length); +``` + +inferences for ‘T’ and ‘U’ in the call to ‘map’ are made as follows: For the first parameter, inferences are made from the type ‘string[]’ (the type of ‘names’) to the type ‘T[]’, inferring ‘string’ for ‘T’. For the second parameter, inferential typing of the arrow expression ‘s => s.length’ causes ‘T’ to become fixed such that the inferred type ‘string’ can be used for the parameter ‘s’. The return type of the arrow expression can then be determined, and inferences are made from the type ‘(s: string) => number’ to the type ‘(x: T) => U’, inferring ‘number’ for ‘U’. Thus the call to ‘map’ is equivalent to + +```TypeScript +var lengths = map(names, s => s.length); +``` + +and the resulting type of ‘lengths’ is therefore ‘number[]’. + +In the example + +```TypeScript +function zip(x: S[], y: T[], combine: (x: S) => (y: T) => U): U[] { + var len = Math.max(x.length, y.length); + var result: U[] = []; + for (var i = 0; i < len; i++) result.push(combine(x[i])(y[i])); + return result; +} + +var names = ["Peter", "Paul", "Mary"]; +var ages = [7, 9, 12]; +var pairs = zip(names, ages, s => n => ({ name: s, age: n })); +``` + +inferences for ‘S’, ‘T’ and ‘U’ in the call to ‘zip’ are made as follows: Using the first two parameters, inferences of ‘string’ for ‘S’ and ‘number’ for ‘T’ are made. For the third parameter, inferential typing of the outer arrow expression causes ‘S’ to become fixed such that the inferred type ‘string’ can be used for the parameter ‘s’. When a function expression is inferentially typed, its return expression(s) are also inferentially typed. Thus, the inner arrow function is inferentially typed, causing ‘T’ to become fixed such that the inferred type ‘number’ can be used for the parameter ‘n’. The return type of the inner arrow function can then be determined, which in turn determines the return type of the function returned from the outer arrow function, and inferences are made from the type ‘(s: string) => (n: number) => { name: string; age: number }’ to the type ‘(x: S) => (y: T) => R’, inferring ‘{ name: string; age: number }’ for ‘R’. Thus the call to ‘zip’ is equivalent to + +```TypeScript +var pairs = zip( + names, ages, s => n => ({ name: s, age: n })); +``` + +and the resulting type of ‘pairs’ is therefore ‘{ name: string; age: number }[]’. + +### 4.12.3 Grammar Ambiguities + +The inclusion of type arguments in the *Arguments* production (section [4.12](#4.12)) gives rise to certain ambiguities in the grammar for expressions. For example, the statement + +```TypeScript +f(g(7)); +``` + +could be interpreted as a call to ‘f’ with two arguments, ‘g < A’ and ‘B > (7)’. Alternatively, it could be interpreted as a call to ‘f’ with one argument, which is a call to a generic function ‘g’ with two type arguments and one regular argument. + +The grammar ambiguity is resolved as follows: In a context where one possible interpretation of a sequence of tokens is an *Arguments* production, if the initial sequence of tokens forms a syntactically correct *TypeArguments* production and is followed by a ‘`(`‘ token, then the sequence of tokens is processed an *Arguments* production, and any other possible interpretation is discarded. Otherwise, the sequence of tokens is not considered an *Arguments* production. + +This rule means that the call to ‘f’ above is interpreted as a call with one argument, which is a call to a generic function ‘g’ with two type arguments and one regular argument. However, the statements + +```TypeScript +f(g < A, B > 7); +f(g < A, B > +(7)); +``` + +are both interpreted as calls to ‘f’ with two arguments. + +## 4.13 Type Assertions + +TypeScript extends the JavaScript expression grammar with the ability to assert a type for an expression: + +  *UnaryExpression:* *( Modified )* +   … +   `<` *Type* `>` *UnaryExpression* + +A type assertion expression consists of a type enclosed in `<` and `>` followed by a unary expression. Type assertion expressions are purely a compile-time construct. Type assertions are *not* checked at run-time and have no impact on the emitted JavaScript (and therefore no run-time cost). The type and the enclosing `<` and `>` are simply removed from the generated code. + +In a type assertion expression of the form `<` *T* `>` *e*, *e* is contextually typed (section [4.19](#4.19)) by *T* and the resulting type of* e* is required to be assignable to *T*, or *T* is required to be assignable to the widened form of the resulting type of *e*, or otherwise a compile-time error occurs. The type of the result is *T*. + +Type assertions check for assignment compatibility in both directions. Thus, type assertions allow type conversions that *might* be correct, but aren’t *known* to be correct. In the example + +```TypeScript +class Shape { ... } + +class Circle extends Shape { ... } + +function createShape(kind: string): Shape { + if (kind === "circle") return new Circle(); + ... +} + +var circle = createShape("circle"); +``` + +the type annotations indicate that the ‘createShape’ function *might* return a ‘Circle’ (because ‘Circle’ is a subtype of ‘Shape’), but isn’t *known* to do so (because its return type is ‘Shape’). Therefore, a type assertion is needed to treat the result as a ‘Circle’. + +As mentioned above, type assertions are not checked at run-time and it is up to the programmer to guard against errors, for example using the `instanceof` operator: + +```TypeScript +var shape = createShape(shapeKind); +if (shape instanceof Circle) { + var circle = shape; + ... +} +``` + +## 4.14 Unary Operators + +The subsections that follow specify the compile-time processing rules of the unary operators. In general, if the operand of a unary operator does not meet the stated requirements, a compile-time error occurs and the result of the operation defaults to type Any in further processing. + +### 4.14.1 The ++ and -- operators + +These operators, in prefix or postfix form, require their operand to be of type Any, the Number primitive type, or an enum type, and classified as a reference (section [4.1](#4.1)). They produce a result of the Number primitive type. + +### 4.14.2 The +, –, and ~ operators + +These operators permit their operand to be of any type and produce a result of the Number primitive type. + +The unary + operator can conveniently be used to convert a value of any type to the Number primitive type: + +```TypeScript +function getValue() { ... } + +var n = +getValue(); +``` + +The example above converts the result of ‘getValue()’ to a number if it isn’t a number already. The type inferred for ‘n’ is the Number primitive type regardless of the return type of ‘getValue’. + +### 4.14.3 The ! operator + +The ! operator permits its operand to be of any type and produces a result of the Boolean primitive type. + +Two unary ! operators in sequence can conveniently be used to convert a value of any type to the Boolean primitive type: + +```TypeScript +function getValue() { ... } + +var b = !!getValue(); +``` + +The example above converts the result of ‘getValue()’ to a Boolean if it isn’t a Boolean already. The type inferred for ‘b’ is the Boolean primitive type regardless of the return type of ‘getValue’. + +### 4.14.4 The delete Operator + +The ‘delete’ operator takes an operand of any type and produces a result of the Boolean primitive type. + +### 4.14.5 The void Operator + +The ‘void’ operator takes an operand of any type and produces the value ‘undefined’. The type of the result is the Undefined type ([3.2.6](#3.2.6)). + +### 4.14.6 The typeof Operator + +The ‘typeof’ operator takes an operand of any type and produces a value of the String primitive type. In positions where a type is expected, ‘typeof’ can also be used in a type query (section [3.6.8](#3.6.8)) to produce the type of an expression. + +```TypeScript +var x = 5; +var y = typeof x; // Use in an expression +var z: typeof x; // Use in a type query +``` + +In the example above, ‘x’ is of type ‘number’, ‘y’ is of type ‘string’ because when used in an expression, ‘typeof’ produces a value of type string (in this case the string “number”), and ‘z’ is of type ‘number’ because when used in a type query, ‘typeof’ obtains the type of an expression. + +## 4.15 Binary Operators + +The subsections that follow specify the compile-time processing rules of the binary operators. In general, if the operands of a binary operator do not meet the stated requirements, a compile-time error occurs and the result of the operation defaults to type any in further processing. Tables that summarize the compile-time processing rules for operands of the Any type, the Boolean, Number, and String primitive types, and all object types and type parameters (the Object column in the tables) are provided. + +### 4.15.1 The *, /, %, –, <<, >>, >>>, &, ^, and | operators + +These operators require their operands to be of type Any, the Number primitive type, or an enum type. Operands of an enum type are treated as having the primitive type Number. If one operand is the `null` or `undefined` value, it is treated as having the type of the other operand. The result is always of the Number primitive type. + +||Any|Boolean|Number|String|Object| +|:---:|:---:|:---:|:---:|:---:|:---:| +|Any|Number||Number||| +|Boolean|||||| +|Number|Number||Number||| +|String|||||| +|Object|||||| + +### 4.15.2 The + operator + +The binary + operator requires both operands to be of the Number primitive type or an enum type, or at least one of the operands to be of type Any or the String primitive type. Operands of an enum type are treated as having the primitive type Number. If one operand is the `null` or `undefined` value, it is treated as having the type of the other operand. If both operands are of the Number primitive type, the result is of the Number primitive type. If one or both operands are of the String primitive type, the result is of the String primitive type. Otherwise, the result is of type Any. + +||Any|Boolean|Number|String|Object| +|:---:|:---:|:---:|:---:|:---:|:---:| +|Any|Any|Any|Any|String|Any| +|Boolean|Any|||String|| +|Number|Any||Number|String|| +|String|String|String|String|String|String| +|Object|Any|||String|| + +A value of any type can converted to the String primitive type by adding an empty string: + +```TypeScript +function getValue() { ... } + +var s = getValue() + ""; +``` + +The example above converts the result of ‘getValue()’ to a string if it isn’t a string already. The type inferred for ‘s’ is the String primitive type regardless of the return type of ‘getValue’. + +### 4.15.3 The <, >, <=, >=, ==, !=, ===, and !== operators + +These operators require one operand type to be identical to or a subtype of the other operand type. The result is always of the Boolean primitive type. + +||Any|Boolean|Number|String|Object| +|:---:|:---:|:---:|:---:|:---:|:---:| +|Any|Boolean|Boolean|Boolean|Boolean|Boolean| +|Boolean|Boolean|Boolean|||| +|Number|Boolean||Boolean||| +|String|Boolean|||Boolean|| +|Object|Boolean||||Boolean| + +### 4.15.4 The instanceof operator + +The `instanceof` operator requires the left operand to be of type Any, an object type, or a type parameter type, and the right operand to be of type Any or a subtype of the ‘Function’ interface type. The result is always of the Boolean primitive type. + +Note that object types containing one or more call or construct signatures are automatically subtypes of the ‘Function’ interface type, as described in section [3.3](#3.3). + +### 4.15.5 The in operator + +The `in` operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, and the right operand to be of type Any, an object type, or a type parameter type. The result is always of the Boolean primitive type. + +### 4.15.6 The && operator + +The && operator permits the operands to be of any type and produces a result of the same type as the second operand. + +||Any|Boolean|Number|String|Object| +|:---:|:---:|:---:|:---:|:---:|:---:| +|Any|Any|Boolean|Number|String|Object| +|Boolean|Any|Boolean|Number|String|Object| +|Number|Any|Boolean|Number|String|Object| +|String|Any|Boolean|Number|String|Object| +|Object|Any|Boolean|Number|String|Object| + +### 4.15.7 The || operator + +The || operator permits the operands to be of any type. + +If the || expression is contextually typed (section [4.19](#4.19)), the operands are contextually typed by the same type and the result is of the best common type (section [3.10](#3.10)) of the contextual type and the two operand types. + +If the || expression is not contextually typed, the right operand is contextually typed by the type of the left operand and the result is of the best common type of the two operand types. + +||Any|Boolean|Number|String|Object| +|:---:|:---:|:---:|:---:|:---:|:---:| +|Any|Any|Any|Any|Any|Any| +|Boolean|Any|Boolean|{ }|{ }|{ }| +|Number|Any|{ }|Number|{ }|{ }| +|String|Any|{ }|{ }|String|{ }| +|Object|Any|{ }|{ }|{ }|Object| + +## 4.16 The Conditional Operator + +In a conditional expression of the form + +```TypeScript +test ? expr1 : expr2 +``` + +the *test* expression may be of any type. + +If the conditional expression is contextually typed (section [4.19](#4.19)), *expr1* and *expr2* are contextually typed by the same type and the result is of the best common type (section [3.10](#3.10)) of the contextual type and the types of *expr1* and *expr2*. An error occurs if the best common type is not identical to at least one of the three candidate types. + +If the conditional expression is not contextually typed, the result is of the best common type of the types of *Expr1* and *Expr2*. An error occurs if the best common type is not identical to at least one of the two candidate types. + +## 4.17 Assignment Operators + +An assignment of the form + +```TypeScript +v = expr +``` + +requires *v* to be classified as a reference (section [4.1](#4.1)). The *expr* expression is contextually typed (section [4.19](#4.19)) by the type of *v*, and the type of *expr* must be assignable to (section [3.8.4](#3.8.4)) the type of *v*, or otherwise a compile-time error occurs. The result is a value with the type of *expr*. + +A compound assignment of the form + +```TypeScript +v ??= expr +``` + +where ??= is one of the compound assignment operators + +```TypeScript +*= /= %= += -= <<= >>= >>>= &= ^= |= +``` + +is subject to the same requirements, and produces a value of the same type, as the corresponding non-compound operation. A compound assignment furthermore requires *v* to be classified as a reference (section [4.1](#4.1)) and the type of the non-compound operation to be assignable to the type of *v*. + +## 4.18 The Comma Operator + +The comma operator permits the operands to be of any type and produces a result that is of the same type as the second operand. + +## 4.19 Contextually Typed Expressions + +In certain situations, parameter and return types of function expressions are automatically inferred from the contexts in which the function expressions occur. For example, given the declaration + +```TypeScript +var f: (s: string) => string; +``` + +the assignment + +```TypeScript +f = function(s) { return s.toLowerCase(); } +``` + +infers the type of the ‘s’ parameter to be the String primitive type even though there is no type annotation to that effect. The function expression is said to be ***contextually typed*** by the variable to which it is being assigned. Contextual typing occurs in the following situations: + +* In variable, parameter, and member declarations with a type annotation and an initializer, the initializer expression is contextually typed by the type of the variable, parameter, or property. +* In return statements, if the containing function includes a return type annotation, return expressions are contextually typed by that return type. Otherwise, if the containing function is contextually typed by a type *T*, return expressions are contextually typed by *T*’s return type. +* In typed function calls, argument expressions are contextually typed by their parameter types. +* In type assertions, the expression is contextually typed by the indicated type. +* In || operator expressions without a contextual type, the right hand expression is contextually typed by the type of the left hand expression. +* In assignment expressions, the right hand expression is contextually typed by the type of the left hand expression. +* In contextually typed object literals, property assignments are contextually typed by their property types. +* In contextually typed array literals, element expressions are contextually typed by the array element type. +* In contextually typed || operator expressions, the operands are contextually typed as well. +* In contextually typed conditional operator expressions, the operands are contextually typed as well. + +Contextual typing of an expression *e* by a type *T* proceeds as follows: + +* If *e* is an *ObjectLiteral* and *T* is an object type, *e* is processed with the contextual type *T*, as described in section [4.5](#4.5). +* If *e* is an *ArrayLiteral* and *T* is an object type with a numeric index signature, *e* is processed with the contextual type *T*, as described in section [4.6](#4.6). +* If *e* is a *FunctionExpression* or *ArrowFunctionExpression* with no type parameters and no parameter type annotations, *T* is a function type with exactly one call signature and *T*’s call signature is non-generic, then any inferences made for type parameters referenced by the parameters of *T*’s call signature are fixed (section [4.12.2](#4.12.2)) and *e* is processed with the contextual type *T*, as described in section [4.9.3](#4.9.3). +* If *e* is a || operator expression and *T* is an object type, *e* is processed with the contextual type *T*, as described in section [4.15.7](#4.15.7). +* If *e* is a conditional operator expression and *T* is an object type, *e* is processed with the contextual type *T*, as described in section [4.16](#4.16). +* Otherwise, *e* is processed without a contextual type. + +The rules above require expressions be of the exact syntactic forms specified in order to be processed as contextually typed constructs. For example, given the declaration of the variable ‘f’ above, the assignment + +```TypeScript +f = s => s.toLowerCase(); +``` + +causes the function expression to be contextually typed, inferring the String primitive type for ‘s’. However, simply enclosing the construct in parentheses + +```TypeScript +f = (s => s.toLowerCase()); +``` + +causes the function expression to be processed without a contextual type, now inferring ‘s’ and the result of the function to be of type Any as no type annotations are present. + +In the following example + +```TypeScript +interface EventObject { + x: number; + y: number; +} + +interface EventHandlers { + mousedown?: (event: EventObject) => void; + mouseup?: (event: EventObject) => void; + mousemove?: (event: EventObject) => void; +} + +function setEventHandlers(handlers: EventHandlers) { ... } + +setEventHandlers({ + mousedown: e => { startTracking(e.x, e.y); }, + mouseup: e => { endTracking(); } +}); +``` + +the object literal passed to ‘setEventHandlers’ is contextually typed to the ‘EventHandlers’ type. This causes the two property assignments to be contextually typed to the unnamed function type ‘(event: EventObject) => void’, which in turn causes the ‘e’ parameters in the arrow function expressions to automatically be typed as ‘EventObject’. + +
+ +#
5 Statements + +This chapter describes the static type checking TypeScript provides for JavaScript statements. TypeScript itself does not introduce any new statement constructs. + +## 5.1 Variable Statements + +Variable statements are extended to include optional type annotations. + +  *VariableDeclaration:* *( Modified )* +   *Identifier* *TypeAnnotationopt* *Initialiseropt* + +  *VariableDeclarationNoIn:* *( Modified )* +   *Identifier* *TypeAnnotationopt* *InitialiserNoInopt* + +  *TypeAnnotation:* +   `:` *Type* + +A variable declaration introduces a variable with the given name in the containing declaration space. The type associated with a variable is determined as follows: + +* If the declaration includes a type annotation, the stated type becomes the type of the variable. If an initializer is present, the initializer expression is contextually typed (section [4.19](#4.19)) by the stated type and must be assignable to the stated type, or otherwise a compile-time error occurs. +* If the declaration includes an initializer but no type annotation, and if the initializer doesn’t directly or indirectly reference the variable, the widened type (section [3.9](#3.9)) of the initializer expression becomes the type of the variable. If the initializer directly or indirectly references the variable, the type of the variable becomes the Any type. +* If the declaration includes neither a type annotation nor an initializer, the type of the variable becomes the Any type. + +Multiple declarations for the same variable name in the same declaration space are permitted, provided that each declaration associates the same type with the variable. + +Below are some examples of variable declarations and their associated types. + +```TypeScript +var a; // any +var b: number; // number +var c = 1; // number +var d = { x: 1, y: "hello" }; // { x: number; y: string; } +var e: any = "test"; // any +``` + +The following is permitted because all declarations of the single variable ‘x’ associate the same type (Number) with ‘x’. + +```TypeScript +var x = 1; +var x: number; +if (x == 1) { + var x = 2; +} +``` + +In the following example, all five variables are of the same type, ‘{ x: number; y: number; }’. + +```TypeScript +interface Point { x: number; y: number; } + +var a = { x: 0, y: undefined }; +var b: Point = { x: 0, y: undefined }; +var c = { x: 0, y: undefined }; +var d: { x: number; y: number; } = { x: 0, y: undefined }; +var e = <{ x: number; y: number; }> { x: 0, y: undefined }; +``` + +## 5.2 If, Do, and While Statements + +Expressions controlling ‘if’, ‘do’, and ‘while’ statements can be of any type (and not just type Boolean). + +## 5.3 For Statements + +Variable declarations in ‘for’ statements are extended in the same manner as variable declarations in variable statements (section [5.1](#5.1)). + +## 5.4 For-In Statements + +In a ‘for-in’ statement of the form + +```TypeScript +for (v in expr) statement +``` + +*v* must be an expression classified as a reference of type Any or the String primitive type, and *expr* must be an expression of type Any, an object type, or a type parameter type. + +In a ‘for-in’ statement of the form + +```TypeScript +for (var v in expr) statement +``` + +*v* must be a variable declaration without a type annotation that declares a variable of type Any, and *expr* must be an expression of type Any, an object type, or a type parameter type. + +## 5.5 Continue Statements + +A ‘continue’ statement is required to be nested, directly or indirectly (but not crossing function boundaries), within an iteration (‘do’, ‘while’, ‘for’, or ‘for-in’) statement. When a ‘continue’ statement includes a target label, that target label must appear in the label set of an enclosing (but not crossing function boundaries) iteration statement. + +## 5.6 Break Statements + +A ‘break’ statement is required to be nested, directly or indirectly (but not crossing function boundaries), within an iteration (‘do’, ‘while’, ‘for’, or ‘for-in’) or ‘switch’ statement. When a ‘break’ statement includes a target label, that target label must appear in the label set of an enclosing (but not crossing function boundaries) statement. + +## 5.7 Return Statements + +It is an error for a ‘return’ statement to occur outside a function body. Specifically, ‘return’ statements are not permitted at the global level or in module bodies. + +A ‘return’ statement without an expression returns the value ‘undefined’ and is permitted in the body of any function, regardless of the return type of the function. + +When a ‘return’ statement includes an expression, if the containing function includes a return type annotation, the return expression is contextually typed (section [4.19](#4.19)) by that return type and must be of a type that is assignable to the return type. Otherwise, if the containing function is contextually typed by a type *T*, *Expr* is contextually typed by *T*’s return type. + +In a function implementation without a return type annotation, the return type is inferred from the ‘return’ statements in the function body, as described in section [6.3](#6.3). + +In the example + +```TypeScript +function f(): (x: string) => number { + return s => s.length; +} +``` + +the arrow expression in the ‘return’ statement is contextually typed by the return type of ‘f’, thus giving type ‘string’ to ‘s’. + +## 5.8 With Statements + +Use of the ‘with’ statement in TypeScript is an error, as is the case in ECMAScript 5’s strict mode. Furthermore, within the body of a ‘with’ statement, TypeScript considers every identifier occurring in an expression (section [4.3](#4.3)) to be of the Any type regardless of its declared type. Because the ‘with’ statement puts a statically unknown set of identifiers in scope in front of those that are statically known, it is not possible to meaningfully assign a static type to any identifier. + +## 5.9 Switch Statements + +In a ‘switch’ statement, each ‘case’ expression must be of a type that is assignable to or from (section [3.8.4](#3.8.4)) the type of the ‘switch’ expression. + +## 5.10 Throw Statements + +The expression specified in a ‘throw’ statement can be of any type. + +## 5.11 Try Statements + +The variable introduced by a ‘catch’ clause of a ‘try’ statement is always of type Any. It is not possible to include a type annotation in a ‘catch’ clause. + +
+ +#
6 Functions + +TypeScript extends JavaScript functions to include type parameters, parameter and return type annotations, overloads, default parameter values, and rest parameters. + +## 6.1 Function Declarations + +Function declarations consist of an optional set of function overloads followed by an actual function implementation. + +  *FunctionDeclaration:* *( Modified )* +   *FunctionOverloadsopt* *FunctionImplementation* + +  *FunctionOverloads:* +   *FunctionOverload* +   *FunctionOverloads* *FunctionOverload* + +  *FunctionOverload:* +   `function` *Identifier* *CallSignature* `;` + +  *FunctionImplementation:* +   `function` *Identifier* *CallSignature* `{` *FunctionBody* `}` + +A function declaration introduces a function with the given name in the containing declaration space. Function overloads, if present, must specify the same name as the function implementation. If a function declaration includes overloads, the overloads determine the call signatures of the type given to the function object and the function implementation signature must be assignable to that type. Otherwise, the function implementation itself determines the call signature. Function overloads have no other effect on a function declaration. + +## 6.2 Function Overloads + +Function overloads allow a more accurate specification of the patterns of invocation supported by a function than is possible with a single signature. The compile-time processing of a call to an overloaded function chooses the best candidate overload for the particular arguments and the return type of that overload becomes the result type the function call expression. Thus, using overloads it is possible to statically describe the manner in which a function’s return type varies based on its arguments. Overload resolution in function calls is described further in section [4.12](#4.12). + +Function overloads are purely a compile-time construct. They have no impact on the emitted JavaScript and thus no run-time cost. + +The parameter list of a function overload cannot specify default values for parameters. In other words, an overload may use only the `?` form when specifying optional parameters. + +The following is an example of a function with overloads. + +```TypeScript +function attr(name: string): string; +function attr(name: string, value: string): Accessor; +function attr(map: any): Accessor; +function attr(nameOrMap: any, value?: string): any { + if (nameOrMap && typeof nameOrMap === "string") { + // handle string case + } + else { + // handle map case + } +} +``` + +Note that each overload and the final implementation specify the same identifier. The type of the local variable ‘attr’ introduced by this declaration is + +```TypeScript +var attr: { + (name: string): string; + (name: string, value: string): Accessor; + (map: any): Accessor; +}; +``` + +Note that the signature of the actual function implementation is not included in the type. + +## 6.3 Function Implementations + +A function implementation without a return type annotation is said to be an ***implicitly typed function***. The return type of an implicitly typed function *f* is inferred from its function body as follows: + +* If there are no return statements with expressions in *f*’s function body, the inferred return type is Void. +* Otherwise, if *f*’s function body directly references *f* or references any implicitly typed functions that through this same analysis reference *f*, the inferred return type is Any. +* Otherwise, the inferred return type is the widened form (section [3.9](#3.9)) of the best common type (section [3.10](#3.10)) of the types of the return statement expression in the function body, ignoring return statements with no expressions. A compile-time error occurs if the best common type isn’t one of the return statement expression types (i.e. if the best common type is an empty type). + +In the example + +```TypeScript +function f(x: number) { + if (x <= 0) return x; + return g(x); +} + +function g(x: number) { + return f(x - 1); +} +``` + +the inferred return type for ‘f’ and ‘g’ is Any because the functions reference themselves through a cycle with no return type annotations. Adding an explicit return type ‘number’ to either breaks the cycle and causes the return type ‘number’ to be inferred for the other. + +An explicitly typed function whose return type isn’t the Void or the Any type must have at least one return statement somewhere in its body. An exception to this rule is if the function implementation consists of a single ‘throw’ statement. + +The type of ‘this’ in a function implementation is the Any type. + +In the signature of a function implementation, a parameter can be marked optional by following it with an initializer. When a parameter declaration includes both a type annotation and an initializer, the initializer expression is contextually typed (section [4.19](#4.19)) by the stated type and must be assignable to the stated type, or otherwise a compile-time error occurs. When a parameter declaration has no type annotation but includes an initializer, the type of the parameter is the widened form (section [3.9](#3.9)) of the type of the initializer expression. + +Initializer expressions are evaluated in the scope of the function body but are not permitted to reference local variables and are only permitted to access parameters that are declared to the left of the parameter they initialize, unless the parameter reference occurs in a nested function expression. + +For each parameter with an initializer, a statement that substitutes the default value for an omitted argument is included in the generated JavaScript, as described in section [6.5](#6.5). The example + +```TypeScript +function strange(x: number, y = x * 2, z = x + y) { + return z; +} +``` + +generates JavaScript that is equivalent to + +```TypeScript +function strange(x, y, z) { + if (y === void 0) { y = x * 2; } + if (z === void 0) { z = x + y; } + return z; +} +``` + +In the example + +```TypeScript +var x = 1; +function f(a = x) { + var x = "hello"; +} +``` + +the local variable ‘x’ is in scope in the parameter initializer (thus hiding the outer ‘x’), but it is an error to reference it because it will always be uninitialized at the time the parameter initializer is evaluated. + +## 6.4 Generic Functions + +A function implementation may include type parameters in its signature (section [3.7.2.1](#3.7.2.1)) and is then called a ***generic function***. Type parameters provide a mechanism for expressing relationships between parameter and return types in call operations. Type parameters have no run-time representation—they are purely a compile-time construct. + +Type parameters declared in the signature of a function implementation are in scope in the signature and body of that function implementation. + +The following is an example of a generic function: + +```TypeScript +interface Comparable { + localeCompare(other: any): number; +} + +function compare(x: T, y: T): number { + if (x == null) return y == null ? 0 : -1; + if (y == null) return 1; + return x.localeCompare(y); +} +``` + +Note that the ‘x’ and ‘y’ parameters are known to be subtypes of the constraint ‘Comparable’ and therefore have a ‘compareTo’ member. This is described further in section [3.4.1](#3.4.1). + +The type arguments of a call to a generic function may be explicitly specified in a call operation or may, when possible, be inferred (section [4.12.2](#4.12.2)) from the types of the regular arguments in the call. In the example + +```TypeScript +class Person { + name: string; + localeCompare(other: Person) { + return compare(this.name, other.name); + } +} +``` + +the type argument to ‘compare’ is automatically inferred to be the String type because the two arguments are strings. + +## 6.5 Code Generation + +A function declaration generates JavaScript code that is equivalent to: + +```TypeScript +function () { + + +} +``` + +*FunctionName* is the name of the function (or nothing in the case of a function expression). + +*FunctionParameters* is a comma separated list of the function’s parameter names. + +*DefaultValueAssignments* is a sequence of default property value assignments, one for each parameter with a default value, in the order they are declared, of the form + +```TypeScript +if ( === void 0) { = ; } +``` + +where *Parameter* is the parameter name and *Default* is the default value expression. + +*FunctionStatements* is the code generated for the statements specified in the function body. + +
+ +#
7 Interfaces + +Interfaces provide the ability to name and parameterize object types and to compose existing named object types into new ones. + +Interfaces have no run-time representation—they are purely a compile-time construct. Interfaces are particularly useful for documenting and validating the required shape of properties, objects passed as parameters, and objects returned from functions. + +Because TypeScript has a structural type system, an interface type with a particular set of members is considered identical to, and can be substituted for, another interface type or object type literal with an identical set of members (see section [3.8.2](#3.8.2)). + +Class declarations may reference interfaces in their implements clause to validate that they provide an implementation of the interfaces. + +## 7.1 Interface Declarations + +An interface declaration declares a new named type (section [3.5](#3.5)) by introducing a type name in the containing module. + +  *InterfaceDeclaration:* +   `interface` *Identifier* *TypeParametersopt* *InterfaceExtendsClauseopt* *ObjectType* + +  *InterfaceExtendsClause:* +   `extends` *ClassOrInterfaceTypeList* + +  *ClassOrInterfaceTypeList:* +   *ClassOrInterfaceType* +   *ClassOrInterfaceTypeList* `,` *ClassOrInterfaceType* + +  *ClassOrInterfaceType:* +   *TypeReference* + +The *Identifier* of an interface declaration may not be one of the predefined type names (section [3.6.1](#3.6.1)). + +An interface may optionally have type parameters (section [3.4.1](#3.4.1)) that serve as placeholders for actual types to be provided when the interface is referenced in type references. An interface with type parameters is called a ***generic interface***. The type parameters of a generic interface declaration are in scope in the entire declaration and may be referenced in the *InterfaceExtendsClause* and *ObjectType* body. + +An interface can inherit from zero or more ***base types*** which are specified in the *InterfaceExtendsClause*. The base types must be type references to class or interface types. + +An interface has the members specified in the *ObjectType* of its declaration and furthermore inherits all base type members that aren’t hidden by declarations in the interface: + +* A property declaration hides a public base type property with the same name. +* A string index signature declaration hides a base type string index signature. +* A numeric index signature declaration hides a base type numeric index signature. + +The following constraints must be satisfied by an interface declaration or otherwise a compile-time error occurs: + +* An interface declaration may not, directly or indirectly, specify a base type that originates in the same declaration. In other words an interface cannot, directly or indirectly, be a base type of itself, regardless of type arguments. +* An interface cannot declare a property with the same name as an inherited private or protected property. +* Inherited properties with the same name must be identical (section [3.8.2](#3.8.2)). +* All properties of the interface must satisfy the constraints implied by the index signatures of the interface as specified in section [3.7.4](#3.7.4). +* The instance type (section [3.5.1](#3.5.1)) of the declared interface must be assignable (section [3.8.4](#3.8.4)) to each of the base type references. + +An interface is permitted to inherit identical members from multiple base types and will in that case only contain one occurrence of each particular member. + +Below is an example of two interfaces that contain properties with the same name but different types: + +```TypeScript +interface Mover { + move(): void; + getStatus(): { speed: number; }; +} + +interface Shaker { + shake(): void; + getStatus(): { frequency: number; }; +} +``` + +An interface that extends ‘Mover’ and ‘Shaker’ must declare a new ‘getStatus’ property as it would otherwise inherit two ‘getStatus’ properties with different types. The new ‘getStatus’ property must be declared such that the resulting ‘MoverShaker’ is a subtype of both ‘Mover’ and ‘Shaker’: + +```TypeScript +interface MoverShaker extends Mover, Shaker { + getStatus(): { speed: number; frequency: number; }; +} +``` + +Since function and constructor types are just object types containing call and construct signatures, interfaces can be used to declare named function and constructor types. For example: + +```TypeScript +interface StringComparer { (a: string, b: string): number; } +``` + +This declares type ‘StringComparer’ to be a function type taking two strings and returning a number. + +## 7.2 Declaration Merging + +Interfaces are “open-ended” and interface declarations with the same qualified name relative to a common root (as defined in section [2.3](#2.3)) contribute to a single interface. + +When a generic interface has multiple declarations, all declarations must have identical type parameter lists, i.e. identical type parameter names with identical constraints in identical order. + +In an interface with multiple declarations, the `extends` clauses are merged into a single set of base types and the bodies of the interface declarations are merged into a single object type. Declaration merging produces a declaration order that corresponds to *prepending* the members of each interface declaration, in the order the members are written, to the combined list of members in the order of the interface declarations. Thus, members declared in the last interface declaration will appear first in the declaration order of the merged type. + +For example, a sequence of declarations in this order: + +```TypeScript +interface Document { + createElement(tagName: any): Element; +} + +interface Document { + createElement(tagName: string): HTMLElement; +} + +interface Document { + createElement(tagName: "div"): HTMLDivElement; + createElement(tagName: "span"): HTMLSpanElement; + createElement(tagName: "canvas"): HTMLCanvasElement; +} +``` + +is equivalent to the following single declaration: + +```TypeScript +interface Document { + createElement(tagName: "div"): HTMLDivElement; + createElement(tagName: "span"): HTMLSpanElement; + createElement(tagName: "canvas"): HTMLCanvasElement; + createElement(tagName: string): HTMLElement; + createElement(tagName: any): Element; +} +``` + +Note that the members of the last interface declaration appear first in the merged declaration. Also note that the relative order of members declared in the same interface body is preserved. + +## 7.3 Interfaces Extending Classes + +When an interface type extends a class type it inherits the members of the class but not their implementations. It is as if the interface had declared all of the members of the class without providing an implementation. Interfaces inherit even the private and protected members of a base class. When a class containing private or protected members is the base type of an interface type, that interface type can only be implemented by that class or a descendant class. For example: + +```TypeScript +class Control { + private state: any; +} + +interface SelectableControl extends Control { + select(): void; +} + +class Button extends Control { + select() { } +} + +class TextBox extends Control { + select() { } +} + +class Image extends Control { +} + +class Location { + select() { } +} +``` + +In the above example, ‘SelectableControl’ contains all of the members of ‘Control’, including the private ‘state’ property. Since ‘state’ is a private member it is only possible for descendants of ‘Control’ to implement ‘SelectableControl’. This is because only descendants of ‘Control’ will have a ‘state’ private member that originates in the same declaration, which is a requirement for private members to be compatible (section [3.8](#3.8)). + +Within the ‘Control’ class it is possible to access the ‘state’ private member through an instance of ‘SelectableControl’. Effectively, a ‘SelectableControl’ acts like a ‘Control’ that is known to have a ‘select’ method. The ‘Button’ and ‘TextBox’ classes are subtypes of ‘SelectableControl’ (because they both inherit from ‘Control’ and have a ‘select’ method), but the ‘Image’ and ‘Location’ classes are not. + +## 7.4 Dynamic Type Checks + +TypeScript does not provide a direct mechanism for dynamically testing whether an object implements a particular interface. Instead, TypeScript code can use the JavaScript technique of checking whether an appropriate set of members are present on the object. For example, given the declarations in section [7.1](#7.1), the following is a dynamic check for the ‘MoverShaker’ interface: + +```TypeScript +var obj: any = getSomeObject(); +if (obj && obj.move && obj.shake && obj.getStatus) { + var moverShaker = obj; + ... +} +``` + +If such a check is used often it can be abstracted into a function: + +```TypeScript +function asMoverShaker(obj: any): MoverShaker { + return obj && obj.move && obj.shake && obj.getStatus ? obj : null; +} +``` + +
+ +#
8 Classes + +TypeScript supports classes that are closely aligned with those proposed for ECMAScript 6, and includes extensions for instance and static member declarations and properties declared and initialized from constructor parameters. + +*NOTE: TypeScript currently doesn’t support class expressions or nested class declarations from the ECMAScript 6 proposal*. + +## 8.1 Class Declarations + +Class declarations introduce named types and provide implementations of those types. Classes support inheritance, allowing derived classes to extend and specialize base classes. + +  *ClassDeclaration:* +   `class` *Identifier* *TypeParametersopt* *ClassHeritage* `{` *ClassBody* `}` + +A *ClassDeclaration* declares a ***class type*** and a ***constructor function***, both with the name given by *Identifier*, in the containing module. The class type is created from the instance members declared in the class body and the instance members inherited from the base class. The constructor function is created from the constructor declaration, the static member declarations in the class body, and the static members inherited from the base class. The constructor function initializes and returns an instance of the class type. + +The *Identifier* of a class declaration may not be one of the predefined type names (section [3.6.1](#3.6.1)). + +A class may optionally have type parameters (section [3.4.1](#3.4.1)) that serve as placeholders for actual types to be provided when the class is referenced in type references. A class with type parameters is called a ***generic class***. The type parameters of a generic class declaration are in scope in the entire declaration and may be referenced in the *ClassHeritage* and *ClassBody*. + +The following example introduces both a named type called ‘Point’ (the class type) and a member called ‘Point’ (the constructor function) in the containing module. + +```TypeScript +class Point { + constructor(public x: number, public y: number) { } + public length() { return Math.sqrt(this.x * this.x + this.y * this.y); } + static origin = new Point(0, 0); +} +``` + +The ‘Point’ type is exactly equivalent to + +```TypeScript +interface Point { + x: number; + y: number; + length(): number; +} +``` + +The ‘Point’ member is a constructor function whose type corresponds to the declaration + +```TypeScript +var Point: { + new(x: number, y: number): Point; + origin: Point; +}; +``` + +The context in which a class is referenced distinguishes between the class instance type and the constructor function. For example, in the assignment statement + +```TypeScript +var p: Point = new Point(10, 20); +``` + +the identifier ‘Point’ in the type annotation refers to the class instance type, whereas the identifier ‘Point’ in the `new` expression refers to the constructor function object. + +### 8.1.1 Class Heritage Specification + +The heritage specification of a class consists of optional `extends` and `implements` clauses. The `extends` clause specifies the base class of the class and the `implements` clause specifies a set of interfaces for which to validate the class provides an implementation. + +  *ClassHeritage:* +   *ClassExtendsClauseopt* *ImplementsClauseopt* + +  *ClassExtendsClause:* +   `extends`  *ClassType* + +  *ClassType:* +   *TypeReference* + +  *ImplementsClause:* +   `implements` *ClassOrInterfaceTypeList* + +A class that includes an `extends` clause is called a ***derived class***, and the class specified in the `extends` clause is called the ***base class*** of the derived class. When a class heritage specification omits the `extends` clause, the class does not have a base class. However, as is the case with every object type, type references (section [3.3.1](#3.3.1)) to the class will appear to have the members of the global interface type named ‘Object’ unless those members are hidden by members with the same name in the class. + +The following constraints must be satisfied by the class heritage specification or otherwise a compile-time error occurs: + +* If present, the type reference specified in the `extends` clause must denote a class type. Furthermore, the *TypeName* part of the type reference is required to be a reference to the class constructor function when evaluated as an expression. +* A class declaration may not, directly or indirectly, specify a base class that originates in the same declaration. In other words a class cannot, directly or indirectly, be a base class of itself, regardless of type arguments. +* The instance type (section [3.5.1](#3.5.1)) of the declared class must be assignable (section [3.8.4](#3.8.4)) to the base type reference and each of the type references listed in the `implements` clause. +* The constructor function type created by the class declaration must be assignable to the base class constructor function type, ignoring construct signatures. + +The following example illustrates a situation in which the first rule above would be violated: + +```TypeScript +class A { a: number; } + +module Foo { + var A = 1; + class B extends A { b: string; } +} +``` + +When evaluated as an expression, the type reference ‘A’ in the `extends` clause doesn’t reference the class constructor function of ‘A’ (instead it references the local variable ‘A’). + +The only situation in which the last two constraints above are violated is when a class overrides one or more base class members with incompatible new members. + +Note that because TypeScript has a structural type system, a class doesn’t need to explicitly state that it implements an interface—it suffices for the class to simply contain the appropriate set of instance members. The `implements` clause of a class provides a mechanism to assert and validate that the class contains the appropriate sets of instance members, but otherwise it has no effect on the class type. + +### 8.1.2 Class Body + +The class body consists of zero or more constructor or member declarations. Statements are not allowed in the body of a class—they must be placed in the constructor or in members. + +  *ClassBody:* +   *ClassElementsopt* + +  *ClassElements:* +   *ClassElement* +   *ClassElements* *ClassElement* + +  *ClassElement:* +   *ConstructorDeclaration* +   *PropertyMemberDeclaration* +   *IndexMemberDeclaration* + +The body of class may optionally contain a single constructor declaration. Constructor declarations are described in section [8.3](#8.3). + +Member declarations are used to declare instance and static members of the class. Property member declarations are described in section [8.4](#8.4) and index member declarations are described in section [8.5](#8.5). + +## 8.2 Members + +The members of a class consist of the members introduced through member declarations in the class body and the members inherited from the base class. + +### 8.2.1 Instance and Static Members + +Members are either ***instance members*** or ***static members***. + +Instance members are members of the class type (section [8.2.4](#8.2.4)) and its associated instance type. Within constructors, instance member functions, and instance member accessors, the type of `this` is the instance type (section [3.5.1](#3.5.1)) of the class. + +Static members are declared using the `static` modifier and are members of the constructor function type (section [8.2.5](#8.2.5)). Within static member functions and static member accessors, the type of `this` is the constructor function type. + +Class type parameters cannot be referenced in static member declarations. + +### 8.2.2 Accessibility + +Property members have either ***public***, ***private***, or ***protected*** accessibility. The default is public accessibility, but property member declarations may include a `public`, `private`, or `protected` modifier to explicitly specify the desired accessibility. + +Public property members can be accessed everywhere without restrictions. + +Private property members can be accessed only within their declaring class. Specifically, a private member *M* declared in a class *C* can be accessed only within the class body of *C*. + +Protected property members can be accessed only within their declaring class and classes derived from their declaring class, and a protected instance property member must be accessed *through* an instance of the enclosing class. Specifically, a protected member *M* declared in a class *C* can be accessed only within the class body of *C* or the class body of a class derived from *C*. Furthermore, when a protected instance member *M* is accessed in a property access *E*`.`*M* within the body of a class *D*, the type of *E* is required to be *D* or a type that directly or indirectly has *D* as a base type, regardless of type arguments. + +Private and protected accessibility is enforced only at compile-time and serves as no more than an *indication of intent*. Since JavaScript provides no mechanism to create private and protected properties on an object, it is not possible to enforce the private and protected modifiers in dynamic code at run-time. For example, private and protected accessibility can be defeated by changing an object’s static type to Any and accessing the member dynamically. + +The following example demonstrates private and protected accessibility: + +```TypeScript +class A { + private x: number; + protected y: number; + static f(a: A, b: B) { + a.x = 1; // Ok + b.x = 1; // Ok + a.y = 1; // Ok + b.y = 1; // Ok + } +} + +class B extends A { + static f(a: A, b: B) { + a.x = 1; // Error, x only accessible within A + b.x = 1; // Error, x only accessible within A + a.y = 1; // Error, y must be accessed through instance of B + b.y = 1; // Ok + } +} +``` + +In class ‘A’, the accesses to ‘x’ are permitted because ‘x’ is declared in ‘A’, and the accesses to ‘y’ are permitted because both take place through an instance of ‘A’ or a type derived from ‘A’. In class ‘B’, access to ‘x’ is not permitted, and the first access to ‘y’ is an error because it takes place through an instance of ‘A’, which is not derived from the enclosing class ‘B’. + +### 8.2.3 Inheritance and Overriding + +A derived class ***inherits*** all members from its base class it doesn’t ***override***. Inheritance means that a derived class implicitly contains all non-overridden members of the base class. Only public and protected property members can be overridden. + +A property member in a derived class is said to override a property member in a base class when the derived class property member has the same name and kind (instance or static) as the base class property member. The type of an overriding property member must be assignable (section [3.8.4](#3.8.4)) to the type of the overridden property member, or otherwise a compile-time error occurs. + +Base class instance member functions can be overridden by derived class instance member functions, but not by other kinds of members. + +Base class instance member variables and accessors can be overridden by derived class instance member variables and accessors, but not by other kinds of members. + +Base class static property members can be overridden by derived class static property members of any kind as long as the types are compatible, as described above. + +An index member in a derived class is said to override an index member in a base class when the derived class index member is of the same index kind (string or numeric) as the base class index member. The type of an overriding index member must be assignable (section [3.8.4](#3.8.4)) to the type of the overridden index member, or otherwise a compile-time error occurs. + +### 8.2.4 Class Types + +A class declaration declares a new named type (section [3.5](#3.5)) called a class type. Within the constructor and member functions of a class, the type of `this` is the instance type (section [3.5.1](#3.5.1)) of this class type. The class type has the following members: + +* A property for each instance member variable declaration in the class body. +* A property of a function type for each instance member function declaration in the class body. +* A property for each uniquely named instance member accessor declaration in the class body. +* A property for each constructor parameter declared with a `public`, `private`, or `protected` modifier. +* An index signature for each instance index member declaration in the class body. +* All base class instance type property or index members that are not overridden in the class. + +All instance property members (including those that are private or protected) of a class must satisfy the constraints implied by the index members of the class as specified in section [3.7.4](#3.7.4). + +In the example + +```TypeScript +class A { + public x: number; + public f() { } + public g(a: any) { return undefined; } + static s: string; +} + +class B extends A { + public y: number; + public g(b: boolean) { return false; } +} +``` + +the instance type of ‘A’ is + +```TypeScript +interface A { + x: number; + f: () => void; + g: (a: any) => any; +} +``` + +and the instance type of ‘B’ is + +```TypeScript +interface B { + x: number; + y: number; + f: () => void; + g: (b: boolean) => boolean; +} +``` + +Note that static declarations in a class do not contribute to the class type and its instance type—rather, static declarations introduce properties on the constructor function object. Also note that the declaration of ‘g’ in ‘B’ overrides the member inherited from ‘A’. + +### 8.2.5 Constructor Function Types + +The type of the constructor function introduced by a class declaration is called the constructor function type. The constructor function type has the following members: + +* If the class contains no constructor declaration and has no base class, a single construct signature with no parameters, having the same type parameters as the class and returning the instance type of the class. +* If the class contains no constructor declaration and has a base class, a set of construct signatures with the same parameters as those of the base class constructor function type following substitution of type parameters with the type arguments specified in the base class type reference, all having the same type parameters as the class and returning the instance type of the class. +* If the class contains a constructor declaration with no overloads, a construct signature with the parameter list of the constructor implementation, having the same type parameters as the class and returning the instance type of the class. +* If the class contains a constructor declaration with overloads, a set of construct signatures with the parameter lists of the overloads, all having the same type parameters as the class and returning the instance type of the class. +* A property for each static member variable declaration in the class body. +* A property of a function type for each static member function declaration in the class body. +* A property for each uniquely named static member accessor declaration in the class body. +* A property named ‘prototype’, the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. +* All base class constructor function type properties that are not overridden in the class. + +Every class automatically contains a static property member named ‘prototype’, the type of which is the containing class with type Any substituted for each type parameter. + +The example + +```TypeScript +class Pair { + constructor(public item1: T1, public item2: T2) { } +} + +class TwoArrays extends Pair { } +``` + +introduces two named types corresponding to + +```TypeScript +interface Pair { + item1: T1; + item2: T2; +} + +interface TwoArrays { + item1: T[]; + item2: T[]; +} +``` + +and two constructor functions corresponding to + +```TypeScript +var Pair: { + new (item1: T1, item2: T2): Pair; +} + +var TwoArrays: { + new (item1: T[], item2: T[]): TwoArrays; +} +``` + +Note that the construct signatures in the constructor function types have the same type parameters as their class and return the instance type of their class. Also note that when a derived class doesn’t declare a constructor, type arguments from the base class reference are substituted before construct signatures are propagated from the base constructor function type to the derived constructor function type. + +## 8.3 Constructor Declarations + +A constructor declaration declares the constructor function of a class. + +  *ConstructorDeclaration:* +   *ConstructorOverloadsopt* *ConstructorImplementation* + +  *ConstructorOverloads:* +   *ConstructorOverload* +   *ConstructorOverloads* *ConstructorOverload* + +  *ConstructorOverload:* +   *AccessibilityModifieropt* `constructor` `(` *ParameterListopt* `)` `;` + +  *ConstructorImplementation:* +   *AccessibilityModifieropt* `constructor` `(` *ParameterListopt* `)` `{` *FunctionBody* `}` + +A class may contain at most one constructor declaration. If a class contains no constructor declaration, an automatic constructor is provided, as described in section [8.3.3](#8.3.3). + +Overloads and the implementation of a constructor may include an accessibility modifier, but only public constructors are supported and private or protected constructors result in an error. + +If a constructor declaration includes overloads, the overloads determine the construct signatures of the type given to the constructor function object, and the constructor implementation signature must be assignable to that type. Otherwise, the constructor implementation itself determines the construct signature. This exactly parallels the way overloads are processed in a function declaration (section [6.2](#6.2)). + +The function body of a constructor is permitted to contain return statements. If return statements specify expressions, those expressions must be of types that are assignable to the instance type of the class. + +The type parameters of a generic class are in scope and accessible in a constructor declaration. + +### 8.3.1 Constructor Parameters + +Similar to functions, only the constructor implementation (and not constructor overloads) can specify default value expressions for optional parameters. It is a compile-time error for such default value expressions to reference `this`. For each parameter with a default value, a statement that substitutes the default value for an omitted argument is included in the JavaScript generated for the constructor function. + +A parameter of a *ConstructorImplementation* may be prefixed with a `public`, `private`, or `protected` modifier. This is called a ***parameter property declaration*** and is shorthand for declaring a property with the same name as the parameter and initializing it with the value of the parameter. For example, the declaration + +```TypeScript +class Point { + constructor(public x: number, public y: number) { + // Constructor body + } +} +``` + +is equivalent to writing + +```TypeScript +class Point { + public x: number; + public y: number; + constructor(x: number, y: number) { + this.x = x; + this.y = y; + // Constructor body + } +} +``` + +### 8.3.2 Super Calls + +Super calls (section [4.8.1](#4.8.1)) are used to call the constructor of the base class. A super call consists of the keyword `super` followed by an argument list enclosed in parentheses. For example: + +```TypeScript +class ColoredPoint extends Point { + constructor(x: number, y: number, public color: string) { + super(x, y); + } +} +``` + +Constructors of classes with no `extends` clause may not contain super calls, whereas constructors of derived classes must contain at least one super call somewhere in their function body. Super calls are not permitted outside constructors or in local functions inside constructors. + +The first statement in the body of a constructor *must* be a super call if both of the following are true: + +* The containing class is a derived class. +* The constructor declares parameter properties or the containing class declares instance member variables with initializers. + +In such a required super call, it is a compile-time error for argument expressions to reference `this`. + +Initialization of parameter properties and instance member variables with initializers takes place immediately at the beginning of the constructor body if the class has no base class, or immediately following the super call if the class is a derived class. + +### 8.3.3 Automatic Constructors + +If a class omits a constructor declaration, an ***automatic constructor*** is provided. + +In a class with no `extends` clause, the automatic constructor has no parameters and performs no action other than executing the instance member variable initializers (section [8.4.1](#8.4.1)), if any. + +In a derived class, the automatic constructor has the same parameter list (and possibly overloads) as the base class constructor. The automatically provided constructor first forwards the call to the base class constructor using a call equivalent to + +```TypeScript +BaseClass.apply(this, arguments); +``` + +and then executes the instance member variable initializers, if any. + +## 8.4 Property Member Declarations + +Property member declarations can be member variable declarations, member function declarations, or member accessor declarations. + +  *PropertyMemberDeclaration:* +   *MemberVariableDeclaration* +   *MemberFunctionDeclaration* +   *MemberAccessorDeclaration* + +Member declarations without a `static` modifier are called instance member declarations. Instance property member declarations declare properties in the class instance type (section [8.2.4](#8.2.4)), and must specify names that are unique among all instance property member and parameter property declarations in the containing class, with the exception that instance get and set accessor declarations may pairwise specify the same name. + +Member declarations with a `static` modifier are called static member declarations. Static property member declarations declare properties in the constructor function type (section [8.2.5](#8.2.5)), and must specify names that are unique among all static property member declarations in the containing class, with the exception that static get and set accessor declarations may pairwise specify the same name. + +Note that the declaration spaces of instance and static property members are separate. Thus, it is possible to have instance and static property members with the same name. + +Except for overrides, as described in section [8.2.3](#8.2.3), it is an error for a derived class to declare a property member with the same name and kind (instance or static) as a base class member. + +Every class automatically contains a static property member named ‘prototype’, the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. It is an error to explicitly declare a static property member with the name ‘prototype’. + +Below is an example of a class containing both instance and static property member declarations: + +```TypeScript +class Point { + constructor(public x: number, public y: number) { } + public distance(p: Point) { + var dx = this.x - p.x; + var dy = this.y - p.y; + return Math.sqrt(dx * dx + dy * dy); + } + static origin = new Point(0, 0); + static distance(p1: Point, p2: Point) { return p1.distance(p2); } +} +``` + +The class instance type ‘Point’ has the members: + +```TypeScript +interface Point { + x: number; + y: number; + distance(p: Point); +} +``` + +and the constructor function ‘Point’ has a type corresponding to the declaration: + +```TypeScript +var Point: { + new(x: number, y: number): Point; + origin: Point; + distance(p1: Point, p2: Point): number; +} +``` + +### 8.4.1 Member Variable Declarations + +A member variable declaration declares an instance member variable or a static member variable. + +  *MemberVariableDeclaration:* +   *AccessibilityModifieropt* `static`*opt* *PropertyName* *TypeAnnotationopt* *Initialiseropt* `;` + +The type associated with a member variable declaration is determined in the same manner as an ordinary variable declaration (see section [5.1](#5.1)). + +An instance member variable declaration introduces a member in the class instance type and optionally initializes a property on instances of the class. Initializers in instance member variable declarations are executed once for every new instance of the class and are equivalent to assignments to properties of `this` in the constructor. In an initializer expression for an instance member variable, `this` is of the class instance type. + +A static member variable declaration introduces a property in the constructor function type and optionally initializes a property on the constructor function object. Initializers in static member variable declarations are executed once when the containing program or module is loaded. + +Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. This effectively means that entities from outer scopes by the same name as a constructor parameter or local variable are inaccessible in initializer expressions for instance member variables. + +Since instance member variable initializers are equivalent to assignments to properties of `this` in the constructor, the example + +```TypeScript +class Employee { + public name: string; + public address: string; + public retired = false; + public manager: Employee = null; + public reports: Employee[] = []; +} +``` + +is equivalent to + +```TypeScript +class Employee { + public name: string; + public address: string; + public retired: boolean; + public manager: Employee; + public reports: Employee[]; + constructor() { + this.retired = false; + this.manager = null; + this.reports = []; + } +} +``` + +### 8.4.2 Member Function Declarations + +A member function declaration declares an instance member function or a static member function. + +  *MemberFunctionDeclaration:* +   *MemberFunctionOverloadsopt* *MemberFunctionImplementation* + +  *MemberFunctionOverloads*: +   *MemberFunctionOverload* +   *MemberFunctionOverloads* *MemberFunctionOverload* + +  *MemberFunctionOverload*: +   *AccessibilityModifieropt* `static`*opt* *PropertyName* *CallSignature* `;` + +  *MemberFunctionImplementation:* +   *AccessibilityModifieropt* `static`*opt* *PropertyName* *CallSignature* `{` *FunctionBody* `}` + +A member function declaration is processed in the same manner as an ordinary function declaration (section [6](#6)), except that in a member function `this` has a known type. + +All overloads of a member function must have the same accessibility (public, private, or protected) and kind (instance or static). + +An instance member function declaration declares a property in the class instance type and assigns a function object to a property on the prototype object of the class. In the body of an instance member function declaration, `this` is of the class instance type. + +A static member function declaration declares a property in the constructor function type and assigns a function object to a property on the constructor function object. In the body of a static member function declaration, the type of `this` is the constructor function type. + +A member function can access overridden base class members using a super property access (section [4.8.2](#4.8.2)). For example + +```TypeScript +class Point { + constructor(public x: number, public y: number) { } + public toString() { + return "x=" + this.x + " y=" + this.y; + } +} + +class ColoredPoint extends Point { + constructor(x: number, y: number, public color: string) { + super(x, y); + } + public toString() { + return super.toString() + " color=" + this.color; + } +} +``` + +In a static member function, `this` represents the constructor function object on which the static member function was invoked. Thus, a call to ‘new this()’ may actually invoke a derived class constructor: + +```TypeScript +class A { + a = 1; + static create() { + return new this(); + } +} + +class B extends A { + b = 2; +} + +var x = A.create(); // new A() +var y = B.create(); // new B() +``` + +Note that TypeScript doesn’t require or verify that derived constructor functions are subtypes of base constructor functions. In other words, changing the declaration of ‘B’ to + +```TypeScript +class B extends A { + constructor(public b: number) { + super(); + } +} +``` + +does not cause errors in the example, even though the call to the constructor from the ‘create’ function doesn’t specify an argument (thus giving the value ‘undefined’ to ‘b’). + +### 8.4.3 Member Accessor Declarations + +A member accessor declaration declares an instance member accessor or a static member accessor. + +  *MemberAccessorDeclaration:* +   *AccessibilityModifieropt* `static`*opt* *GetAccessor* +   *AccessibilityModifieropt* `static`*opt* *SetAccessor* + +Get and set accessors are processed in the same manner as in an object literal (section [4.5](#4.5)), except that a contextual type is never available in a member accessor declaration. + +Accessors for the same member name must specify the same accessibility. + +An instance member accessor declaration declares a property in the class instance type and defines a property on the prototype object of the class with a get or set accessor. In the body of an instance member accessor declaration, `this` is of the class instance type. + +A static member accessor declaration declares a property in the constructor function type and defines a property on the constructor function object of the class with a get or set accessor. In the body of a static member accessor declaration, the type of `this` is the constructor function type. + +Get and set accessors are emitted as calls to ‘Object.defineProperty’ in the generated JavaScript, as described in section [8.6.1](#8.6.1). + +## 8.5 Index Member Declarations + +An index member declaration introduces an index signature (section [3.7.4](#3.7.4)) in the class instance type. + +  *IndexMemberDeclaration:* +   *IndexSignature* `;` + +Index member declarations have no body and cannot specify an accessibility modifier. + +A class declaration can have at most one string index member declaration and one numeric index member declaration. All instance property members of a class must satisfy the constraints implied by the index members of the class as specified in section [3.7.4](#3.7.4). + +It is not possible to declare index members for the static side of a class. + +Note that it is seldom meaningful to include a string index signature in a class because it constrains all instance properties of the class. However, numeric index signatures can be useful to control the element type when a class is used in an array-like manner. + +## 8.6 Code Generation + +This section describes the structure of the JavaScript code generated from TypeScript classes. + +### 8.6.1 Classes Without Extends Clauses + +A class with no `extends` clause generates JavaScript equivalent to the following: + +```TypeScript +var = (function () { + function () { + + + + + } + + + return ; +})(); +``` + +*ClassName* is the name of the class. + +*ConstructorParameters* is a comma separated list of the constructor’s parameter names. + +*DefaultValueAssignments* is a sequence of default property value assignments corresponding to those generated for a regular function declaration, as described in section [6.5](#6.5). + +*ParameterPropertyAssignments* is a sequence of assignments, one for each parameter property declaration in the constructor, in order they are declared, of the form + +```TypeScript +this. = ; +``` + +where *ParameterName* is the name of a parameter property. + +*MemberVariableAssignments* is a sequence of assignments, one for each instance member variable declaration with an initializer, in the order they are declared, of the form + +```TypeScript +this. = ; +``` + +where *MemberName* is the name of the member variable and *InitializerExpression* is the code generated for the initializer expression. + +*ConstructorStatements* is the code generated for the statements specified in the constructor body. + +*MemberFunctionStatements* is a sequence of statements, one for each member function declaration or member accessor declaration, in the order they are declared. + +An instance member function declaration generates a statement of the form + +```TypeScript +.prototype. = function () { + + +} +``` + +and static member function declaration generates a statement of the form + +```TypeScript +. = function () { + + +} +``` + +where *MemberName* is the name of the member function, and *FunctionParameters*, *DefaultValueAssignments*, and *FunctionStatements* correspond to those generated for a regular function declaration, as described in section [6.5](#6.5). + +A get or set instance member accessor declaration, or a pair of get and set instance member accessor declarations with the same name, generates a statement of the form + +```TypeScript +Object.defineProperty(.prototype, "", { + get: function () { + + }, + set: function () { + + }, + enumerable: true, + configurable: true +}; +``` + +and a get or set static member accessor declaration, or a pair of get and set static member accessor declarations with the same name, generates a statement of the form + +```TypeScript +Object.defineProperty(, "", { + get: function () { + + }, + set: function () { + + }, + enumerable: true, + configurable: true +}; +``` + +where *MemberName* is the name of the member accessor, *GetAccessorStatements* is the code generated for the statements in the get acessor’s function body, *ParameterName* is the name of the set accessor parameter, and *SetAccessorStatements* is the code generated for the statements in the set accessor’s function body. The ‘get’ property is included only if a get accessor is declared and the ‘set’ property is included only if a set accessor is declared. + +*StaticVariableAssignments* is a sequence of statements, one for each static member variable declaration with an initializer, in the order they are declared, of the form + +```TypeScript +. = ; +``` + +where *MemberName* is the name of the static variable, and *InitializerExpression* is the code generated for the initializer expression. + +### 8.6.2 Classes With Extends Clauses + +A class with an `extends` clause generates JavaScript equivalent to the following: + +```TypeScript +var = (function (_super) { + __extends(, _super); + function () { + + + + + + } + + + return ; +})(); +``` + +In addition, the ‘__extends’ function below is emitted at the beginning of the JavaScript source file. It copies all properties from the base constructor function object to the derived constructor function object (in order to inherit static members), and appropriately establishes the ‘prototype’ property of the derived constructor function object. + +```TypeScript +var __extends = this.__extends || function(d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function f() { this.constructor = d; } + f.prototype = b.prototype; + d.prototype = new f(); +} +``` + +*BaseClassName* is the class name specified in the `extends` clause. + +If the class has no explicitly declared constructor, the *SuperCallStatement* takes the form + +```TypeScript +_super.apply(this, arguments); +``` + +Otherwise the *SuperCallStatement* is present if the constructor function is required to start with a super call, as discussed in section [8.3.2](#8.3.2), and takes the form + +```TypeScript +_super.call(this, ) +``` + +where *SuperCallArguments* is the argument list specified in the super call. Note that this call precedes the code generated for parameter properties and member variables with initializers. Super calls elsewhere in the constructor generate similar code, but the code generated for such calls will be part of the *ConstructorStatements* section. + +A super property access in the constructor, an instance member function, or an instance member accessor generates JavaScript equivalent to + +```TypeScript +_super.prototype. +``` + +where *PropertyName* is the name of the referenced base class property. When the super property access appears in a function call, the generated JavaScript is equivalent to + +```TypeScript +_super.prototype..call(this, ) +``` + +where Arguments is the code generated for the argument list specified in the function call. + +A super property access in a static member function or a static member accessor generates JavaScript equivalent to + +```TypeScript +_super. +``` + +where *PropertyName* is the name of the referenced base class property. When the super property access appears in a function call, the generated JavaScript is equivalent to + +```TypeScript +_super..call(this, ) +``` + +where Arguments is the code generated for the argument list specified in the function call. + +
+ +#
9 Enums + +An enum type is a distinct subtype of the Number primitive type with an associated set of named constants that define the possible values of the enum type. + +## 9.1 Enum Declarations + +An enum declaration declares an ***enum type*** and an ***enum object*** in the containing module. + +  *EnumDeclaration:* +   `enum` *Identifier* `{` *EnumBodyopt* `}` + +The enum type and enum object declared by an *EnumDeclaration* both have the name given by the *Identifier* of the declaration. The enum type is a distinct subtype of the Number primitive type. The enum object is a variable of an anonymous object type containing a set of properties, all of the enum type, corresponding to the values declared for the enum type in the body of the declaration. The enum object’s type furthermore includes a numeric index signature with the signature ‘[x: number]: string’. + +The *Identifier* of an enum declaration may not be one of the predefined type names (section [3.6.1](#3.6.1)). + +The example + +```TypeScript +enum Color { Red, Green, Blue } +``` + +declares a subtype of the Number primitive type called ‘Color’ and introduces a variable ‘Color’ with a type that corresponds to the declaration + +```TypeScript +var Color: { + [x: number]: string; + Red: Color; + Green: Color; + Blue: Color; +}; +``` + +The numeric index signature reflects a “reverse mapping” that is automatically generated in every enum object, as described in section [9.4](#9.4). The reverse mapping provides a convenient way to obtain the string representation of an enum value. For example + +```TypeScript +var c = Color.Red; +console.log(Color[c]); // Outputs "Red" +``` + +## 9.2 Enum Members + +The body of an enum declaration defines zero or more enum members which are the named values of the enum type. Each enum member has an associated numeric value of the primitive type introduced by the enum declaration. + +  *EnumBody*: +   *ConstantEnumMembers* `,`*opt* +   *ConstantEnumMembers* `,` *EnumMemberSections* `,`*opt* +   *EnumMemberSections* `,`*opt* + +  *ConstantEnumMembers:* +   *PropertyName* +   *ConstantEnumMembers* `,` *PropertyName* + +  *EnumMemberSections:* +   *EnumMemberSection* +   *EnumMemberSections* `,` *EnumMemberSection* + +  *EnumMemberSection:* +   *ConstantEnumMemberSection* +   *ComputedEnumMember* + +  *ConstantEnumMemberSection:* +   *PropertyName* `=` *ConstantEnumValue* +   *PropertyName* `=` *ConstantEnumValue* `,` *ConstantEnumMembers* + +  *ConstantEnumValue:* +   *SignedInteger* +   *HexIntegerLiteral* + +  *ComputedEnumMember:* +   *PropertyName* `=` *AssignmentExpression* + +Enum members are either ***constant members*** or ***computed members***. Constant members have known constant values that are substituted in place of references to the members in the generated JavaScript code. Computed members have values that are computed at run-time and not known at compile-time. No substitution is performed for references to computed members. + +The body of an enum declaration consists of an optional *ConstantEnumMembers* production followed by any number of *ConstantEnumMemberSection* or *ComputedEnumMember* productions. + +* If present, the initial *ConstantEnumMembers* production introduces a series of constant members with consecutive integral values starting at the value zero. +* A *ConstantEnumMemberSection* introduces one or more constant members with consecutive integral values starting at the specified constant value. +* A *ComputedEnumMember* introduces a computed member with a value computed by an expression. + +Expressions specified for computed members must produce values of type Any, the Number primitive type, or the enum type itself. + +In the example + +```TypeScript +enum Test { + A, + B, + C = Math.floor(Math.random() * 1000), + D = 10, + E +} +``` + +‘A’, ‘B’, ‘D’, and ‘E’ are constant members with values 0, 1, 10, and 11 respectively, and ‘C’ is a computed member. + +In the example + +```TypeScript +enum Style { + None = 0, + Bold = 1, + Italic = 2, + Underline = 4, + Emphasis = Bold | Italic, + Hyperlink = Bold | Underline +} +``` + +the first four members are constant members and the last two are computed members. Note that computed member declarations can reference other enum members without qualification. Also, because enums are subtypes of the Number primitive type, numeric operators, such as the bitwise OR operator, can be used to compute enum values. + +## 9.3 Declaration Merging + +Enums are “open-ended” and enum declarations with the same qualified name relative to a common root (as defined in section [2.3](#2.3)) define a single enum type and contribute to a single enum object. + +It isn’t possible for one enum declaration to continue the automatic numbering sequence of another, and when an enum type has multiple declarations, only one declaration is permitted to omit a value for the first member. + +## 9.4 Code Generation + +An enum declaration generates JavaScript equivalent to the following: + +```TypeScript +var ; +(function () { + +})(||(={})); +``` + +*EnumName* is the name of the enum. + +*EnumMemberAssignments* is a sequence of assignments, one for each enum member, in order they are declared, of the form + +```TypeScript +[[""] = ] = ""; +``` + +where *MemberName* is the name of the enum member and *Value* is the assigned constant value or the code generated for the computed value expression. + +For example, the ‘Color’ enum example from section [9.1](#9.1) generates the following JavaScript: + +```TypeScript +var Color; +(function (Color) { + Color[Color["Red"] = 0] = "Red"; + Color[Color["Green"] = 1] = "Green"; + Color[Color["Blue"] = 2] = "Blue"; +})(Color||(Color={})); +``` + +
+ +#
10 Internal Modules + +An internal module is a named container of statements and declarations. An internal module represents both a namespace and a singleton module instance. The namespace contains named types and other namespaces, and the singleton module instance contains properties for the module’s exported members. The body of an internal module corresponds to a function that is executed once, thereby providing a mechanism for maintaining local state with assured isolation. + +## 10.1 Module Declarations + +An internal module declaration declares a namespace name and, in the case of an instantiated module, a member name in the containing module. + +  *ModuleDeclaration:* +   `module` *IdentifierPath* `{` *ModuleBody* `}` + +  *IdentifierPath:* +   *Identifier* +   *IdentifierPath* `.` *Identifier* + +Internal modules are either ***instantiated*** or ***non-instantiated***. A non-instantiated module is an internal module containing only interface types and other non-instantiated modules. An instantiated module is an internal module that doesn’t meet this definition. In intuitive terms, an instantiated module is one for which a module object instance is created, whereas a non-instantiated module is one for which no code is generated. + +When a module identifier is referenced as a *ModuleName* (section [3.6.2](#3.6.2)) it denotes a container of module and type names, and when a module identifier is referenced as a *PrimaryExpression* (section [4.3](#4.3)) it denotes the singleton module instance. For example: + +```TypeScript +module M { + export interface P { x: number; y: number; } + export var a = 1; +} + +var p: M.P; // M used as ModuleName +var m = M; // M used as PrimaryExpression +var x1 = M.a; // M used as PrimaryExpression +var x2 = m.a; // Same as M.a +var q: m.P; // Error +``` + +Above, when ‘M’ is used as a *PrimaryExpression* it denotes an object instance with a single member ‘a’ and when ‘M’ is used as a *ModuleName* it denotes a container with a single type member ‘P’. The final line in the example is an error because ‘m’ is a variable which cannot be referenced in a type name. + +If the declaration of ‘M’ above had excluded the exported variable ‘a’, ‘M’ would be a non-instantiated module and it would be an error to reference ‘M’ as a *PrimaryExpression*. + +An internal module declaration that specifies an *IdentifierPath* with more than one identifier is equivalent to a series of nested single-identifier internal module declarations where all but the outermost are automatically exported. For example: + +```TypeScript +module A.B.C { + export var x = 1; +} +``` + +corresponds to + +```TypeScript +module A { + export module B { + export module C { + export var x = 1; + } + } +} +``` + +## 10.2 Module Body + +The body of an internal module corresponds to a function that is executed once to initialize the module instance. + +  *ModuleBody:* +   *ModuleElementsopt* + +  *ModuleElements:* +   *ModuleElement* +   *ModuleElements* *ModuleElement* + +  *ModuleElement:* +   *Statement* +   `export`*opt* *VariableDeclaration* +   `export`*opt* *FunctionDeclaration* +   `export`*opt* *ClassDeclaration* +   `export`*opt* *InterfaceDeclaration* +   `export`*opt* *EnumDeclaration* +   `export`*opt* *ModuleDeclaration* +   `export`*opt* *ImportDeclaration* +   `export`*opt* *AmbientDeclaration* + +Each module body has a declaration space for local variables (including functions, modules, class constructor functions, and enum objects), a declaration space for local named types (classes, interfaces, and enums), and a declaration space for local namespaces (containers of named types). Every declaration (whether local or exported) in a module contributes to one or more of these declaration spaces. + +## 10.3 Import Declarations + +Import declarations are used to create local aliases for entities in other modules. + +  *ImportDeclaration:* +   `import` *Identifier* `=` *EntityName* `;` + +  *EntityName:* +   *ModuleName* +   *ModuleName* `.` *Identifier* + +An *EntityName* consisting of a single identifier is resolved as a *ModuleName* and is thus required to reference an internal module. The resulting local alias references the given internal module and is itself classified as an internal module. + +An *EntityName* consisting of more than one identifier is resolved as a *ModuleName* followed by an identifier that names one or more exported entities in the given module. The resulting local alias has all the meanings and classifications of the referenced entity or entities. (As many as three distinct meanings are possible for an entity name—namespace, type, and member.) In effect, it is as if the imported entity or entities were declared locally with the local alias name. + +In the example + +```TypeScript +module A { + export interface X { s: string } + export var X: X; +} + +module B { + interface A { n: number } + import Y = A; // Alias only for module A + import Z = A.X; // Alias for both type and member A.X + var v: Z = Z; +} +``` + +within ‘B’, ‘Y’ is an alias only for module ‘A’ and not the local interface ‘A’, whereas ‘Z’ is an alias for all exported meanings of ‘A.X’, thus denoting both an interface type and a variable. + +If the *ModuleName* portion of an *EntityName* references an instantiated module, the *ModuleName* is required to reference the module instance when evaluated as an expression. In the example + +```TypeScript +module A { + export interface X { s: string } +} + +module B { + var A = 1; + import Y = A; +} +``` + +‘Y’ is a local alias for the non-instantiated module ‘A’. If the declaration of ‘A’ is changed such that ‘A’ becomes an instantiated module, for example by including a variable declaration in ‘A’, the import statement in ‘B’ above would be an error because the expression ‘A’ doesn’t reference the module instance of module ‘A’. + +When an import statement includes an export modifier, all meanings of the local alias are exported. + +## 10.4 Export Declarations + +An export declaration declares an externally accessible module member. An export declaration is simply a regular declaration prefixed with the keyword `export`. + +Exported class, interface, and enum types can be accessed as a *TypeName* (section [3.6.2](#3.6.2)) of the form *M.T*, where *M* is a reference to the containing module and *T* is the exported type name. Likewise, as part of a *TypeName*, exported modules can be accessed as a *ModuleName* of the form *M.N*, where *M* is a reference to the containing module and *N* is the exported module. + +Exported variable, function, class, enum, module, and import alias declarations become properties on the module instance and together establish the module’s ***instance type***. This unnamed type has the following members: + +* A property for each exported variable declaration. +* A property of a function type for each exported function declaration. +* A property of a constructor type for each exported class declaration. +* A property of an object type for each exported enum declaration. +* A property of an object type for each exported instantiated module declaration. +* A property for each exported import alias that references a variable, function, class, enum, or instantiated module. + +An exported member depends on a (possibly empty) set of named types (section [3.5](#3.5)). Those named types must be at least as accessible as the exported member, or otherwise an error occurs. + +The named types upon which a member depends are the named types occurring in the transitive closure of the ***directly depends on*** relationship defined as follows: + +* A variable directly depends on the *Type* specified in its type annotation. +* A function directly depends on each *Type* specified in a parameter or return type annotation. +* A class directly depends on each *Type* specified as a type parameter constraint, each *TypeReference* specified as a base class or implemented interface, and each *Type* specified in a constructor parameter type annotation, public member variable type annotation, public member function parameter or return type annotation, public member accessor parameter or return type annotation, or index signature type annotation. +* An interface directly depends on each *Type* specified as a type parameter constraint, each *TypeReference* specified as a base interface, and the *ObjectType* specified as its body. +* A module directly depends on its exported members. +* A *Type* or *ObjectType* directly depends on every *TypeReference* that occurs within the type at any level of nesting. +* A *TypeReference* directly depends on the type it references and on each *Type* specified as a type argument. + +A named type *T* having a root module *R* (section [2.3](#2.3)) is said to be ***at least as accessible as*** a member *M* if + +* *R* is the global module or an external module, or +* *R* is an internal module in the parent module chain of *M*. + +In the example + +```TypeScript +interface A { x: string; } + +module M { + export interface B { x: A; } + export interface C { x: B; } + export function foo(c: C) { … } +} +``` + +the ‘foo’ function depends upon the named types ‘A’, ‘B’, and ‘C’. In order to export ‘foo’ it is necessary to also export ‘B’ and ‘C’ as they otherwise would not be at least as accessible as ‘foo’. The ‘A’ interface is already at least as accessible as ‘foo’ because it is declared in a parent module of foo’s module. + +## 10.5 Declaration Merging + +Internal modules are “open-ended” and internal module declarations with the same qualified name relative to a common root (as defined in section [2.3](#2.3)) contribute to a single module. For example, the following two declarations of a module outer might be located in separate source files. + +File a.ts: + +```TypeScript +module outer { + var local = 1; // Non-exported local variable + export var a = local; // outer.a + export module inner { + export var x = 10; // outer.inner.x + } +} +``` + +File b.ts: + +```TypeScript +module outer { + var local = 2; // Non-exported local variable + export var b = local; // outer.b + export module inner { + export var y = 20; // outer.inner.y + } +} +``` + +Assuming the two source files are part of the same program, the two declarations will have the global module as their common root and will therefore contribute to the same module instance, the instance type of which will be: + +```TypeScript +{ + a: number; + b: number; + inner: { + x: number; + y: number; + }; +} +``` + +Declaration merging does not apply to local aliases created by import declarations. In other words, it is not possible have an import declaration and a module declaration for the same name within the same module body. + +Declaration merging also extends to internal module declarations with the same qualified name relative to a common root as a function, class, or enum declaration: + +* When merging a function and an internal module, the type of the function object is merged with the instance type of the module. In effect, the overloads or implementation of the function provide the call signatures and the exported members of the module provide the properties of the combined type. +* When merging a class and an internal module, the type of the constructor function object is merged with the instance type of the module. In effect, the overloads or implementation of the class constructor provide the construct signatures, and the static members of the class and exported members of the module provide the properties of the combined type. It is an error to have static class members and exported module members with the same name. +* When merging an enum and an internal module, the type of the enum object is merged with the instance type of the module. In effect, the members of the enum and the exported members of the module provide the properties of the combined type. It is an error to have enum members and exported module members with the same name. + +When merging a non-ambient function or class declaration and a non-ambient internal module declaration, the function or class declaration must be located prior to the internal module declaration in the same source file. This ensures that the shared object instance is created as a function object. (While it is possible to add properties to an object after its creation, it is not possible to make an object “callable” after the fact.) + +The example + +```TypeScript +interface Point { + x: number; + y: number; +} + +function point(x: number, y: number): Point { + return { x: x, y: y }; +} + +module point { + export var origin = point(0, 0); + export function equals(p1: Point, p2: Point) { + return p1.x == p2.x && p1.y == p2.y; + } +} + +var p1 = point(0, 0); +var p2 = point.origin; +var b = point.equals(p1, p2); +``` + +declares ‘point’ as a function object with two properties, ‘origin’ and ‘equals’. Note that the module declaration for ‘point’ is located after the function declaration. + +## 10.6 Code Generation + +An internal module generates JavaScript code that is equivalent to the following: + +```TypeScript +var ; +(function() { + +})(||(={})); +``` + +where *ModuleName* is the name of the module and *ModuleStatements* is the code generated for the statements in the module body. The *ModuleName* function parameter may be prefixed with one or more underscore characters to ensure the name is unique within the function body. Note that the entire module is emitted as an anonymous function that is immediately executed. This ensures that local variables are in their own lexical environment isolated from the surrounding context. Also note that the generated function doesn’t create and return a module instance, but rather it extends the existing instance (which may have just been created in the function call). This ensures that internal modules can extend each other. + +An import statement generates code of the form + +```TypeScript +var = ; +``` + +This code is emitted only if the imported entity is referenced as a *PrimaryExpression* somewhere in the body of the importing module. If an imported entity is referenced only as a *TypeName* or *ModuleName*, nothing is emitted. This ensures that types declared in one internal module can be referenced through an import alias in another internal module with no run-time overhead. + +When a variable is exported, all references to the variable in the body of the module are replaced with + +```TypeScript +. +``` + +This effectively promotes the variable to be a property on the module instance and ensures that all references to the variable become references to the property. + +When a function, class, enum, or module is exported, the code generated for the entity is followed by an assignment statement of the form + +```TypeScript +. = ; +``` + +This copies a reference to the entity into a property on the module instance. + +
+ +#
11 Source Files and External Modules + +TypeScript implements external modules that are closely aligned with those proposed for ECMAScript 6 and supports code generation targeting CommonJS and AMD module systems. + +*NOTE: TypeScript currently doesn’t support the full proposed capabilities of the ECMAScript 6 import and export syntax. We expect to align more closely on the syntax as the ECMAScript 6 specification evolves*. + +## 11.1 Source Files + +A TypeScript ***program*** consists of one or more source files that are either ***implementation source files*** or ***declaration source files***. Source files with extension ‘.ts’ are *ImplementationSourceFiles* containing statements and declarations. Source files with extension ‘.d.ts’ are *DeclarationSourceFiles* containing declarations only. Declaration source files are a strict subset of implementation source files. + +  *SourceFile:* +   *ImplementationSourceFile* +   *DeclarationSourceFile* + +  *ImplementationSourceFile:* +   *ImplementationElementsopt* + +  *ImplementationElements:* +   *ImplementationElement* +   *ImplementationElements* *ImplementationElement* + +  *ImplementationElement:* +   *ModuleElement* +   *ExportAssignment* +   *AmbientExternalModuleDeclaration* +   `export`*opt* *ExternalImportDeclaration* + +  *DeclarationSourceFile:* +   *DeclarationElementsopt* + +  *DeclarationElements:* +   *DeclarationElement* +   *DeclarationElements* *DeclarationElement* + +  *DeclarationElement:* +   *ExportAssignment* +   *AmbientExternalModuleDeclaration* +   `export`*opt* *InterfaceDeclaration* +   `export`*opt* *ImportDeclaration* +   `export`*opt* *AmbientDeclaration* +   `export`*opt* *ExternalImportDeclaration* + +When a TypeScript program is compiled, all of the program’s source files are processed together. Statements and declarations in different source files can depend on each other, possibly in a circular fashion. By default, a JavaScript output file is generated for each implementation source file in a compilation, but no output is generated from declaration source files. + +The source elements permitted in a TypeScript implementation source file are a superset of those supported by JavaScript. Specifically, TypeScript extends the JavaScript grammar’s existing *VariableDeclaration* (section [5.1](#5.1)) and *FunctionDeclaration* (section [6.1](#6.1)) productions, and adds *InterfaceDeclaration* (section [7.1](#7.1)), *ClassDeclaration* (section [8.1](#8.1)), *EnumDeclaration* (section [9.1](#9.1)), *ModuleDeclaration* (section [10.1](#10.1)), *ImportDeclaration* (section [10.3](#10.3)), *ExternalImportDeclaration* (section [11.2.2](#11.2.2)), *ExportAssignment* (section [11.2.4](#11.2.4)), *AmbientDeclaration* (section [12.1](#12.1)), and *AmbientExternalModuleDeclaration* (section [12.2](#12.2)) productions. + +Declaration source files are restricted to contain declarations only. Declaration source files can be used to declare the static type information associated with existing JavaScript code in an adjunct manner. They are entirely optional but enable the TypeScript compiler and tools to provide better verification and assistance when integrating existing JavaScript code and libraries in a TypeScript application. + +Implementation and declaration source files that contain no import or export declarations form the single ***global module***. Entities declared in the global module are in scope everywhere in a program. Initialization order of the source files that make up the global module ultimately depends on the order in which the generated JavaScript files are loaded at run-time (which, for example, may be controlled by <script/> tags that reference the generated JavaScript files). + +Implementation and declaration source files that contain at least one external import declaration, export assignment, or top-level exported declaration are considered separate ***external modules***. Entities declared in an external module are in scope only in that module, but exported entities can be imported into other modules using import declarations. Initialization order of external modules is determined by the module loader being and is not specified by the TypeScript language. However, it is generally the case that non-circularly dependent modules are automatically loaded and initialized in the correct order. + +External modules can additionally be declared using *AmbientExternalModuleDeclarations* in the global module that directly specify the external module names as string literals. This is described further in section [12.2](#12.2). + +### 11.1.1 Source Files Dependencies + +The TypeScript compiler automatically determines a source file’s dependencies and includes those dependencies in the program being compiled. The determination is made from “reference comments” and external import declarations as follows: + +* A comment of the form /// <reference path="…"/> adds a dependency on the source file specified in the path argument. The path is resolved relative to the directory of the containing source file. +* An external import declaration that specifies a relative external module name (section [11.2.1](#11.2.1)) resolves the name relative to the directory of the containing source file. If a source file with the resulting path and file extension ‘.ts’ exists, that file is added as a dependency. Otherwise, if a source file with the resulting path and file extension ‘.d.ts’ exists, that file is added as a dependency. +* An external import declaration that specifies a top-level external module name (section [11.2.1](#11.2.1)) resolves the name in a host dependent manner (typically by resolving the name relative to a module name space root or searching for the name in a series of directories). If a source file with extension ‘.ts’ or ‘.d.ts’ corresponding to the reference is located, that file is added as a dependency. + +Any files included as dependencies in turn have their references analyzed in a transitive manner until all dependencies have been determined. + +## 11.2 External Modules + +External modules are separately loaded bodies of code referenced using external module names. External modules can be likened to functions that are loaded and executed once to initialize their associated module instance. Entities declared in an external module are private and inaccessible elsewhere unless they are exported. + +External modules are written as separate source files that contain at least one external import declaration, export assignment, or top-level exported declaration. Specifically, if a source file contains at least one + +* *ExternalImportDeclaration*, +* *ExportAssignment*, +* top-level exported *VariableDeclaration*, +* top-level exported *FunctionDeclaration*, +* top-level exported *ClassDeclaration*, +* top-level exported *InterfaceDeclaration*, +* top-level exported *EnumDeclaration*, +* top-level exported *ModuleDeclaration*, +* top-level exported *ImportDeclaration*, or +* top-level exported *AmbientDeclaration*, + +that source file is considered an external module; otherwise, the source file is considered part of the global module. + +Below is an example of two external modules written in separate source files. + +File main.ts: + +```TypeScript +import log = require("./log"); +log.message("hello"); +``` + +File log.ts: + +```TypeScript +export function message(s: string) { + console.log(s); +} +``` + +The import declaration in the ‘main’ module references the ‘log’ module and compiling the ‘main.ts’ file causes the ‘log.ts’ file to also be compiled as part of the program. At run-time, the import declaration loads the ‘log’ module and produces a reference to its module instance through which it is possible to reference the exported function. + +TypeScript supports two patterns of JavaScript code generation for external modules: The CommonJS Modules pattern (section [11.2.5](#11.2.5)), typically used by server frameworks such as node.js, and the Asynchronous Module Definition (AMD) pattern (section [11.2.6](#11.2.6)), an extension to CommonJS Modules that permits asynchronous module loading, as is typical in browsers. The desired module code generation pattern is selected through a compiler option and does not affect the TypeScript source code. Indeed, it is possible to author external modules that can be compiled for use both on the server side (e.g. using node.js) and on the client side (using an AMD compliant loader) with no changes to the TypeScript source code. + +### 11.2.1 External Module Names + +External modules are identified and referenced using external module names. The following definition is aligned with that provided in the CommonJS Modules 1.0 specification. + +* An external module name is a string of terms delimited by forward slashes. +* External module names may not have file-name extensions like “.js”. +* External module names may be relative or top-level. An external module name is relative if the first term is “.” or “..”. +* Top-level names are resolved off the conceptual module name space root. +* Relative names are resolved relative to the name of the module in which they occur. + +For purposes of resolving external module references, TypeScript associates a file path with every external module. The file path is simply the path of the module’s source file without the file extension. For example, an external module contained in the source file ‘C:\src\lib\io.ts’ has the file path ‘C:/src/lib/io’ and an external module contained in the source file ‘C:\src\ui\editor.d.ts’ has the file path ‘C:/src/ui/editor’. + +An external module name in an import declaration is resolved as follows: + +* If the import declaration specifies a relative external module name, the name is resolved relative to the directory of the referencing module’s file path. The program must contain a module with the resulting file path or otherwise an error occurs. For example, in a module with the file path ‘C:/src/ui/main’, the external module names ‘./editor’ and ‘../lib/io’ reference modules with the file paths ‘C:/src/ui/editor’ and ‘C:/src/lib/io’. +* If the import declaration specifies a top-level external module name and the program contains an *AmbientExternalModuleDeclaration* (section [12.2](#12.2)) with a string literal that specifies that exact name, then the import declaration references that ambient external module. +* If the import declaration specifies a top-level external module name and the program contains no *AmbientExternalModuleDeclaration* (section [12.2](#12.2)) with a string literal that specifies that exact name, the name is resolved in a host dependent manner (for example by considering the name relative to a module name space root). If a matching module cannot be found an error occurs. + +### 11.2.2 External Import Declarations + +External import declarations are used to import external modules and create local aliases by which they may be referenced. + +  *ExternalImportDeclaration:* +   `import` *Identifier* `=` *ExternalModuleReference* `;` + +  *ExternalModuleReference:* +   `require` `(` *StringLiteral* `)` + +The string literal specified in an *ExternalModuleReference* is interpreted as an external module name (section [11.2.1](#11.2.1)). + +An external import declaration introduces a local identifier that references a given external module. The local identifier becomes an alias for, and is classified exactly like, the entity or entities exported from the referenced external module. Specifically, if the referenced external module contains no export assignment the identifier is classified as a module, and if the referenced external module contains an export assignment the identifier is classified exactly like the entity or entities named in the export assignment. + +### 11.2.3 Export Declarations + +An external module that contains no export assignment (section [11.2.4](#11.2.4)) exports an entity classified as a module. Similarly to an internal module, export declarations (section [10.4](#10.4)) in the external module are used to declare the members of this entity. + +Unlike a non-instantiated internal module (section [10.1](#10.1)), an external module containing only interface types and non-instantiated internal modules still has a module instance associated with it, albeit one with no members. + +If an external module contains an export assignment it is an error for the external module to also contain export declarations. The two types of exports are mutually exclusive. + +### 11.2.4 Export Assignments + +An export assignment designates a module member as the entity to be exported in place of the external module itself. + +  *ExportAssignment:* +   `export` `=` *Identifier* `;` + +When an external module containing an export assignment is imported, the local alias introduced by the external import declaration takes on all meanings of the identifier named in the export assignment. + +It is an error for an external module to contain more than one export assignment. + +Assume the following example resides in the file ‘point.ts’: + +```TypeScript +export = Point; + +class Point { + constructor(public x: number, public y: number) { } + static origin = new Point(0, 0); +} +``` + +When ‘point.ts’ is imported in another external module, the import alias references the exported class and can be used both as a type and as a constructor function: + +```TypeScript +import Pt = require("./point"); + +var p1 = new Pt(10, 20); +var p2 = Pt.origin; +``` + +Note that there is no requirement that the import alias use the same name as the exported entity. + +### 11.2.5 CommonJS Modules + +The CommonJS Modules definition specifies a methodology for writing JavaScript modules with implied privacy, the ability to import other modules, and the ability to explicitly export members. A CommonJS compliant system provides a ‘require’ function that can be used to synchronously load other external modules to obtain their singleton module instance, as well as an ‘exports’ variable to which a module can add properties to define its external API. + +The ‘main’ and ‘log’ example from section [11.2](#11.2) above generates the following JavaScript code when compiled for the CommonJS Modules pattern: + +File main.js: + +```TypeScript +var log = require("./log"); +log.message("hello"); +``` + +File log.js: + +```TypeScript +exports.message = function(s) { + console.log(s); +} +``` + +An external import declaration is represented in the generated JavaScript as a variable initialized by a call to the ‘require’ function provided by the module system host. A variable declaration and ‘require’ call is emitted for a particular imported module only if the imported module, or a local alias (section [10.3](#10.3)) that references the imported module, is referenced as a *PrimaryExpression* somewhere in the body of the importing module. If an imported module is referenced only as a *ModuleName* or *TypeQueryExpression*, nothing is emitted. + +An example: + +File geometry.ts: + +```TypeScript +export interface Point { x: number; y: number }; + +export function point(x: number, y: number): Point { + return { x: x, y: y }; +} +``` + +File game.ts: + +```TypeScript +import g = require("./geometry"); +var p = g.point(10, 20); +``` + +The ‘game’ module references the imported ‘geometry’ module in an expression (through its alias ‘g’) and a ‘require’ call is therefore included in the emitted JavaScript: + +```TypeScript +var g = require("./geometry"); +var p = g.point(10, 20); +``` + +Had the ‘game’ module instead been written to only reference ‘geometry’ in a type position + +```TypeScript +import g = require("./geometry"); +var p: g.Point = { x: 10, y: 20 }; +``` + +the emitted JavaScript would have no dependency on the ‘geometry’ module and would simply be + +```TypeScript +var p = { x: 10, y: 20 }; +``` + +### 11.2.6 AMD Modules + +The Asynchronous Module Definition (AMD) specification extends the CommonJS Modules specification with a pattern for authoring asynchronously loadable modules with associated dependencies. Using the AMD pattern, modules are emitted as calls to a global ‘define’ function taking an array of dependencies, specified as external module names, and a callback function containing the module body. The global ‘define’ function is provided by including an AMD compliant loader in the application. The loader arranges to asynchronously load the module’s dependencies and, upon completion, calls the callback function passing resolved module instances as arguments in the order they were listed in the dependency array. + +The “main” and “log” example from above generates the following JavaScript code when compiled for the AMD pattern. + +File main.js: + +```TypeScript +define(["require", "exports", "./log"], function(require, exports, log) { + log.message("hello"); +} +``` + +File log.js: + +```TypeScript +define(["require", "exports"], function(require, exports) { + exports.message = function(s) { + console.log(s); + } +} +``` + +The special ‘require’ and ‘exports’ dependencies are always present. Additional entries are added to the dependencies array and the parameter list as required to represent imported external modules. Similar to the code generation for CommonJS Modules, a dependency entry is generated for a particular imported module only if the imported module is referenced as a *PrimaryExpression* somewhere in the body of the importing module. If an imported module is referenced only as a *ModuleName*, no dependency is generated for that module. + +
+ +#
12 Ambients + +Ambient declarations are used to provide static typing over existing JavaScript code. Ambient declarations differ from regular declarations in that no JavaScript code is emitted for them. Instead of introducing new variables, functions, classes, enums, or modules, ambient declarations provide type information for entities that exist “ambiently” and are included in a program by external means, for example by referencing a JavaScript library in a <script/> tag. + +## 12.1 Ambient Declarations + +Ambient declarations are written using the `declare` keyword and can declare variables, functions, classes, enums, internal modules, or external modules. + +  *AmbientDeclaration:* +   `declare` *AmbientVariableDeclaration* +   `declare` *AmbientFunctionDeclaration* +   `declare` *AmbientClassDeclaration* +   `declare` *AmbientEnumDeclaration* +   `declare` *AmbientModuleDeclaration* + +### 12.1.1 Ambient Variable Declarations + +An ambient variable declaration introduces a variable in the containing declaration space. + +  *AmbientVariableDeclaration:* +   `var` *Identifier*  *TypeAnnotationopt* `;` + +An ambient variable declaration may optionally include a type annotation. If no type annotation is present, the variable is assumed to have type Any. + +An ambient variable declaration does not permit an initializer expression to be present. + +### 12.1.2 Ambient Function Declarations + +An ambient function declaration introduces a function in the containing declaration space. + +  *AmbientFunctionDeclaration:* +   `function` *Identifier* *CallSignature* `;` + +Ambient functions may be overloaded by specifying multiple ambient function declarations with the same name, but it is an error to declare multiple overloads that are considered identical (section [3.8.2](#3.8.2)) or differ only in their return types. + +Ambient function declarations cannot specify a function bodies and do not permit default parameter values. + +### 12.1.3 Ambient Class Declarations + +An ambient class declaration declares a class instance type and a constructor function in the containing module. + +  *AmbientClassDeclaration:* +   `class` *Identifier* *TypeParametersopt* *ClassHeritage* `{` *AmbientClassBody* `}` + +  *AmbientClassBody:* +   *AmbientClassBodyElementsopt* + +  *AmbientClassBodyElements:* +   *AmbientClassBodyElement* +   *AmbientClassBodyElements* *AmbientClassBodyElement* + +  *AmbientClassBodyElement:* +   *AmbientConstructorDeclaration* +   *AmbientPropertyMemberDeclaration* +   *IndexSignature* + +  *AmbientConstructorDeclaration:* +   `constructor` `(` *ParameterListopt* `)` `;` + +  *AmbientPropertyMemberDeclaration:* +   *AccessibilityModifieropt* `static`*opt* *PropertyName* *TypeAnnotationopt* `;` +   *AccessibilityModifieropt* `static`*opt* *PropertyName* *CallSignature* `;` + +### 12.1.4 Ambient Enum Declarations + +An ambient enum declaration declares an enum type and an enum object in the containing module. + +  *AmbientEnumDeclaration:* +   `enum` *Identifier* `{` *AmbientEnumBodyopt* `}` + +  *AmbientEnumBody:* +   *AmbientEnumMemberList* `,`*opt* + +  *AmbientEnumMemberList:* +   *AmbientEnumMember* +   *AmbientEnumMemberList* `,` *AmbientEnumMember* + +  *AmbientEnumMember:* +   *PropertyName* +   *PropertyName* = *ConstantEnumValue* + +An *AmbientEnumMember* that includes a *ConstantEnumValue* value is considered a constant member. An *AmbientEnumMember* with no *ConstantEnumValue* value is considered a computed member. + +### 12.1.5 Ambient Module Declarations + +An ambient module declaration declares an internal module. + +  *AmbientModuleDeclaration:* +   `module` *IdentifierPath* `{` *AmbientModuleBody* `}` + +  *AmbientModuleBody:* +   *AmbientModuleElementsopt* + +  *AmbientModuleElements:* +   *AmbientModuleElement* +   *AmbientModuleElements* *AmbientModuleElement* + +  *AmbientModuleElement:* +   `export`*opt* *AmbientVariableDeclaration* +   `export`*opt* *AmbientFunctionDeclaration* +   `export`*opt* *AmbientClassDeclaration* +   `export`*opt* *InterfaceDeclaration* +   `export`*opt* *AmbientEnumDeclaration* +   `export`*opt* *AmbientModuleDeclaration* +   `export`*opt* *ImportDeclaration* + +Except for *ImportDeclarations*, *AmbientModuleElements* always declare exported entities regardless of whether they include the optional `export` modifier. + +## 12.2 Ambient External Module Declarations + +An *AmbientExternalModuleDeclaration* declares an external module. This type of declaration is permitted only at the top level in a source file that contributes to the global module (section [11.1](#11.1)). The *StringLiteral* must specify a top-level external module name. Relative external module names are not permitted. + +  *AmbientExternalModuleDeclaration:* +   `module` *StringLiteral* `{`  *AmbientExternalModuleBody* `}` + +  *AmbientExternalModuleBody:* +   *AmbientExternalModuleElementsopt* + +  *AmbientExternalModuleElements:* +   *AmbientExternalModuleElement* +   *AmbientExternalModuleElements* *AmbientExternalModuleElement* + +  *AmbientExternalModuleElement:* +   *AmbientModuleElement* +   *ExportAssignment* +   `export`*opt* *ExternalImportDeclaration* + +An *ExternalImportDeclaration* in an *AmbientExternalModuleDeclaration* may reference other external modules only through top-level external module names. Relative external module names are not permitted. + +If an ambient external module declaration includes an export assignment, it is an error for any of the declarations within the module to specify an `export` modifier. If an ambient external module declaration contains no export assignment, entities declared in the module are exported regardless of whether their declarations include the optional `export` modifier. + +Ambient external modules are “open-ended” and ambient external module declarations with the same string literal name contribute to a single external module. For example, the following two declarations of an external module ‘io’ might be located in separate source files. + +```TypeScript +declare module "io" { + export function readFile(filename: string): string; +} + +declare module "io" { + export function writeFile(filename: string, data: string): void; +} +``` + +This has the same effect as a single combined declaration: + +```TypeScript +declare module "io" { + export function readFile(filename: string): string; + export function writeFile(filename: string, data: string): void; +} +``` + +
+ +#
A Grammar + +This appendix contains a summary of the grammar found in the main document. As described in section [2.1](#2.1), the TypeScript grammar is a superset of the grammar defined in the ECMAScript Language Specification (specifically, the ECMA-262 Standard, 5th Edition) and this appendix lists only productions that are new or modified from the ECMAScript grammar. + +## A.1 Types + +  *TypeParameters:* +   `<` *TypeParameterList* `>` + +  *TypeParameterList:* +   *TypeParameter* +   *TypeParameterList* `,` *TypeParameter* + +  *TypeParameter:* +   *Identifier* *Constraintopt* + +  *Constraint:* +   `extends` *Type* + +  *TypeArguments:* +   `<` *TypeArgumentList* `>` + +  *TypeArgumentList:* +   *TypeArgument* +   *TypeArgumentList* `,` *TypeArgument* + +  *TypeArgument:* +   *Type* + +  *Type:* +   *PredefinedType* +   *TypeReference* +   *ObjectType* +   *ArrayType* +   *TupleType* +   *FunctionType* +   *ConstructorType* +   *TypeQuery* + +  *PredefinedType:* +   `any` +   `number` +   `boolean` +   `string` +   `void` + +  *TypeReference:* +   *TypeName* *[no LineTerminator here]* *TypeArgumentsopt* + +  *TypeName:* +   *Identifier* +   *ModuleName* `.` *Identifier* + +  *ModuleName:* +   *Identifier* +   *ModuleName* `.` *Identifier* + +  *ObjectType:* +   `{` *TypeBodyopt* `}` + +  *TypeBody:* +   *TypeMemberList* `;`*opt* + +  *TypeMemberList:* +   *TypeMember* +   *TypeMemberList* `;` *TypeMember* + +  *TypeMember:* +   *PropertySignature* +   *CallSignature* +   *ConstructSignature* +   *IndexSignature* +   *MethodSignature* + +  *ArrayType:* +   *ElementType* *[no LineTerminator here]* `[` `]` + +  *ElementType:* +   *PredefinedType* +   *TypeReference* +   *ObjectType* +   *ArrayType* +   *TupleType* +   *TypeQuery* + +  *TupleType:* +   `[` *TupleElementTypes* `]` + +  *TupleElementTypes:* +   *TupleElementType* +   *TupleElementTypes* `,` *TupleElementType* + +  *TupleElementType:* +   *Type* + +  *FunctionType:* +   *TypeParametersopt* `(` *ParameterListopt* `)` `=>` *Type* + +  *ConstructorType:* +   `new` *TypeParametersopt* `(` *ParameterListopt* `)` `=>` *Type* + +  *TypeQuery:* +   `typeof` *TypeQueryExpression* + +  *TypeQueryExpression:* +   *Identifier* +   *TypeQueryExpression* `.` *IdentifierName* + +  *PropertySignature:* +   *PropertyName* `?`*opt* *TypeAnnotationopt* + +  *PropertyName:* +   *IdentifierName* +   *StringLiteral* +   *NumericLiteral* + +  *CallSignature:* +   *TypeParametersopt* `(` *ParameterListopt* `)` *TypeAnnotationopt* + +  *ParameterList:* +   *RequiredParameterList* +   *OptionalParameterList* +   *RestParameter* +   *RequiredParameterList* `,` *OptionalParameterList* +   *RequiredParameterList* `,` *RestParameter* +   *OptionalParameterList* `,` *RestParameter* +   *RequiredParameterList* `,` *OptionalParameterList* `,` *RestParameter* + +  *RequiredParameterList:* +   *RequiredParameter* +   *RequiredParameterList* `,` *RequiredParameter* + +  *RequiredParameter:* +   *AccessibilityModifieropt* *Identifier* *TypeAnnotationopt* +   *Identifier* `:` *StringLiteral* + +  *AccessibilityModifier:* +   `public` +   `private` +   `protected` + +  *OptionalParameterList:* +   *OptionalParameter* +   *OptionalParameterList* `,` *OptionalParameter* + +  *OptionalParameter:* +   *AccessibilityModifieropt* *Identifier* `?` *TypeAnnotationopt* +   *AccessibilityModifieropt* *Identifier* *TypeAnnotationopt* *Initialiser* +   *Identifier* `?` `:` *StringLiteral* + +  *RestParameter:* +   `...` *Identifier* *TypeAnnotationopt* + +  *ConstructSignature:* +   `new` *TypeParametersopt* `(` *ParameterListopt* `)` *TypeAnnotationopt* + +  *IndexSignature:* +   `[` *Identifier* `:` `string` `]` *TypeAnnotation* +   `[` *Identifier* `:` `number` `]` *TypeAnnotation* + +  *MethodSignature:* +   *PropertyName* `?`*opt* *CallSignature* + +## A.2 Expressions + +  *PropertyAssignment:* *( Modified )* +   *PropertyName* `:` *AssignmentExpression* +   *PropertyName* *CallSignature* `{` *FunctionBody* `}` +   *GetAccessor* +   *SetAccessor* + +  *GetAccessor:* +   `get` *PropertyName* `(` `)` *TypeAnnotationopt* `{` *FunctionBody* `}` + +  *SetAccessor:* +   `set` *PropertyName* `(` *Identifier* *TypeAnnotationopt* `)` `{` *FunctionBody* `}` + +  *CallExpression:* *( Modified )* +   … +   `super` `(` *ArgumentListopt* `)` +   `super` `.` *IdentifierName* + +  *FunctionExpression:* *( Modified )* +   `function` *Identifieropt* *CallSignature* `{` *FunctionBody* `}` + +  *AssignmentExpression:* *( Modified )* +   … +   *ArrowFunctionExpression* + +  *ArrowFunctionExpression:* +   *ArrowFormalParameters* `=>` *Block* +   *ArrowFormalParameters* `=>` *AssignmentExpression* + +  *ArrowFormalParameters:* +   *CallSignature* +   *Identifier* + +  *Arguments:* *( Modified )* +   *TypeArgumentsopt* `(` *ArgumentListopt* `)` + +  *UnaryExpression:* *( Modified )* +   … +   `<` *Type* `>` *UnaryExpression* + +## A.3 Statements + +  *VariableDeclaration:* *( Modified )* +   *Identifier* *TypeAnnotationopt* *Initialiseropt* + +  *VariableDeclarationNoIn:* *( Modified )* +   *Identifier* *TypeAnnotationopt* *InitialiserNoInopt* + +  *TypeAnnotation:* +   `:` *Type* + +## A.4 Functions + +  *FunctionDeclaration:* *( Modified )* +   *FunctionOverloadsopt* *FunctionImplementation* + +  *FunctionOverloads:* +   *FunctionOverload* +   *FunctionOverloads* *FunctionOverload* + +  *FunctionOverload:* +   `function` *Identifier* *CallSignature* `;` + +  *FunctionImplementation:* +   `function` *Identifier* *CallSignature* `{` *FunctionBody* `}` + +## A.5 Interfaces + +  *InterfaceDeclaration:* +   `interface` *Identifier* *TypeParametersopt* *InterfaceExtendsClauseopt* *ObjectType* + +  *InterfaceExtendsClause:* +   `extends` *ClassOrInterfaceTypeList* + +  *ClassOrInterfaceTypeList:* +   *ClassOrInterfaceType* +   *ClassOrInterfaceTypeList* `,` *ClassOrInterfaceType* + +  *ClassOrInterfaceType:* +   *TypeReference* + +## A.6 Classes + +  *ClassDeclaration:* +   `class` *Identifier* *TypeParametersopt* *ClassHeritage* `{` *ClassBody* `}` + +  *ClassHeritage:* +   *ClassExtendsClauseopt* *ImplementsClauseopt* + +  *ClassExtendsClause:* +   `extends`  *ClassType* + +  *ClassType:* +   *TypeReference* + +  *ImplementsClause:* +   `implements` *ClassOrInterfaceTypeList* + +  *ClassBody:* +   *ClassElementsopt* + +  *ClassElements:* +   *ClassElement* +   *ClassElements* *ClassElement* + +  *ClassElement:* +   *ConstructorDeclaration* +   *PropertyMemberDeclaration* +   *IndexMemberDeclaration* + +  *ConstructorDeclaration:* +   *ConstructorOverloadsopt* *ConstructorImplementation* + +  *ConstructorOverloads:* +   *ConstructorOverload* +   *ConstructorOverloads* *ConstructorOverload* + +  *ConstructorOverload:* +   *AccessibilityModifieropt* `constructor` `(` *ParameterListopt* `)` `;` + +  *ConstructorImplementation:* +   *AccessibilityModifieropt* `constructor` `(` *ParameterListopt* `)` `{` *FunctionBody* `}` + +  *PropertyMemberDeclaration:* +   *MemberVariableDeclaration* +   *MemberFunctionDeclaration* +   *MemberAccessorDeclaration* + +  *MemberVariableDeclaration:* +   *AccessibilityModifieropt* `static`*opt* *PropertyName* *TypeAnnotationopt* *Initialiseropt* `;` + +  *MemberFunctionDeclaration:* +   *MemberFunctionOverloadsopt* *MemberFunctionImplementation* + +  *MemberFunctionOverloads*: +   *MemberFunctionOverload* +   *MemberFunctionOverloads* *MemberFunctionOverload* + +  *MemberFunctionOverload*: +   *AccessibilityModifieropt* `static`*opt* *PropertyName* *CallSignature* `;` + +  *MemberFunctionImplementation:* +   *AccessibilityModifieropt* `static`*opt* *PropertyName* *CallSignature* `{` *FunctionBody* `}` + +  *MemberAccessorDeclaration:* +   *AccessibilityModifieropt* `static`*opt* *GetAccessor* +   *AccessibilityModifieropt* `static`*opt* *SetAccessor* + +  *IndexMemberDeclaration:* +   *IndexSignature* `;` + +## A.7 Enums + +  *EnumDeclaration:* +   `enum` *Identifier* `{` *EnumBodyopt* `}` + +  *EnumBody*: +   *ConstantEnumMembers* `,`*opt* +   *ConstantEnumMembers* `,` *EnumMemberSections* `,`*opt* +   *EnumMemberSections* `,`*opt* + +  *ConstantEnumMembers:* +   *PropertyName* +   *ConstantEnumMembers* `,` *PropertyName* + +  *EnumMemberSections:* +   *EnumMemberSection* +   *EnumMemberSections* `,` *EnumMemberSection* + +  *EnumMemberSection:* +   *ConstantEnumMemberSection* +   *ComputedEnumMember* + +  *ConstantEnumMemberSection:* +   *PropertyName* `=` *ConstantEnumValue* +   *PropertyName* `=` *ConstantEnumValue* `,` *ConstantEnumMembers* + +  *ConstantEnumValue:* +   *SignedInteger* +   *HexIntegerLiteral* + +  *ComputedEnumMember:* +   *PropertyName* `=` *AssignmentExpression* + +## A.8 Internal Modules + +  *ModuleDeclaration:* +   `module` *IdentifierPath* `{` *ModuleBody* `}` + +  *IdentifierPath:* +   *Identifier* +   *IdentifierPath* `.` *Identifier* + +  *ModuleBody:* +   *ModuleElementsopt* + +  *ModuleElements:* +   *ModuleElement* +   *ModuleElements* *ModuleElement* + +  *ModuleElement:* +   *Statement* +   `export`*opt* *VariableDeclaration* +   `export`*opt* *FunctionDeclaration* +   `export`*opt* *ClassDeclaration* +   `export`*opt* *InterfaceDeclaration* +   `export`*opt* *EnumDeclaration* +   `export`*opt* *ModuleDeclaration* +   `export`*opt* *ImportDeclaration* +   `export`*opt* *AmbientDeclaration* + +  *ImportDeclaration:* +   `import` *Identifier* `=` *EntityName* `;` + +  *EntityName:* +   *ModuleName* +   *ModuleName* `.` *Identifier* + +## A.9 Source Files and External Modules + +  *SourceFile:* +   *ImplementationSourceFile* +   *DeclarationSourceFile* + +  *ImplementationSourceFile:* +   *ImplementationElementsopt* + +  *ImplementationElements:* +   *ImplementationElement* +   *ImplementationElements* *ImplementationElement* + +  *ImplementationElement:* +   *ModuleElement* +   *ExportAssignment* +   *AmbientExternalModuleDeclaration* +   `export`*opt* *ExternalImportDeclaration* + +  *DeclarationSourceFile:* +   *DeclarationElementsopt* + +  *DeclarationElements:* +   *DeclarationElement* +   *DeclarationElements* *DeclarationElement* + +  *DeclarationElement:* +   *ExportAssignment* +   *AmbientExternalModuleDeclaration* +   `export`*opt* *InterfaceDeclaration* +   `export`*opt* *ImportDeclaration* +   `export`*opt* *AmbientDeclaration* +   `export`*opt* *ExternalImportDeclaration* + +  *ExternalImportDeclaration:* +   `import` *Identifier* `=` *ExternalModuleReference* `;` + +  *ExternalModuleReference:* +   `require` `(` *StringLiteral* `)` + +  *ExportAssignment:* +   `export` `=` *Identifier* `;` + +## A.10 Ambients + +  *AmbientDeclaration:* +   `declare` *AmbientVariableDeclaration* +   `declare` *AmbientFunctionDeclaration* +   `declare` *AmbientClassDeclaration* +   `declare` *AmbientEnumDeclaration* +   `declare` *AmbientModuleDeclaration* + +  *AmbientVariableDeclaration:* +   `var` *Identifier*  *TypeAnnotationopt* `;` + +  *AmbientFunctionDeclaration:* +   `function` *Identifier* *CallSignature* `;` + +  *AmbientClassDeclaration:* +   `class` *Identifier* *TypeParametersopt* *ClassHeritage* `{` *AmbientClassBody* `}` + +  *AmbientClassBody:* +   *AmbientClassBodyElementsopt* + +  *AmbientClassBodyElements:* +   *AmbientClassBodyElement* +   *AmbientClassBodyElements* *AmbientClassBodyElement* + +  *AmbientClassBodyElement:* +   *AmbientConstructorDeclaration* +   *AmbientPropertyMemberDeclaration* +   *IndexSignature* + +  *AmbientConstructorDeclaration:* +   `constructor` `(` *ParameterListopt* `)` `;` + +  *AmbientPropertyMemberDeclaration:* +   *AccessibilityModifieropt* `static`*opt* *PropertyName* *TypeAnnotationopt* `;` +   *AccessibilityModifieropt* `static`*opt* *PropertyName* *CallSignature* `;` + +  *AmbientEnumDeclaration:* +   `enum` *Identifier* `{` *AmbientEnumBodyopt* `}` + +  *AmbientEnumBody:* +   *AmbientEnumMemberList* `,`*opt* + +  *AmbientEnumMemberList:* +   *AmbientEnumMember* +   *AmbientEnumMemberList* `,` *AmbientEnumMember* + +  *AmbientEnumMember:* +   *PropertyName* +   *PropertyName* = *ConstantEnumValue* + +  *AmbientModuleDeclaration:* +   `module` *IdentifierPath* `{` *AmbientModuleBody* `}` + +  *AmbientModuleBody:* +   *AmbientModuleElementsopt* + +  *AmbientModuleElements:* +   *AmbientModuleElement* +   *AmbientModuleElements* *AmbientModuleElement* + +  *AmbientModuleElement:* +   `export`*opt* *AmbientVariableDeclaration* +   `export`*opt* *AmbientFunctionDeclaration* +   `export`*opt* *AmbientClassDeclaration* +   `export`*opt* *InterfaceDeclaration* +   `export`*opt* *AmbientEnumDeclaration* +   `export`*opt* *AmbientModuleDeclaration* +   `export`*opt* *ImportDeclaration* + +  *AmbientExternalModuleDeclaration:* +   `module` *StringLiteral* `{`  *AmbientExternalModuleBody* `}` + +  *AmbientExternalModuleBody:* +   *AmbientExternalModuleElementsopt* + +  *AmbientExternalModuleElements:* +   *AmbientExternalModuleElement* +   *AmbientExternalModuleElements* *AmbientExternalModuleElement* + +  *AmbientExternalModuleElement:* +   *AmbientModuleElement* +   *ExportAssignment* +   `export`*opt* *ExternalImportDeclaration* + diff --git a/package.json b/package.json index 6b1d991cca6..00752302254 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "1.1.0", + "version": "1.3.0", "licenses": [ { "type": "Apache License 2.0", diff --git a/scripts/word2md.js b/scripts/word2md.js new file mode 100644 index 00000000000..8f9cd276f95 --- /dev/null +++ b/scripts/word2md.js @@ -0,0 +1,184 @@ +var sys = (function () { + var args = []; + for (var i = 0; i < WScript.Arguments.length; i++) { + args[i] = WScript.Arguments.Item(i); + } + return { + args: args, + createObject: function (typeName) { return new ActiveXObject(typeName); }, + write: function (s) { return WScript.StdOut.Write(s); } + }; +})(); +function convertDocumentToMarkdown(doc) { + var result = ""; + var lastStyle; + var lastInTable; + var tableColumnCount; + var tableCellIndex; + var columnAlignment = []; + function setProperties(target, properties) { + for (var name in properties) { + if (properties.hasOwnProperty(name)) { + var value = properties[name]; + if (typeof value === "object") { + setProperties(target[name], value); + } + else { + target[name] = value; + } + } + } + } + function findReplace(findText, findOptions, replaceText, replaceOptions) { + var find = doc.range().find; + find.clearFormatting(); + setProperties(find, findOptions); + var replace = find.replacement; + replace.clearFormatting(); + setProperties(replace, replaceOptions); + find.execute(findText, false, false, false, false, false, true, 0, true, replaceText, 2); + } + function write(s) { + result += s; + } + function writeTableHeader() { + for (var i = 0; i < tableColumnCount - 1; i++) { + switch (columnAlignment[i]) { + case 1: + write("|:---:"); + break; + case 2: + write("|---:"); + break; + default: + write("|---"); + } + } + write("|\n"); + } + function trimEndFormattingMarks(text) { + var i = text.length; + while (i > 0 && text.charCodeAt(i - 1) < 0x20) + i--; + return text.substr(0, i); + } + function writeBlockEnd() { + switch (lastStyle) { + case "Code": + write("```\n\n"); + break; + case "List Paragraph": + case "Table": + case "TOC": + write("\n"); + break; + } + } + function writeParagraph(p) { + var text = p.range.text; + var style = p.style.nameLocal; + var inTable = p.range.tables.count > 0; + var level = 1; + var sectionBreak = text.indexOf("\x0C") >= 0; + text = trimEndFormattingMarks(text); + if (inTable) { + style = "Table"; + } + else if (style.match(/\s\d$/)) { + level = +style.substr(style.length - 1); + style = style.substr(0, style.length - 2); + } + if (lastStyle && style !== lastStyle) { + writeBlockEnd(); + } + switch (style) { + case "Heading": + case "Appendix": + var section = p.range.listFormat.listString; + write("####".substr(0, level) + ' ' + section + " " + text + "\n\n"); + break; + case "Normal": + if (text.length) { + write(text + "\n\n"); + } + break; + case "List Paragraph": + write(" ".substr(0, p.range.listFormat.listLevelNumber * 2 - 2) + "* " + text + "\n"); + break; + case "Grammar": + write("  " + text.replace(/\s\s\s/g, " ").replace(/\x0B/g, " \n   ") + "\n\n"); + break; + case "Code": + if (lastStyle !== "Code") { + write("```TypeScript\n"); + } + else { + write("\n"); + } + write(text.replace(/\x0B/g, " \n") + "\n"); + break; + case "Table": + if (!lastInTable) { + tableColumnCount = p.range.tables.item(1).columns.count + 1; + tableCellIndex = 0; + } + if (tableCellIndex < tableColumnCount) { + columnAlignment[tableCellIndex] = p.alignment; + } + write("|" + text); + tableCellIndex++; + if (tableCellIndex % tableColumnCount === 0) { + write("\n"); + if (tableCellIndex === tableColumnCount) { + writeTableHeader(); + } + } + break; + case "TOC Heading": + write("## " + text + "\n\n"); + break; + case "TOC": + var strings = text.split("\t"); + write(" ".substr(0, level * 2 - 2) + "* [" + strings[0] + " " + strings[1] + "](#" + strings[0] + ")\n"); + break; + } + if (sectionBreak) { + write("
\n\n"); + } + lastStyle = style; + lastInTable = inTable; + } + function writeDocument() { + for (var p = doc.paragraphs.first; p; p = p.next()) { + writeParagraph(p); + } + writeBlockEnd(); + } + findReplace("<", {}, "<", {}); + findReplace("<", { style: "Code" }, "<", {}); + findReplace("<", { style: "Code Fragment" }, "<", {}); + findReplace("<", { style: "Terminal" }, "<", {}); + findReplace("", { font: { subscript: true } }, "^&", { font: { subscript: false } }); + findReplace("", { style: "Code Fragment" }, "`^&`", { style: -66 }); + findReplace("", { style: "Production" }, "*^&*", { style: -66 }); + findReplace("", { style: "Terminal" }, "`^&`", { style: -66 }); + findReplace("", { font: { bold: true, italic: true } }, "***^&***", { font: { bold: false, italic: false } }); + findReplace("", { font: { italic: true } }, "*^&*", { font: { italic: false } }); + doc.fields.toggleShowCodes(); + findReplace("^19 REF", {}, "[^&](#^&)", {}); + doc.fields.toggleShowCodes(); + writeDocument(); + return result; +} +function main(args) { + if (args.length !== 1) { + sys.write("Syntax: word2md \n"); + return; + } + var app = sys.createObject("Word.Application"); + var doc = app.documents.open(args[0]); + sys.write(convertDocumentToMarkdown(doc)); + doc.close(false); + app.quit(); +} +main(sys.args); diff --git a/scripts/word2md.ts b/scripts/word2md.ts new file mode 100644 index 00000000000..b1bc50b0cb9 --- /dev/null +++ b/scripts/word2md.ts @@ -0,0 +1,339 @@ +// word2md - Word to Markdown conversion tool +// +// word2md converts a Microsoft Word document to Markdown formatted text. The tool uses the +// Word Automation APIs to start an instance of Word and access the contents of the document +// being converted. The tool must be run using the cscript.exe script host and requires Word +// to be installed on the target machine. The name of the document to convert must be specified +// as a command line argument and the resulting Markdown is written to standard output. The +// tool recognizes the specific Word styles used in the TypeScript Language Specification. + +module Word { + + export interface Collection { + count: number; + item(index: number): T; + } + + export interface Font { + bold: boolean; + italic: boolean; + subscript: boolean; + superscript: boolean; + } + + export interface Find { + font: Font; + format: boolean; + replacement: Replacement; + style: any; + text: string; + clearFormatting(): void; + execute( + findText: string, + matchCase: boolean, + matchWholeWord: boolean, + matchWildcards: boolean, + matchSoundsLike: boolean, + matchAllWordForms: boolean, + forward: boolean, + wrap: number, + format: boolean, + replaceWith: string, + replace: number): boolean; + } + + export interface Replacement { + font: Font; + style: any; + text: string; + clearFormatting(): void; + } + + export interface ListFormat { + listLevelNumber: number; + listString: string; + } + + export interface Column { + } + + export interface Columns extends Collection { + } + + export interface Table { + columns: Columns; + } + + export interface Tables extends Collection { + } + + export interface Range { + find: Find; + listFormat: ListFormat; + tables: Tables; + text: string; + words: Ranges; + } + + export interface Ranges extends Collection { + } + + export interface Style { + nameLocal: string; + } + + export interface Paragraph { + alignment: number; + range: Range; + style: Style; + next(): Paragraph; + } + + export interface Paragraphs extends Collection { + first: Paragraph; + } + + export interface Field { + } + + export interface Fields extends Collection { + toggleShowCodes(): void; + } + + export interface Document { + fields: Fields; + paragraphs: Paragraphs; + close(saveChanges: boolean): void; + range(): Range; + } + + export interface Documents extends Collection { + open(filename: string): Document; + } + + export interface Application { + documents: Documents; + quit(): void; + } +} + +var sys = (function () { + var args: string[] = []; + for (var i = 0; i < WScript.Arguments.length; i++) { + args[i] = WScript.Arguments.Item(i); + } + return { + args: args, + createObject: (typeName: string) => new ActiveXObject(typeName), + write: (s: string) => WScript.StdOut.Write(s) + }; +})(); + +interface FindReplaceOptions { + style?: any; + font?: { + bold?: boolean; + italic?: boolean; + subscript?: boolean; + }; +} + +function convertDocumentToMarkdown(doc: Word.Document): string { + + var result: string = ""; + var lastStyle: string; + var lastInTable: boolean; + var tableColumnCount: number; + var tableCellIndex: number; + var columnAlignment: number[] = []; + + function setProperties(target: any, properties: any) { + for (var name in properties) { + if (properties.hasOwnProperty(name)) { + var value = properties[name]; + if (typeof value === "object") { + setProperties(target[name], value); + } + else { + target[name] = value; + } + } + } + } + + function findReplace(findText: string, findOptions: FindReplaceOptions, replaceText: string, replaceOptions: FindReplaceOptions) { + var find = doc.range().find; + find.clearFormatting(); + setProperties(find, findOptions); + var replace = find.replacement; + replace.clearFormatting(); + setProperties(replace, replaceOptions); + find.execute(findText, false, false, false, false, false, true, 0, true, replaceText, 2); + } + + function write(s: string) { + result += s; + } + + function writeTableHeader() { + for (var i = 0; i < tableColumnCount - 1; i++) { + switch (columnAlignment[i]) { + case 1: + write("|:---:"); + break; + case 2: + write("|---:"); + break; + default: + write("|---"); + } + } + write("|\n"); + } + + function trimEndFormattingMarks(text: string) { + var i = text.length; + while (i > 0 && text.charCodeAt(i - 1) < 0x20) i--; + return text.substr(0, i); + } + + function writeBlockEnd() { + switch (lastStyle) { + case "Code": + write("```\n\n"); + break; + case "List Paragraph": + case "Table": + case "TOC": + write("\n"); + break; + } + } + + function writeParagraph(p: Word.Paragraph) { + + var text = p.range.text; + var style = p.style.nameLocal; + var inTable = p.range.tables.count > 0; + var level = 1; + var sectionBreak = text.indexOf("\x0C") >= 0; + + text = trimEndFormattingMarks(text); + if (inTable) { + style = "Table"; + } + else if (style.match(/\s\d$/)) { + level = +style.substr(style.length - 1); + style = style.substr(0, style.length - 2); + } + if (lastStyle && style !== lastStyle) { + writeBlockEnd(); + } + + switch (style) { + + case "Heading": + case "Appendix": + var section = p.range.listFormat.listString; + write("####".substr(0, level) + ' ' + section + " " + text + "\n\n"); + break; + + case "Normal": + if (text.length) { + write(text + "\n\n"); + } + break; + + case "List Paragraph": + write(" ".substr(0, p.range.listFormat.listLevelNumber * 2 - 2) + "* " + text + "\n"); + break; + + case "Grammar": + write("  " + text.replace(/\s\s\s/g, " ").replace(/\x0B/g, " \n   ") + "\n\n"); + break; + + case "Code": + if (lastStyle !== "Code") { + write("```TypeScript\n"); + } + else { + write("\n"); + } + write(text.replace(/\x0B/g, " \n") + "\n"); + break; + + case "Table": + if (!lastInTable) { + tableColumnCount = p.range.tables.item(1).columns.count + 1; + tableCellIndex = 0; + } + if (tableCellIndex < tableColumnCount) { + columnAlignment[tableCellIndex] = p.alignment; + } + write("|" + text); + tableCellIndex++; + if (tableCellIndex % tableColumnCount === 0) { + write("\n"); + if (tableCellIndex === tableColumnCount) { + writeTableHeader(); + } + } + break; + + case "TOC Heading": + write("## " + text + "\n\n"); + break; + + case "TOC": + var strings = text.split("\t"); + write(" ".substr(0, level * 2 - 2) + "* [" + strings[0] + " " + strings[1] + "](#" + strings[0] + ")\n"); + break; + } + + if (sectionBreak) { + write("
\n\n"); + } + lastStyle = style; + lastInTable = inTable; + } + + function writeDocument() { + for (var p = doc.paragraphs.first; p; p = p.next()) { + writeParagraph(p); + } + writeBlockEnd(); + } + + findReplace("<", {}, "<", {}); + findReplace("<", { style: "Code" }, "<", {}); + findReplace("<", { style: "Code Fragment" }, "<", {}); + findReplace("<", { style: "Terminal" }, "<", {}); + findReplace("", { font: { subscript: true } }, "^&", { font: { subscript: false } }); + findReplace("", { style: "Code Fragment" }, "`^&`", { style: -66 /* default font */ }); + findReplace("", { style: "Production" }, "*^&*", { style: -66 /* default font */}); + findReplace("", { style: "Terminal" }, "`^&`", { style: -66 /* default font */}); + findReplace("", { font: { bold: true, italic: true } }, "***^&***", { font: { bold: false, italic: false } }); + findReplace("", { font: { italic: true } }, "*^&*", { font: { italic: false } }); + + doc.fields.toggleShowCodes(); + findReplace("^19 REF", {}, "[^&](#^&)", {}); + doc.fields.toggleShowCodes(); + + writeDocument(); + + return result; +} + +function main(args: string[]) { + if (args.length !== 1) { + sys.write("Syntax: word2md \n"); + return; + } + var app: Word.Application = sys.createObject("Word.Application"); + var doc = app.documents.open(args[0]); + sys.write(convertDocumentToMarkdown(doc)); + doc.close(false); + app.quit(); +} + +main(sys.args); diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index bae4b6abb3c..c9f9d6bf6e3 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -84,8 +84,13 @@ module ts { if (node.name) { node.name.parent = node; } - file.semanticErrors.push(createDiagnosticForNode(node.name ? node.name : node, - Diagnostics.Duplicate_identifier_0, getDisplayName(node))); + // Report errors every position with duplicate declaration + // Report errors on previous encountered declarations + forEach(symbol.declarations, (declaration) => { + file.semanticErrors.push(createDiagnosticForNode(declaration.name, Diagnostics.Duplicate_identifier_0, getDisplayName(declaration))); + }); + file.semanticErrors.push(createDiagnosticForNode(node.name, Diagnostics.Duplicate_identifier_0, getDisplayName(node))); + symbol = createSymbol(0, name); } } @@ -226,7 +231,7 @@ module ts { function bindConstructorDeclaration(node: ConstructorDeclaration) { bindDeclaration(node, SymbolFlags.Constructor, 0); forEach(node.parameters, p => { - if (p.flags & (NodeFlags.Public | NodeFlags.Private)) { + if (p.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected)) { bindDeclaration(p, SymbolFlags.Property, SymbolFlags.PropertyExcludes); } }); @@ -332,7 +337,7 @@ module ts { break; case SyntaxKind.SourceFile: if (isExternalModule(node)) { - bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + getModuleNameFromFilename((node).filename) + '"'); + bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + removeFileExtension((node).filename) + '"'); break; } default: diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c4f83f75a5f..8a240eae3c1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -23,6 +23,34 @@ module ts { return undefined; } + export interface StringSymbolWriter extends SymbolWriter { + string(): string; + } + + // Pool writers to avoid needing to allocate them for every symbol we write. + var stringWriters: StringSymbolWriter[] = []; + export function getSingleLineStringWriter(): StringSymbolWriter { + if (stringWriters.length == 0) { + var str = ""; + + return { + string: () => str, + writeKind: text => str += text, + writeSymbol: text => str += text, + + // Completely ignore indentation for string writers. And map newlines to + // a single space. + writeLine: () => str += " ", + increaseIndent: () => { }, + decreaseIndent: () => { }, + clear: () => str = "", + trackSymbol: () => { } + }; + } + + return stringWriters.pop(); + } + /// fullTypeCheck denotes if this instance of the typechecker will be used to get semantic diagnostics. /// If fullTypeCheck === true, then the typechecker should do every possible check to produce all errors /// If fullTypeCheck === false, the typechecker can take shortcuts and skip checks that only produce errors. @@ -62,10 +90,24 @@ module ts { getTypeOfNode: getTypeOfNode, getApparentType: getApparentType, typeToString: typeToString, + writeType: writeType, symbolToString: symbolToString, + writeSymbol: writeSymbol, getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType, - getRootSymbol: getRootSymbol, - getContextualType: getContextualType + getRootSymbols: getRootSymbols, + getContextualType: getContextualType, + getFullyQualifiedName: getFullyQualifiedName, + getResolvedSignature: getResolvedSignature, + getEnumMemberValue: getEnumMemberValue, + isValidPropertyAccess: isValidPropertyAccess, + getSignatureFromDeclaration: getSignatureFromDeclaration, + writeSignature: writeSignature, + writeTypeParameter: writeTypeParameter, + writeTypeParametersOfSymbol: writeTypeParametersOfSymbol, + isImplementationOfOverload: isImplementationOfOverload, + getAliasedSymbol: resolveImport, + isUndefinedSymbol: symbol => symbol === undefinedSymbol, + isArgumentsSymbol: symbol => symbol === argumentsSymbol }; var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); @@ -102,6 +144,8 @@ module ts { var globalBooleanType: ObjectType; var globalRegExpType: ObjectType; + var tupleTypes: Map = {}; + var unionTypes: Map = {}; var stringLiteralTypes: Map = {}; var emitExtends = false; @@ -413,7 +457,7 @@ module ts { } } - function getFullyQualifiedName(symbol: Symbol) { + function getFullyQualifiedName(symbol: Symbol): string { return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } @@ -649,15 +693,14 @@ module ts { } function isOptionalProperty(propertySymbol: Symbol): boolean { - if (propertySymbol.flags & SymbolFlags.Prototype) { - return false; - } // class C { // constructor(public x?) { } // } // // x is an optional parameter, but it is a required property. - return (propertySymbol.valueDeclaration.flags & NodeFlags.QuestionMark) && propertySymbol.valueDeclaration.kind !== SyntaxKind.Parameter; + return propertySymbol.valueDeclaration && + propertySymbol.valueDeclaration.flags & NodeFlags.QuestionMark && + propertySymbol.valueDeclaration.kind !== SyntaxKind.Parameter; } function forEachSymbolTableInScope(enclosingDeclaration: Node, callback: (symbolTable: SymbolTable) => T): T { @@ -696,7 +739,7 @@ module ts { return rightMeaning === SymbolFlags.Value ? SymbolFlags.Value : SymbolFlags.Namespace; } - function getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): Symbol[] { + function getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] { function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable): Symbol[] { function canQualifySymbol(symbolFromSymbolTable: Symbol, meaning: SymbolFlags) { // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible @@ -705,7 +748,7 @@ module ts { } // If symbol needs qualification, make sure that parent is accessible, if it is then this symbol is accessible too - var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning)); + var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing); return !!accessibleParent; } @@ -727,16 +770,21 @@ module ts { // Check if symbol is any of the alias return forEachValue(symbols, symbolFromSymbolTable => { if (symbolFromSymbolTable.flags & SymbolFlags.Import) { - var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } + if (!useOnlyExternalAliasing || // We can use any type of alias to get the name + // Is this external alias, then use it to name + ts.forEach(symbolFromSymbolTable.declarations, declaration => + declaration.kind === SyntaxKind.ImportDeclaration && (declaration).externalModuleName)) { + var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } - // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain - // but only if the symbolFromSymbolTable can be qualified - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain + // but only if the symbolFromSymbolTable can be qualified + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } }); @@ -782,7 +830,7 @@ module ts { var meaningToLook = meaning; while (symbol) { // Symbol is accessible if it by itself is accessible - var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook); + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, /*useOnlyExternalAliasing*/ false); if (accessibleSymbolChain) { var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); if (!hasAccessibleDeclarations) { @@ -894,140 +942,217 @@ module ts { { accessibility: SymbolAccessibility.NotAccessible, errorSymbolName: firstIdentifierName }; } + function releaseStringWriter(writer: StringSymbolWriter) { + writer.clear() + stringWriters.push(writer); + } + + function writeKeyword(writer: SymbolWriter, kind: SyntaxKind) { + writer.writeKind(tokenToString(kind), SymbolDisplayPartKind.keyword); + } + + function writePunctuation(writer: SymbolWriter, kind: SyntaxKind) { + writer.writeKind(tokenToString(kind), SymbolDisplayPartKind.punctuation); + } + + function writeOperator(writer: SymbolWriter, kind: SyntaxKind) { + writer.writeKind(tokenToString(kind), SymbolDisplayPartKind.operator); + } + + function writeSpace(writer: SymbolWriter) { + writer.writeKind(" ", SymbolDisplayPartKind.space); + } + + function symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string { + var writer = getSingleLineStringWriter(); + writeSymbol(symbol, writer, enclosingDeclaration, meaning); + + var result = writer.string(); + releaseStringWriter(writer); + + return result; + } + // Enclosing declaration is optional when we don't want to get qualified name in the enclosing declaration scope // Meaning needs to be specified if the enclosing declaration is given - function symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) { - function getSymbolName(symbol: Symbol) { + function writeSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void { + var parentSymbol: Symbol; + function writeSymbolName(symbol: Symbol): void { + if (parentSymbol) { + // Write type arguments of instantiated class/interface here + if (flags & SymbolFormatFlags.WriteTypeParametersOrArguments) { + if (symbol.flags & SymbolFlags.Instantiated) { + writeTypeArguments(getTypeParametersOfClassOrInterface(parentSymbol), + (symbol).mapper, writer, enclosingDeclaration); + } + else { + writeTypeParametersOfSymbol(parentSymbol, writer, enclosingDeclaration); + } + } + writePunctuation(writer, SyntaxKind.DotToken); + } + parentSymbol = symbol; if (symbol.declarations && symbol.declarations.length > 0) { var declaration = symbol.declarations[0]; if (declaration.name) { - return identifierToString(declaration.name); + writer.writeSymbol(identifierToString(declaration.name), symbol); + return; + } + } + + writer.writeSymbol(symbol.name, symbol); + } + + // Let the writer know we just wrote out a symbol. The declaration emitter writer uses + // this to determine if an import it has previously seen (and not written out) needs + // to be written to the file once the walk of the tree is complete. + // + // NOTE(cyrusn): This approach feels somewhat unfortunate. A simple pass over the tree + // up front (for example, during checking) could determine if we need to emit the imports + // and we could then access that data during declaration emit. + writer.trackSymbol(symbol, enclosingDeclaration, meaning); + function walkSymbol(symbol: Symbol, meaning: SymbolFlags): void { + if (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & SymbolFormatFlags.UseOnlyExternalAliasing)); + + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + + // Go up and add our parent. + walkSymbol( + getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), + getQualifiedLeftMeaning(meaning)); + } + + if (accessibleSymbolChain) { + for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { + writeSymbolName(accessibleSymbolChain[i]); + } + } + else { + // If we didn't find accessible symbol chain for this symbol, break if this is external module + if (!parentSymbol && ts.forEach(symbol.declarations, declaration => hasExternalModuleSymbol(declaration))) { + return; + } + + // if this is anonymous type break + if (symbol.flags & SymbolFlags.TypeLiteral || symbol.flags & SymbolFlags.ObjectLiteral) { + return; + } + + writeSymbolName(symbol); } } - return symbol.name; } // Get qualified name if (enclosingDeclaration && // TypeParameters do not need qualification !(symbol.flags & SymbolFlags.TypeParameter)) { - var symbolName: string; - while (symbol) { - var isFirstName = !symbolName; - var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning); - var currentSymbolName: string; - if (accessibleSymbolChain) { - currentSymbolName = ts.map(accessibleSymbolChain, accessibleSymbol => getSymbolName(accessibleSymbol)).join("."); - } - else { - // If we didn't find accessible symbol chain for this symbol, break if this is external module - if (!isFirstName && ts.forEach(symbol.declarations, declaration => hasExternalModuleSymbol(declaration))) { - break; - } - currentSymbolName = getSymbolName(symbol); - } - symbolName = currentSymbolName + (isFirstName ? "" : ("." + symbolName)); - if (accessibleSymbolChain && !needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - break; - } - symbol = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - meaning = getQualifiedLeftMeaning(meaning); - } - - return symbolName; + walkSymbol(symbol, meaning); + return; } - return getSymbolName(symbol); - } - - function writeSymbolToTextWriter(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, writer: TextWriter) { - writer.write(symbolToString(symbol, enclosingDeclaration, meaning)); - } - - function createSingleLineTextWriter(maxLength?: number) { - var result = ""; - var overflow = false; - function write(s: string) { - if (!overflow) { - result += s; - if (result.length > maxLength) { - result = result.substr(0, maxLength - 3) + "..."; - overflow = true; - } - } - } - return { - write: write, - writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) { - writeSymbolToTextWriter(symbol, enclosingDeclaration, meaning, this); - }, - writeLine() { - write(" "); - }, - increaseIndent() { }, - decreaseIndent() { }, - getText() { - return result; - } - }; + return writeSymbolName(symbol); } function typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string { + var writer = getSingleLineStringWriter(); + writeType(type, writer, enclosingDeclaration, flags); + + var result = writer.string(); + releaseStringWriter(writer); + var maxLength = compilerOptions.noErrorTruncation || flags & TypeFormatFlags.NoTruncation ? undefined : 100; - var stringWriter = createSingleLineTextWriter(maxLength); - // TODO(shkamat): typeToString should take enclosingDeclaration as input, once we have implemented enclosingDeclaration - writeTypeToTextWriter(type, enclosingDeclaration, flags, stringWriter); - return stringWriter.getText(); + if (maxLength && result.length >= maxLength) { + result = result.substr(0, maxLength - "...".length) + "..."; + } + + return result; } - function writeTypeToTextWriter(type: Type, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter) { - var typeStack: Type[]; - return writeType(type, /*allowFunctionOrConstructorTypeLiteral*/ true); + function writeType(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { + return writeType(type, flags | TypeFormatFlags.WriteArrowStyleSignature); - function writeType(type: Type, allowFunctionOrConstructorTypeLiteral: boolean) { + function writeType(type: Type, flags: TypeFormatFlags) { + // Write undefined/null type as any if (type.flags & TypeFlags.Intrinsic) { - writer.write((type).intrinsicName); + // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving + writer.writeKind(!(flags & TypeFormatFlags.WriteOwnNameForAnyLike) && + (type.flags & TypeFlags.Any) ? "any" : (type).intrinsicName, SymbolDisplayPartKind.keyword); } else if (type.flags & TypeFlags.Reference) { writeTypeReference(type); } else if (type.flags & (TypeFlags.Class | TypeFlags.Interface | TypeFlags.Enum | TypeFlags.TypeParameter)) { - writer.writeSymbol(type.symbol, enclosingDeclaration, SymbolFlags.Type); + writeSymbol(type.symbol, writer, enclosingDeclaration, SymbolFlags.Type); + } + else if (type.flags & TypeFlags.Tuple) { + writeTupleType(type); + } + else if (type.flags & TypeFlags.Union) { + writeUnionType(type); } else if (type.flags & TypeFlags.Anonymous) { - writeAnonymousType(type, allowFunctionOrConstructorTypeLiteral); + writeAnonymousType(type, flags); } else if (type.flags & TypeFlags.StringLiteral) { - writer.write((type).text); + writer.writeKind((type).text, SymbolDisplayPartKind.stringLiteral); } else { // Should never get here - writer.write("{ ... }"); + // { ... } + writePunctuation(writer, SyntaxKind.OpenBraceToken); + writeSpace(writer); + writePunctuation(writer, SyntaxKind.DotDotDotToken); + writeSpace(writer); + writePunctuation(writer, SyntaxKind.CloseBraceToken); + } + } + + function writeTypeList(types: Type[], union: boolean) { + for (var i = 0; i < types.length; i++) { + if (i > 0) { + if (union) { + writeSpace(writer); + } + writePunctuation(writer, union ? SyntaxKind.BarToken : SyntaxKind.CommaToken); + writeSpace(writer); + } + // Don't output function type literals in unions because '() => string | () => number' would be parsed + // as a function type that returns a union type. Instead output '{ (): string; } | { (): number; }'. + writeType(types[i], union ? flags & ~TypeFormatFlags.WriteArrowStyleSignature : flags | TypeFormatFlags.WriteArrowStyleSignature); } } function writeTypeReference(type: TypeReference) { - if (type.target === globalArrayType && !(flags & TypeFormatFlags.WriteArrayAsGenericType)) { + if (type.target === globalArrayType && !(flags & TypeFormatFlags.WriteArrayAsGenericType) && !(type.typeArguments[0].flags & TypeFlags.Union)) { // If we are writing array element type the arrow style signatures are not allowed as // we need to surround it by curlies, e.g. { (): T; }[]; as () => T[] would mean something different - writeType(type.typeArguments[0], /*allowFunctionOrConstructorTypeLiteral*/ false); - writer.write("[]"); + writeType(type.typeArguments[0], flags & ~TypeFormatFlags.WriteArrowStyleSignature); + writePunctuation(writer, SyntaxKind.OpenBracketToken); + writePunctuation(writer, SyntaxKind.CloseBracketToken); } else { - writer.writeSymbol(type.target.symbol, enclosingDeclaration, SymbolFlags.Type); - writer.write("<"); - for (var i = 0; i < type.typeArguments.length; i++) { - if (i > 0) { - writer.write(", "); - } - writeType(type.typeArguments[i], /*allowFunctionOrConstructorTypeLiteral*/ true); - } - writer.write(">"); + writeSymbol(type.target.symbol, writer, enclosingDeclaration, SymbolFlags.Type); + writePunctuation(writer, SyntaxKind.LessThanToken); + writeTypeList(type.typeArguments, /*union*/ false); + writePunctuation(writer, SyntaxKind.GreaterThanToken); } } - function writeAnonymousType(type: ObjectType, allowFunctionOrConstructorTypeLiteral: boolean) { + function writeTupleType(type: TupleType) { + writePunctuation(writer, SyntaxKind.OpenBracketToken); + writeTypeList(type.elementTypes, /*union*/ false); + writePunctuation(writer, SyntaxKind.CloseBracketToken); + } + + function writeUnionType(type: UnionType) { + writeTypeList(type.types, /*union*/ true); + } + + function writeAnonymousType(type: ObjectType, flags: TypeFormatFlags) { // Always use 'typeof T' for type of class, enum, and module objects if (type.symbol && type.symbol.flags & (SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule)) { writeTypeofSymbol(type); @@ -1038,14 +1163,14 @@ module ts { } else if (typeStack && contains(typeStack, type)) { // Recursive usage, use any - writer.write("any"); + writeKeyword(writer, SyntaxKind.AnyKeyword); } else { if (!typeStack) { typeStack = []; } typeStack.push(type); - writeLiteralType(type, allowFunctionOrConstructorTypeLiteral); + writeLiteralType(type, flags); typeStack.pop(); } @@ -1068,55 +1193,76 @@ module ts { } function writeTypeofSymbol(type: ObjectType) { - writer.write("typeof "); - writer.writeSymbol(type.symbol, enclosingDeclaration, SymbolFlags.Value); + writeKeyword(writer, SyntaxKind.TypeOfKeyword); + writeSpace(writer); + writeSymbol(type.symbol, writer, enclosingDeclaration, SymbolFlags.Value); } - function writeLiteralType(type: ObjectType, allowFunctionOrConstructorTypeLiteral: boolean) { + function writeLiteralType(type: ObjectType, flags: TypeFormatFlags) { var resolved = resolveObjectTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { - writer.write("{}"); + writePunctuation(writer, SyntaxKind.OpenBraceToken); + writePunctuation(writer, SyntaxKind.CloseBraceToken); return; } - if (allowFunctionOrConstructorTypeLiteral) { + if (flags & TypeFormatFlags.WriteArrowStyleSignature) { if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { - writeSignature(resolved.callSignatures[0], /*arrowStyle*/ true); + writeSignature(resolved.callSignatures[0], writer, enclosingDeclaration, flags, typeStack); return; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { - writer.write("new "); - writeSignature(resolved.constructSignatures[0], /*arrowStyle*/ true); + writeKeyword(writer, SyntaxKind.NewKeyword); + writeSpace(writer); + writeSignature(resolved.constructSignatures[0], writer, enclosingDeclaration, flags, typeStack); return; } } } - writer.write("{"); + writePunctuation(writer, SyntaxKind.OpenBraceToken); writer.writeLine(); writer.increaseIndent(); for (var i = 0; i < resolved.callSignatures.length; i++) { - writeSignature(resolved.callSignatures[i]); - writer.write(";"); + writeSignature(resolved.callSignatures[i], writer, enclosingDeclaration, flags & ~TypeFormatFlags.WriteArrowStyleSignature, typeStack); + writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } for (var i = 0; i < resolved.constructSignatures.length; i++) { - writer.write("new "); - writeSignature(resolved.constructSignatures[i]); - writer.write(";"); + writeKeyword(writer, SyntaxKind.NewKeyword); + writeSpace(writer); + + writeSignature(resolved.constructSignatures[i], writer, enclosingDeclaration, flags & ~TypeFormatFlags.WriteArrowStyleSignature, typeStack); + writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } if (resolved.stringIndexType) { - writer.write("[x: string]: "); - writeType(resolved.stringIndexType, /*allowFunctionOrConstructorTypeLiteral*/ true); - writer.write(";"); + // [x: string]: + writePunctuation(writer, SyntaxKind.OpenBracketToken); + writer.writeKind("x", SymbolDisplayPartKind.parameterName); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + writeKeyword(writer, SyntaxKind.StringKeyword); + writePunctuation(writer, SyntaxKind.CloseBracketToken); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + writeType(resolved.stringIndexType, flags | TypeFormatFlags.WriteArrowStyleSignature); + writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } if (resolved.numberIndexType) { - writer.write("[x: number]: "); - writeType(resolved.numberIndexType, /*allowFunctionOrConstructorTypeLiteral*/ true); - writer.write(";"); + // [x: number]: + writePunctuation(writer, SyntaxKind.OpenBracketToken); + writer.writeKind("x", SymbolDisplayPartKind.parameterName); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + writeKeyword(writer, SyntaxKind.NumberKeyword); + writePunctuation(writer, SyntaxKind.CloseBracketToken); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + writeType(resolved.numberIndexType, flags | TypeFormatFlags.WriteArrowStyleSignature); + writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } for (var i = 0; i < resolved.properties.length; i++) { @@ -1125,66 +1271,117 @@ module ts { if (p.flags & (SymbolFlags.Function | SymbolFlags.Method) && !getPropertiesOfType(t).length) { var signatures = getSignaturesOfType(t, SignatureKind.Call); for (var j = 0; j < signatures.length; j++) { - writer.writeSymbol(p); + writeSymbol(p, writer); if (isOptionalProperty(p)) { - writer.write("?"); + writePunctuation(writer, SyntaxKind.QuestionToken); } - writeSignature(signatures[j]); - writer.write(";"); + writeSignature(signatures[j], writer, enclosingDeclaration, flags & ~TypeFormatFlags.WriteArrowStyleSignature, typeStack); + writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } } else { - writer.writeSymbol(p); + writeSymbol(p, writer); if (isOptionalProperty(p)) { - writer.write("?"); + writePunctuation(writer, SyntaxKind.QuestionToken); } - writer.write(": "); - writeType(t, /*allowFunctionOrConstructorTypeLiteral*/ true); - writer.write(";"); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + writeType(t, flags | TypeFormatFlags.WriteArrowStyleSignature); + writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } } writer.decreaseIndent(); - writer.write("}"); + writePunctuation(writer, SyntaxKind.CloseBraceToken); + } + } + + function writeTypeParameter(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { + writeSymbol(tp.symbol, writer); + var constraint = getConstraintOfTypeParameter(tp); + if (constraint) { + writeSpace(writer); + writeKeyword(writer, SyntaxKind.ExtendsKeyword); + writeSpace(writer); + writeType(constraint, writer, enclosingDeclaration, flags, typeStack); + } + } + + function writeTypeParameters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, SyntaxKind.LessThanToken); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, SyntaxKind.CommaToken); + writeSpace(writer); + } + writeTypeParameter(typeParameters[i], writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, SyntaxKind.GreaterThanToken); + } + } + + function writeTypeArguments(typeParameters: TypeParameter[], mapper: TypeMapper, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, SyntaxKind.LessThanToken); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, SyntaxKind.CommaToken); + writeSpace(writer); + } + writeType(mapper(typeParameters[i]), writer, enclosingDeclaration, TypeFormatFlags.WriteArrowStyleSignature); + } + writePunctuation(writer, SyntaxKind.GreaterThanToken); + } + } + + function writeTypeParametersOfSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) { + var rootSymbol = getRootSymbol(symbol); + if (rootSymbol.flags & SymbolFlags.Class || rootSymbol.flags & SymbolFlags.Interface) { + writeTypeParameters(getTypeParametersOfClassOrInterface(symbol), writer, enclosingDeclaraiton, flags); + } + } + + function writeSignature(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { + if (signature.target && (flags & TypeFormatFlags.WriteTypeArgumentsOfSignature)) { + // Instantiated signature, write type arguments instead + writeTypeArguments(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration); + } + else { + writeTypeParameters(signature.typeParameters, writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, SyntaxKind.OpenParenToken); + for (var i = 0; i < signature.parameters.length; i++) { + if (i > 0) { + writePunctuation(writer, SyntaxKind.CommaToken); + writeSpace(writer); + } + var p = signature.parameters[i]; + if (getDeclarationFlagsFromSymbol(p) & NodeFlags.Rest) { + writePunctuation(writer, SyntaxKind.DotDotDotToken); + } + writeSymbol(p, writer); + if (p.valueDeclaration.flags & NodeFlags.QuestionMark || (p.valueDeclaration).initializer) { + writePunctuation(writer, SyntaxKind.QuestionToken); + } + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + + writeType(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, typeStack); } - function writeSignature(signature: Signature, arrowStyle?: boolean) { - if (signature.typeParameters) { - writer.write("<"); - for (var i = 0; i < signature.typeParameters.length; i++) { - if (i > 0) { - writer.write(", "); - } - var tp = signature.typeParameters[i]; - writer.writeSymbol(tp.symbol); - var constraint = getConstraintOfTypeParameter(tp); - if (constraint) { - writer.write(" extends "); - writeType(constraint, /*allowFunctionOrConstructorTypeLiteral*/ true); - } - } - writer.write(">"); - } - writer.write("("); - for (var i = 0; i < signature.parameters.length; i++) { - if (i > 0) { - writer.write(", "); - } - var p = signature.parameters[i]; - if (getDeclarationFlagsFromSymbol(p) & NodeFlags.Rest) { - writer.write("..."); - } - writer.writeSymbol(p); - if (p.valueDeclaration.flags & NodeFlags.QuestionMark || (p.valueDeclaration).initializer) { - writer.write("?"); - } - writer.write(": "); - writeType(getTypeOfSymbol(p), /*allowFunctionOrConstructorTypeLiteral*/ true); - } - writer.write(arrowStyle ? ") => " : "): "); - writeType(getReturnTypeOfSignature(signature), /*allowFunctionOrConstructorTypeLiteral*/ true); + writePunctuation(writer, SyntaxKind.CloseParenToken); + if (flags & TypeFormatFlags.WriteArrowStyleSignature) { + writeSpace(writer); + writePunctuation(writer, SyntaxKind.EqualsGreaterThanToken); } + else { + writePunctuation(writer, SyntaxKind.ColonToken); + } + writeSpace(writer); + + writeType(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags, typeStack); } function isDeclarationVisible(node: Declaration): boolean { @@ -1268,8 +1465,8 @@ module ts { case SyntaxKind.Property: case SyntaxKind.Method: - if (node.flags & NodeFlags.Private) { - // Private properties/methods are not visible + if (node.flags & (NodeFlags.Private | NodeFlags.Protected)) { + // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so let it fall into next case statement @@ -1420,6 +1617,12 @@ module ts { } else if (links.type === resolvingType) { links.type = anyType; + if (compilerOptions.noImplicitAny) { + var diagnostic = (symbol.valueDeclaration).type ? + Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : + Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + } } return links.type; } @@ -1475,7 +1678,7 @@ module ts { // Otherwise, fall back to 'any'. else { if (compilerOptions.noImplicitAny) { - error(setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbol.name); + error(setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol)); } type = anyType; @@ -1489,6 +1692,10 @@ module ts { } else if (links.type === resolvingType) { links.type = anyType; + if (compilerOptions.noImplicitAny) { + var getter = getDeclarationOfKind(symbol, SyntaxKind.GetAccessor); + error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } } @@ -1524,6 +1731,15 @@ module ts { return links.type; } + function getTypeOfUnionProperty(symbol: Symbol): Type { + var links = getSymbolLinks(symbol); + if (!links.type) { + var types = map(links.unionType.types, t => getTypeOfSymbol(getPropertyOfType(getApparentType(t), symbol.name))); + links.type = getUnionType(types); + } + return links.type; + } + function getTypeOfSymbol(symbol: Symbol): Type { if (symbol.flags & (SymbolFlags.Variable | SymbolFlags.Property)) { return getTypeOfVariableOrParameterOrProperty(symbol); @@ -1543,6 +1759,9 @@ module ts { if (symbol.flags & SymbolFlags.Instantiated) { return getTypeOfInstantiatedSymbol(symbol); } + if (symbol.flags & SymbolFlags.UnionProperty) { + return getTypeOfUnionProperty(symbol); + } return unknownType; } @@ -1552,7 +1771,7 @@ module ts { function hasBaseType(type: InterfaceType, checkBase: InterfaceType) { return check(type); - function check(type: InterfaceType) { + function check(type: InterfaceType): boolean { var target = getTargetType(type); return target === checkBase || forEach(target.baseTypes, check); } @@ -1822,6 +2041,112 @@ module ts { return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; } + function createTupleTypeMemberSymbols(memberTypes: Type[]): SymbolTable { + var members: SymbolTable = {}; + for (var i = 0; i < memberTypes.length; i++) { + var symbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "" + i); + symbol.type = memberTypes[i]; + members[i] = symbol; + } + return members; + } + + function resolveTupleTypeMembers(type: TupleType) { + var arrayType = resolveObjectTypeMembers(createArrayType(getUnionType(type.elementTypes))); + var members = createTupleTypeMemberSymbols(type.elementTypes); + addInheritedMembers(members, arrayType.properties); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + } + + function signatureListsIdentical(s: Signature[], t: Signature[]): boolean { + if (s.length !== t.length) { + return false; + } + for (var i = 0; i < s.length; i++) { + if (!compareSignatures(s[i], t[i], /*compareReturnTypes*/ false, isTypeIdenticalTo)) { + return false; + } + } + return true; + } + + // If the lists of call or construct signatures in the given types are all identical except for return types, + // and if none of the signatures are generic, return a list of signatures that has substitutes a union of the + // return types of the corresponding signatures in each resulting signature. + function getUnionSignatures(types: Type[], kind: SignatureKind): Signature[] { + var signatureLists = map(types, t => getSignaturesOfType(t, kind)); + var signatures = signatureLists[0]; + for (var i = 0; i < signatures.length; i++) { + if (signatures[i].typeParameters) { + return emptyArray; + } + } + for (var i = 1; i < signatureLists.length; i++) { + if (!signatureListsIdentical(signatures, signatureLists[i])) { + return emptyArray; + } + } + var result = map(signatures, cloneSignature); + for (var i = 0; i < result.length; i++) { + var s = result[i]; + // Clear resolved return type we possibly got from cloneSignature + s.resolvedReturnType = undefined; + s.unionSignatures = map(signatureLists, signatures => signatures[i]); + } + return result; + } + + function getUnionIndexType(types: Type[], kind: IndexKind): Type { + var indexTypes: Type[] = []; + for (var i = 0; i < types.length; i++) { + var indexType = getIndexTypeOfType(types[i], kind); + if (!indexType) { + return undefined; + } + indexTypes.push(indexType); + } + return getUnionType(indexTypes); + } + + function resolveUnionTypeMembers(type: UnionType) { + var types: Type[] = []; + forEach(type.types, t => { + var apparentType = getApparentType(t); + if (!contains(types, apparentType)) { + types.push(apparentType); + } + }); + if (types.length <= 1) { + var resolved = types.length ? resolveObjectTypeMembers(types[0]) : emptyObjectType; + setObjectTypeMembers(type, resolved.members, resolved.callSignatures, resolved.constructSignatures, resolved.stringIndexType, resolved.numberIndexType); + return; + } + var members: SymbolTable = {}; + forEach(getPropertiesOfType(types[0]), prop => { + for (var i = 1; i < types.length; i++) { + if (!getPropertyOfType(types[i], prop.name)) { + return; + } + } + var symbol = createSymbol(SymbolFlags.UnionProperty | SymbolFlags.Transient, prop.name); + symbol.unionType = type; + + symbol.declarations = []; + for (var i = 0; i < types.length; i++) { + var s = getPropertyOfType(types[i], prop.name); + if (s.declarations) + symbol.declarations.push.apply(symbol.declarations, s.declarations); + } + + members[prop.name] = symbol; + }); + var callSignatures = getUnionSignatures(types, SignatureKind.Call); + var constructSignatures = getUnionSignatures(types, SignatureKind.Construct); + var stringIndexType = getUnionIndexType(types, IndexKind.String); + var numberIndexType = getUnionIndexType(types, IndexKind.Number); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveAnonymousTypeMembers(type: ObjectType) { var symbol = type.symbol; if (symbol.flags & SymbolFlags.TypeLiteral) { @@ -1867,6 +2192,12 @@ module ts { else if (type.flags & TypeFlags.Anonymous) { resolveAnonymousTypeMembers(type); } + else if (type.flags & TypeFlags.Tuple) { + resolveTupleTypeMembers(type); + } + else if (type.flags & TypeFlags.Union) { + resolveUnionTypeMembers(type); + } else { resolveTypeReferenceMembers(type); } @@ -2027,6 +2358,9 @@ module ts { if (signature.target) { var type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } + else if (signature.unionSignatures) { + var type = getUnionType(map(signature.unionSignatures, getReturnTypeOfSignature)); + } else { var type = getReturnTypeFromBody(signature.declaration); } @@ -2036,6 +2370,15 @@ module ts { } else if (signature.resolvedReturnType === resolvingType) { signature.resolvedReturnType = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, identifierToString(declaration.name)); + } + else { + error(declaration, Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } + } } return signature.resolvedReturnType; } @@ -2222,7 +2565,7 @@ module ts { if (type.flags & (TypeFlags.Class | TypeFlags.Interface) && type.flags & TypeFlags.Reference) { var typeParameters = (type).typeParameters; if (node.typeArguments && node.typeArguments.length === typeParameters.length) { - type = createTypeReference(type, map(node.typeArguments, t => getTypeFromTypeNode(t))); + type = createTypeReference(type, map(node.typeArguments, getTypeFromTypeNode)); } else { error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), typeParameters.length); @@ -2308,6 +2651,120 @@ module ts { return links.resolvedType; } + function createTupleType(elementTypes: Type[]) { + var id = getTypeListId(elementTypes); + var type = tupleTypes[id]; + if (!type) { + type = tupleTypes[id] = createObjectType(TypeFlags.Tuple); + type.elementTypes = elementTypes; + } + return type; + } + + function getTypeFromTupleTypeNode(node: TupleTypeNode): Type { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromTypeNode)); + } + return links.resolvedType; + } + + function addTypeToSortedSet(sortedSet: Type[], type: Type) { + if (type.flags & TypeFlags.Union) { + addTypesToSortedSet(sortedSet, (type).types); + } + else { + var i = 0; + var id = type.id; + while (i < sortedSet.length && sortedSet[i].id < id) { + i++; + } + if (i === sortedSet.length || sortedSet[i].id !== id) { + sortedSet.splice(i, 0, type); + } + } + } + + function addTypesToSortedSet(sortedTypes: Type[], types: Type[]) { + for (var i = 0, len = types.length; i < len; i++) { + addTypeToSortedSet(sortedTypes, types[i]); + } + } + + function isSubtypeOfAny(candidate: Type, types: Type[]): boolean { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + return true; + } + } + return false; + } + + function removeSubtypes(types: Type[]) { + var i = types.length; + while (i > 0) { + i--; + if (isSubtypeOfAny(types[i], types)) { + types.splice(i, 1); + } + } + } + + function containsAnyType(types: Type[]) { + for (var i = 0; i < types.length; i++) { + if (types[i].flags & TypeFlags.Any) { + return true; + } + } + return false; + } + + function removeAllButLast(types: Type[], typeToRemove: Type) { + var i = types.length; + while (i > 0 && types.length > 1) { + i--; + if (types[i] === typeToRemove) { + types.splice(i, 1); + } + } + } + + function getUnionType(types: Type[], noSubtypeReduction?: boolean): Type { + if (types.length === 0) { + return emptyObjectType; + } + var sortedTypes: Type[] = []; + addTypesToSortedSet(sortedTypes, types); + if (noSubtypeReduction) { + if (containsAnyType(sortedTypes)) { + return anyType; + } + removeAllButLast(sortedTypes, undefinedType); + removeAllButLast(sortedTypes, nullType); + } + else { + removeSubtypes(sortedTypes); + } + if (sortedTypes.length === 1) { + return sortedTypes[0]; + } + var id = getTypeListId(sortedTypes); + var type = unionTypes[id]; + if (!type) { + type = unionTypes[id] = createObjectType(TypeFlags.Union); + type.types = sortedTypes; + } + return type; + } + + function getTypeFromUnionTypeNode(node: UnionTypeNode): Type { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), /*noSubtypeReduction*/ true); + } + return links.resolvedType; + } + function getTypeFromTypeLiteralNode(node: TypeLiteralNode): Type { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -2320,7 +2777,7 @@ module ts { function getStringLiteralType(node: StringLiteralTypeNode): StringLiteralType { if (hasProperty(stringLiteralTypes, node.text)) return stringLiteralTypes[node.text]; var type = stringLiteralTypes[node.text] = createType(TypeFlags.StringLiteral); - type.text = getSourceTextOfNode(node); + type.text = getTextOfNode(node); return type; } @@ -2352,6 +2809,10 @@ module ts { return getTypeFromTypeQueryNode(node); case SyntaxKind.ArrayType: return getTypeFromArrayTypeNode(node); + case SyntaxKind.TupleType: + return getTypeFromTupleTypeNode(node); + case SyntaxKind.UnionType: + return getTypeFromUnionTypeNode(node); case SyntaxKind.TypeLiteral: return getTypeFromTypeLiteralNode(node); // This function assumes that an identifier or qualified name is a type expression @@ -2359,7 +2820,7 @@ module ts { case SyntaxKind.Identifier: case SyntaxKind.QualifiedName: var symbol = getSymbolInfo(node); - return getDeclaredTypeOfSymbol(symbol); + return symbol && getDeclaredTypeOfSymbol(symbol); default: return unknownType; } @@ -2513,6 +2974,12 @@ module ts { if (type.flags & TypeFlags.Reference) { return createTypeReference((type).target, instantiateList((type).typeArguments, mapper, instantiateType)); } + if (type.flags & TypeFlags.Tuple) { + return createTupleType(instantiateList((type).elementTypes, mapper, instantiateType)); + } + if (type.flags & TypeFlags.Union) { + return getUnionType(instantiateList((type).types, mapper, instantiateType), /*noSubtypeReduction*/ true); + } } return type; } @@ -2632,22 +3099,19 @@ module ts { } function isPropertyIdenticalToRecursive(sourceProp: Symbol, targetProp: Symbol, reportErrors: boolean, relate: (source: Type, target: Type, reportErrors: boolean) => boolean): boolean { - Debug.assert(sourceProp); - if (!targetProp) { - return false; - } - // Two members are considered identical when // - they are public properties with identical names, optionality, and types, - // - they are private properties originating in the same declaration and having identical types - var sourcePropIsPrivate = getDeclarationFlagsFromSymbol(sourceProp) & NodeFlags.Private; - var targetPropIsPrivate = getDeclarationFlagsFromSymbol(targetProp) & NodeFlags.Private; - if (sourcePropIsPrivate !== targetPropIsPrivate) { + // - they are private or protected properties originating in the same declaration and having identical types + if (sourceProp === targetProp) { + return true; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (NodeFlags.Private | NodeFlags.Protected); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (NodeFlags.Private | NodeFlags.Protected); + if (sourcePropAccessibility !== targetPropAccessibility) { return false; } - - if (sourcePropIsPrivate) { - return (getTargetSymbol(sourceProp).parent === getTargetSymbol(targetProp).parent) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (sourcePropAccessibility) { + return getTargetSymbol(sourceProp) === getTargetSymbol(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); } else { return isOptionalProperty(sourceProp) === isOptionalProperty(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); @@ -2673,11 +3137,11 @@ module ts { } return result; - function reportError(message: DiagnosticMessage, arg0?: string, arg1?: string): void { - errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1); + function reportError(message: DiagnosticMessage, arg0?: string, arg1?: string, arg2?: string): void { + errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } - function isRelatedTo(source: Type, target: Type, reportErrors: boolean): boolean { + function isRelatedTo(source: Type, target: Type, reportErrors?: boolean): boolean { return isRelatedToWithCustomErrors(source, target, reportErrors, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined); } @@ -2698,8 +3162,17 @@ module ts { if (source === numberType && target.flags & TypeFlags.Enum) return true; } } - - if (source.flags & TypeFlags.TypeParameter && target.flags & TypeFlags.TypeParameter) { + if (source.flags & TypeFlags.Union) { + if (unionTypeRelatedToType(source, target, reportErrors)) { + return true; + } + } + else if (target.flags & TypeFlags.Union) { + if (typeRelatedToUnionType(source, target, reportErrors)) { + return true; + } + } + else if (source.flags & TypeFlags.TypeParameter && target.flags & TypeFlags.TypeParameter) { if (typeParameterRelatedTo(source, target, reportErrors)) { return true; } @@ -2716,7 +3189,7 @@ module ts { // Report structural errors only if we haven't reported any errors yet var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; // identity relation does not use apparent type - var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); + var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); if (sourceOrApparentType.flags & TypeFlags.ObjectType && target.flags & TypeFlags.ObjectType && objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors)) { errorInfo = saveErrorInfo; @@ -2737,6 +3210,26 @@ module ts { return false; } + function typeRelatedToUnionType(source: Type, target: UnionType, reportErrors: boolean): boolean { + var targetTypes = target.types; + for (var i = 0, len = targetTypes.length; i < len; i++) { + if (isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1)) { + return true; + } + } + return false; + } + + function unionTypeRelatedToType(source: UnionType, target: Type, reportErrors: boolean): boolean { + var sourceTypes = source.types; + for (var i = 0, len = sourceTypes.length; i < len; i++) { + if (!isRelatedTo(sourceTypes[i], target, reportErrors)) { + return false; + } + } + return true; + } + function typesRelatedTo(sources: Type[], targets: Type[], reportErrors: boolean): boolean { for (var i = 0, len = sources.length; i < len; i++) { if (!isRelatedTo(sources[i], targets[i], reportErrors)) return false; @@ -2838,163 +3331,104 @@ module ts { function propertiesRelatedTo(source: ObjectType, target: ObjectType, reportErrors: boolean): boolean { if (relation === identityRelation) { - return propertiesAreIdenticalTo(source, target, reportErrors); + return propertiesIdenticalTo(source, target, reportErrors); } - else { - return propertiesAreSubtypeOrAssignableTo(source, target, reportErrors); + var properties = getPropertiesOfType(target); + for (var i = 0; i < properties.length; i++) { + var targetProp = properties[i]; + var sourceProp = getPropertyOfApparentType(source, targetProp.name); + if (sourceProp !== targetProp) { + if (!sourceProp) { + if (!isOptionalProperty(targetProp)) { + if (reportErrors) { + reportError(Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); + } + return false; + } + } + else if (!(targetProp.flags & SymbolFlags.Prototype)) { + var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); + var targetFlags = getDeclarationFlagsFromSymbol(targetProp); + if (sourceFlags & NodeFlags.Private || targetFlags & NodeFlags.Private) { + if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (reportErrors) { + if (sourceFlags & NodeFlags.Private && targetFlags & NodeFlags.Private) { + reportError(Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } + else { + reportError(Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), + typeToString(sourceFlags & NodeFlags.Private ? source : target), + typeToString(sourceFlags & NodeFlags.Private ? target : source)); + } + } + return false; + } + } + else if (targetFlags & NodeFlags.Protected) { + var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & SymbolFlags.Class; + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; + var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (reportErrors) { + reportError(Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, + symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + } + return false; + } + } + else if (sourceFlags & NodeFlags.Protected) { + if (reportErrors) { + reportError(Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, + symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return false; + } + if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) { + if (reportErrors) { + reportError(Diagnostics.Types_of_property_0_are_incompatible_Colon, symbolToString(targetProp)); + } + return false; + } + if (isOptionalProperty(sourceProp) && !isOptionalProperty(targetProp)) { + // TypeScript 1.0 spec (April 2014): 3.8.3 + // S is a subtype of a type T, and T is a supertype of S if ... + // S' and T are object types and, for each member M in T.. + // M is a property and S' contains a property N where + // if M is a required property, N is also a required property + // (M - property in T) + // (N - property in S) + if (reportErrors) { + reportError(Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, + symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return false; + } + } + } } + return true; } - function propertiesAreIdenticalTo(source: ObjectType, target: ObjectType, reportErrors: boolean): boolean { - if (source === target) { - return true; - } - + function propertiesIdenticalTo(source: ObjectType, target: ObjectType, reportErrors: boolean): boolean { var sourceProperties = getPropertiesOfType(source); var targetProperties = getPropertiesOfType(target); if (sourceProperties.length !== targetProperties.length) { return false; } - for (var i = 0, len = sourceProperties.length; i < len; ++i) { var sourceProp = sourceProperties[i]; var targetProp = getPropertyOfType(target, sourceProp.name); - - if (!isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, isRelatedTo)) { + if (!targetProp || !isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, isRelatedTo)) { return false; } } - - return true; - } - - function propertiesAreSubtypeOrAssignableTo(source: ApparentType, target: ObjectType, reportErrors: boolean): boolean { - var properties = getPropertiesOfType(target); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; - var sourceProp = getPropertyOfApparentType(source, targetProp.name); - if (sourceProp === targetProp) { - continue; - } - - var targetPropIsOptional = isOptionalProperty(targetProp); - if (!sourceProp) { - if (!targetPropIsOptional) { - if (reportErrors) { - reportError(Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); - } - return false; - } - } - else if (sourceProp !== targetProp) { - if (targetProp.flags & SymbolFlags.Prototype) { - continue; - } - - if (getDeclarationFlagsFromSymbol(sourceProp) & NodeFlags.Private || getDeclarationFlagsFromSymbol(targetProp) & NodeFlags.Private) { - if (reportErrors) { - reportError(Diagnostics.Private_property_0_cannot_be_reimplemented, symbolToString(targetProp)); - } - return false; - } - if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) { - if (reportErrors) { - reportError(Diagnostics.Types_of_property_0_are_incompatible_Colon, symbolToString(targetProp)); - } - return false; - } - else if (isOptionalProperty(sourceProp) && !targetPropIsOptional) { - // TypeScript 1.0 spec (April 2014): 3.8.3 - // S is a subtype of a type T, and T is a supertype of S if ... - // S' and T are object types and, for each member M in T.. - // M is a property and S' contains a property N where - // if M is a required property, N is also a required property - // (M - property in T) - // (N - property in S) - if (reportErrors) { - reportError(Diagnostics.Required_property_0_cannot_be_reimplemented_with_optional_property_in_1, targetProp.name, typeToString(source)); - } - return false; - } - } - } return true; } function signaturesRelatedTo(source: ObjectType, target: ObjectType, kind: SignatureKind, reportErrors: boolean): boolean { if (relation === identityRelation) { - return areSignaturesIdenticalTo(source, target, kind, reportErrors); + return signaturesIdenticalTo(source, target, kind, reportErrors); } - else { - return areSignaturesSubtypeOrAssignableTo(source, target, kind, reportErrors); - } - } - - function areSignaturesIdenticalTo(source: ObjectType, target: ObjectType, kind: SignatureKind, reportErrors: boolean): boolean { - var sourceSignatures = getSignaturesOfType(source, kind); - var targetSignatures = getSignaturesOfType(target, kind); - if (sourceSignatures.length !== targetSignatures.length) { - return false; - } - - for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - if (!isSignatureIdenticalTo(sourceSignatures[i], targetSignatures[i], reportErrors)) { - return false; - } - } - - return true; - } - - function isSignatureIdenticalTo(source: Signature, target: Signature, reportErrors: boolean): boolean { - if (source === target) { - return true; - } - - if (source.hasRestParameter !== target.hasRestParameter) { - return false; - } - - if (source.parameters.length !== target.parameters.length) { - return false; - } - - if (source.minArgumentCount !== target.minArgumentCount) { - return false; - } - - if (source.typeParameters && target.typeParameters) { - if (source.typeParameters.length !== target.typeParameters.length) { - return false; - } - - for (var i = 0, len = source.typeParameters.length; i < len; ++i) { - if (!isRelatedTo(source.typeParameters[i], target.typeParameters[i], reportErrors)) { - return false; - } - } - } - else if (source.typeParameters || source.typeParameters) { - return false; - } - - // Spec 1.0 Section 3.8.3 & 3.8.4: - // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N - source = getErasedSignature(source); - target = getErasedSignature(target); - for (var i = 0, len = source.parameters.length; i < len; i++) { - var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); - if (!isRelatedTo(s, t, reportErrors)) { - return false; - } - } - var t = getReturnTypeOfSignature(target); - var s = getReturnTypeOfSignature(source); - return isRelatedTo(s, t, reportErrors); - } - - function areSignaturesSubtypeOrAssignableTo(source: ObjectType, target: ObjectType, kind: SignatureKind, reportErrors: boolean): boolean { if (target === anyFunctionType || source === anyFunctionType) return true; var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); @@ -3006,7 +3440,7 @@ module ts { for (var j = 0; j < sourceSignatures.length; j++) { var s = sourceSignatures[j]; if (!s.hasStringLiterals || source.flags & TypeFlags.FromSignature) { - if (isSignatureSubtypeOrAssignableTo(s, t, localErrors)) { + if (signatureRelatedTo(s, t, localErrors)) { errorInfo = saveErrorInfo; continue outer; } @@ -3020,15 +3454,13 @@ module ts { return true; } - function isSignatureSubtypeOrAssignableTo(source: Signature, target: Signature, reportErrors: boolean): boolean { + function signatureRelatedTo(source: Signature, target: Signature, reportErrors: boolean): boolean { if (source === target) { return true; } - if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { return false; } - var sourceMax = source.parameters.length; var targetMax = target.parameters.length; var checkCount: number; @@ -3074,71 +3506,117 @@ module ts { return isRelatedTo(s, t, reportErrors); } + function signaturesIdenticalTo(source: ObjectType, target: ObjectType, kind: SignatureKind, reportErrors: boolean): boolean { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + if (sourceSignatures.length !== targetSignatures.length) { + return false; + } + for (var i = 0, len = sourceSignatures.length; i < len; ++i) { + if (!compareSignatures(sourceSignatures[i], targetSignatures[i], /*compareReturnTypes*/ true, isRelatedTo)) { + return false; + } + } + return true; + } + function stringIndexTypesRelatedTo(source: ObjectType, target: ObjectType, reportErrors: boolean): boolean { if (relation === identityRelation) { - return areIndexTypesIdenticalTo(IndexKind.String, source, target, reportErrors); + return indexTypesIdenticalTo(IndexKind.String, source, target, reportErrors); } - else { - var targetType = getIndexTypeOfType(target, IndexKind.String); - if (targetType) { - var sourceType = getIndexTypeOfType(source, IndexKind.String); - if (!sourceType) { - if (reportErrors) { - reportError(Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); - } - return false; - } - if (!isRelatedTo(sourceType, targetType, reportErrors)) { - if (reportErrors) { - reportError(Diagnostics.Index_signatures_are_incompatible_Colon); - } - return false; + var targetType = getIndexTypeOfType(target, IndexKind.String); + if (targetType) { + var sourceType = getIndexTypeOfType(source, IndexKind.String); + if (!sourceType) { + if (reportErrors) { + reportError(Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } + return false; + } + if (!isRelatedTo(sourceType, targetType, reportErrors)) { + if (reportErrors) { + reportError(Diagnostics.Index_signatures_are_incompatible_Colon); + } + return false; } - return true; } + return true; } function numberIndexTypesRelatedTo(source: ObjectType, target: ObjectType, reportErrors: boolean): boolean { if (relation === identityRelation) { - return areIndexTypesIdenticalTo(IndexKind.Number, source, target, reportErrors); + return indexTypesIdenticalTo(IndexKind.Number, source, target, reportErrors); } - else { - var targetType = getIndexTypeOfType(target, IndexKind.Number); - if (targetType) { - var sourceStringType = getIndexTypeOfType(source, IndexKind.String); - var sourceNumberType = getIndexTypeOfType(source, IndexKind.Number); - if (!(sourceStringType || sourceNumberType)) { - if (reportErrors) { - reportError(Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); - } - return false; - } - if (sourceStringType && sourceNumberType) { - // If we know for sure we're testing both string and numeric index types then only report errors from the second one - var compatible = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); - } - else { - var compatible = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); - } - if (!compatible) { - if (reportErrors) { - reportError(Diagnostics.Index_signatures_are_incompatible_Colon); - } - return false; + var targetType = getIndexTypeOfType(target, IndexKind.Number); + if (targetType) { + var sourceStringType = getIndexTypeOfType(source, IndexKind.String); + var sourceNumberType = getIndexTypeOfType(source, IndexKind.Number); + if (!(sourceStringType || sourceNumberType)) { + if (reportErrors) { + reportError(Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } + return false; + } + if (sourceStringType && sourceNumberType) { + // If we know for sure we're testing both string and numeric index types then only report errors from the second one + var compatible = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + } + else { + var compatible = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + } + if (!compatible) { + if (reportErrors) { + reportError(Diagnostics.Index_signatures_are_incompatible_Colon); + } + return false; } - return true; } + return true; } - function areIndexTypesIdenticalTo(indexKind: IndexKind, source: ObjectType, target: ObjectType, reportErrors: boolean): boolean { + function indexTypesIdenticalTo(indexKind: IndexKind, source: ObjectType, target: ObjectType, reportErrors: boolean): boolean { var targetType = getIndexTypeOfType(target, indexKind); var sourceType = getIndexTypeOfType(source, indexKind); return (!sourceType && !targetType) || (sourceType && targetType && isRelatedTo(sourceType, targetType, reportErrors)); } } + function compareSignatures(source: Signature, target: Signature, compareReturnTypes: boolean, compareTypes: (s: Type, t: Type) => boolean): boolean { + if (source === target) { + return true; + } + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { + return false; + } + if (source.typeParameters && target.typeParameters) { + if (source.typeParameters.length !== target.typeParameters.length) { + return false; + } + for (var i = 0, len = source.typeParameters.length; i < len; ++i) { + if (!compareTypes(source.typeParameters[i], target.typeParameters[i])) { + return false; + } + } + } + else if (source.typeParameters || source.typeParameters) { + return false; + } + // Spec 1.0 Section 3.8.3 & 3.8.4: + // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N + source = getErasedSignature(source); + target = getErasedSignature(target); + for (var i = 0, len = source.parameters.length; i < len; i++) { + var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + if (!compareTypes(s, t)) { + return false; + } + } + return !compareReturnTypes || compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + function isSupertypeOfEach(candidate: Type, types: Type[]): boolean { for (var i = 0, len = types.length; i < len; i++) { if (candidate !== types[i] && !isTypeSubtypeOf(types[i], candidate)) return false; @@ -3146,9 +3624,12 @@ module ts { return true; } - function getBestCommonType(types: Type[], contextualType?: Type, candidatesOnly?: boolean): Type { - if (contextualType && isSupertypeOfEach(contextualType, types)) return contextualType; - return forEach(types, t => isSupertypeOfEach(t, types) ? t : undefined) || (candidatesOnly ? undefined : emptyObjectType); + function getCommonSupertype(types: Type[]): Type { + return forEach(types, t => isSupertypeOfEach(t, types) ? t : undefined); + } + + function getBestCommonType(types: Type[], contextualType: Type): Type { + return contextualType && isSupertypeOfEach(contextualType, types) ? contextualType : getUnionType(types); } function isTypeOfObjectLiteral(type: Type): boolean { @@ -3163,15 +3644,17 @@ module ts { while (isArrayType(type)) { type = (type).typeArguments[0]; } - return type; } /* If we are widening on a literal, then we may need to the 'node' parameter for reporting purposes */ - function getWidenedType(type: Type, supressNoImplicitAnyErrors?: boolean): Type { + function getWidenedType(type: Type, suppressNoImplicitAnyErrors?: boolean): Type { if (type.flags & (TypeFlags.Undefined | TypeFlags.Null)) { return anyType; } + if (type.flags & TypeFlags.Union) { + return getWidenedTypeOfUnion(type); + } if (isTypeOfObjectLiteral(type)) { return getWidenedTypeOfObjectLiteral(type); } @@ -3180,6 +3663,10 @@ module ts { } return type; + function getWidenedTypeOfUnion(type: Type): Type { + return getUnionType(map((type).types, t => getWidenedType(t, suppressNoImplicitAnyErrors))); + } + function getWidenedTypeOfObjectLiteral(type: Type): Type { var properties = getPropertiesOfType(type); if (properties.length) { @@ -3190,8 +3677,7 @@ module ts { var widenedType = getWidenedType(propType); if (propType !== widenedType) { propTypeWasWidened = true; - - if (!supressNoImplicitAnyErrors && program.getCompilerOptions().noImplicitAny && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { + if (!suppressNoImplicitAnyErrors && compilerOptions.noImplicitAny && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { error(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(widenedType)); } } @@ -3221,10 +3707,8 @@ module ts { function getWidenedTypeOfArrayLiteral(type: Type): Type { var elementType = (type).typeArguments[0]; - var widenedType = getWidenedType(elementType, supressNoImplicitAnyErrors); - + var widenedType = getWidenedType(elementType, suppressNoImplicitAnyErrors); type = elementType !== widenedType ? createArrayType(widenedType) : type; - return type; } } @@ -3261,6 +3745,7 @@ module ts { for (var i = 0; i < typeParameters.length; i++) inferences.push([]); return { typeParameters: typeParameters, + inferenceCount: 0, inferences: inferences, inferredTypes: new Array(typeParameters.length), }; @@ -3298,6 +3783,7 @@ module ts { var typeParameters = context.typeParameters; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { + context.inferenceCount++; var inferences = context.inferences[i]; if (!contains(inferences, source)) inferences.push(source); break; @@ -3312,9 +3798,37 @@ module ts { inferFromTypes(sourceTypes[i], targetTypes[i]); } } - else if (source.flags & TypeFlags.ObjectType && (target.flags & TypeFlags.Reference || (target.flags & TypeFlags.Anonymous) && - target.symbol && target.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral))) { - // If source is an object type, and target is a type reference, the type of a method, or a type literal, infer from members + else if (target.flags & TypeFlags.Union) { + var targetTypes = (target).types; + var startCount = context.inferenceCount; + var typeParameterCount = 0; + var typeParameter: TypeParameter; + // First infer to each type in union that isn't a type parameter + for (var i = 0; i < targetTypes.length; i++) { + var t = targetTypes[i]; + if (t.flags & TypeFlags.TypeParameter && contains(context.typeParameters, t)) { + typeParameter = t; + typeParameterCount++; + } + else { + inferFromTypes(source, t); + } + } + // If no inferences were produced above and union contains a single naked type parameter, infer to that type parameter + if (context.inferenceCount === startCount && typeParameterCount === 1) { + inferFromTypes(source, typeParameter); + } + } + else if (source.flags & TypeFlags.Union) { + // Source is a union type, infer from each consituent type + var sourceTypes = (source).types; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], target); + } + } + else if (source.flags & TypeFlags.ObjectType && (target.flags & (TypeFlags.Reference | TypeFlags.Tuple) || + (target.flags & TypeFlags.Anonymous) && target.symbol && target.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral))) { + // If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -3375,9 +3889,19 @@ module ts { function getInferredType(context: InferenceContext, index: number): Type { var result = context.inferredTypes[index]; if (!result) { - var commonType = getWidenedType(getBestCommonType(context.inferences[index])); + var inferences = context.inferences[index]; + if (inferences.length) { + // Find type that is supertype of all others + var supertype = getCommonSupertype(inferences); + // Infer widened supertype, or the undefined type for no common supertype + var inferredType = supertype ? getWidenedType(supertype) : undefinedType; + } + else { + // Infer the empty object type when no inferences were made + inferredType = emptyObjectType; + } var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); - var result = constraint && !isTypeAssignableTo(commonType, constraint) ? constraint : commonType; + var result = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; context.inferredTypes[index] = result; } return result; @@ -3395,81 +3919,290 @@ module ts { return getAncestor(node, kind) !== undefined; } - function getAncestor(node: Node, kind: SyntaxKind): Node { - switch (kind) { - // special-cases that can be come first - case SyntaxKind.ClassDeclaration: - while (node) { - switch (node.kind) { - case SyntaxKind.ClassDeclaration: - return node; - case SyntaxKind.EnumDeclaration: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ImportDeclaration: - // early exit cases - declarations cannot be nested in classes - return undefined; - default: - node = node.parent; - continue; - } - } - break; - default: - while (node) { - if (node.kind === kind) { - return node; - } - else { - node = node.parent; - } - } - break; - } - - return undefined; - } - // EXPRESSION TYPE CHECKING - function checkIdentifier(node: Identifier): Type { - function isInTypeQuery(node: Node): boolean { - // TypeScript 1.0 spec (April 2014): 3.6.3 - // A type query consists of the keyword typeof followed by an expression. - // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - while (node) { - switch (node.kind) { - case SyntaxKind.TypeQuery: - return true; - case SyntaxKind.Identifier: - case SyntaxKind.QualifiedName: - node = node.parent; - continue; - default: - return false; + function getResolvedSymbol(node: Identifier): Symbol { + var links = getNodeLinks(node); + if (!links.resolvedSymbol) { + links.resolvedSymbol = resolveName(node, node.text, SymbolFlags.Value | SymbolFlags.ExportValue, Diagnostics.Cannot_find_name_0, identifierToString(node)) || unknownSymbol; + } + return links.resolvedSymbol; + } + + function isInTypeQuery(node: Node): boolean { + // TypeScript 1.0 spec (April 2014): 3.6.3 + // A type query consists of the keyword typeof followed by an expression. + // The expression is restricted to a single identifier or a sequence of identifiers separated by periods + while (node) { + switch (node.kind) { + case SyntaxKind.TypeQuery: + return true; + case SyntaxKind.Identifier: + case SyntaxKind.QualifiedName: + node = node.parent; + continue; + default: + return false; + } + } + Debug.fail("should not get here"); + } + + // Remove one or more primitive types from a union type + function subtractPrimitiveTypes(type: Type, subtractMask: TypeFlags): Type { + if (type.flags & TypeFlags.Union) { + var types = (type).types; + if (forEach(types, t => t.flags & subtractMask)) { + return getUnionType(filter(types, t => !(t.flags & subtractMask))); + } + } + return type; + } + + // Check if a given variable is assigned within a given syntax node + function isVariableAssignedWithin(symbol: Symbol, node: Node): boolean { + var links = getNodeLinks(node); + if (links.assignmentChecks) { + var cachedResult = links.assignmentChecks[symbol.id]; + if (cachedResult !== undefined) { + return cachedResult; + } + } + else { + links.assignmentChecks = {}; + } + return links.assignmentChecks[symbol.id] = isAssignedIn(node); + + function isAssignedInBinaryExpression(node: BinaryExpression) { + if (node.operator >= SyntaxKind.FirstAssignment && node.operator <= SyntaxKind.LastAssignment) { + var n = node.left; + while (n.kind === SyntaxKind.ParenExpression) { + n = (n).expression; + } + if (n.kind === SyntaxKind.Identifier && getResolvedSymbol(n) === symbol) { + return true; } } - Debug.fail("should not get here"); + return forEachChild(node, isAssignedIn); } - var symbol = resolveName(node, node.text, SymbolFlags.Value | SymbolFlags.ExportValue, Diagnostics.Cannot_find_name_0, identifierToString(node)); - if (!symbol) { - symbol = unknownSymbol; + function isAssignedInVariableDeclaration(node: VariableDeclaration) { + if (getSymbolOfNode(node) === symbol && node.initializer) { + return true; + } + return forEachChild(node, isAssignedIn); } + function isAssignedIn(node: Node): boolean { + switch (node.kind) { + case SyntaxKind.BinaryExpression: + return isAssignedInBinaryExpression(node); + case SyntaxKind.VariableDeclaration: + return isAssignedInVariableDeclaration(node); + case SyntaxKind.ArrayLiteral: + case SyntaxKind.ObjectLiteral: + case SyntaxKind.PropertyAccess: + case SyntaxKind.IndexedAccess: + case SyntaxKind.CallExpression: + case SyntaxKind.NewExpression: + case SyntaxKind.TypeAssertion: + case SyntaxKind.ParenExpression: + case SyntaxKind.PrefixOperator: + case SyntaxKind.PostfixOperator: + case SyntaxKind.ConditionalExpression: + case SyntaxKind.Block: + case SyntaxKind.VariableStatement: + case SyntaxKind.ExpressionStatement: + case SyntaxKind.IfStatement: + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + case SyntaxKind.ForStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.ReturnStatement: + case SyntaxKind.WithStatement: + case SyntaxKind.SwitchStatement: + case SyntaxKind.CaseClause: + case SyntaxKind.DefaultClause: + case SyntaxKind.LabeledStatement: + case SyntaxKind.ThrowStatement: + case SyntaxKind.TryStatement: + case SyntaxKind.TryBlock: + case SyntaxKind.CatchBlock: + case SyntaxKind.FinallyBlock: + return forEachChild(node, isAssignedIn); + } + return false; + } + } + + // Get the narrowed type of a given symbol at a given location + function getNarrowedTypeOfSymbol(symbol: Symbol, node: Node) { + var type = getTypeOfSymbol(symbol); + // Only narrow when symbol is variable of a non-primitive type + if (symbol.flags & SymbolFlags.Variable && isTypeAnyOrObjectOrTypeParameter(type)) { + while (true) { + var child = node; + node = node.parent; + // Stop at containing function or module block + if (!node || node.kind === SyntaxKind.FunctionBlock || node.kind === SyntaxKind.ModuleBlock) { + break; + } + var narrowedType = type; + switch (node.kind) { + case SyntaxKind.IfStatement: + // In a branch of an if statement, narrow based on controlling expression + if (child !== (node).expression) { + narrowedType = narrowType(type, (node).expression, /*assumeTrue*/ child === (node).thenStatement); + } + break; + case SyntaxKind.ConditionalExpression: + // In a branch of a conditional expression, narrow based on controlling condition + if (child !== (node).condition) { + narrowedType = narrowType(type, (node).condition, /*assumeTrue*/ child === (node).whenTrue); + } + break; + case SyntaxKind.BinaryExpression: + // In the right operand of an && or ||, narrow based on left operand + if (child === (node).right) { + if ((node).operator === SyntaxKind.AmpersandAmpersandToken) { + narrowedType = narrowType(type, (node).left, /*assumeTrue*/ true); + } + else if ((node).operator === SyntaxKind.BarBarToken) { + narrowedType = narrowType(type, (node).left, /*assumeTrue*/ false); + } + } + break; + } + // Only use narrowed type if construct contains no assignments to variable + if (narrowedType !== type) { + if (isVariableAssignedWithin(symbol, node)) { + break; + } + type = narrowedType; + } + } + } + return type; + + function narrowTypeByEquality(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { + var left = expr.left; + var right = expr.right; + // Check that we have 'typeof ' on the left and string literal on the right + if (left.kind !== SyntaxKind.PrefixOperator || left.operator !== SyntaxKind.TypeOfKeyword || + left.operand.kind !== SyntaxKind.Identifier || right.kind !== SyntaxKind.StringLiteral || + getResolvedSymbol(left.operand) !== symbol) { + return type; + } + var t = right.text; + var checkType: Type = t === "string" ? stringType : t === "number" ? numberType : t === "boolean" ? booleanType : emptyObjectType; + if (expr.operator === SyntaxKind.ExclamationEqualsEqualsToken) { + assumeTrue = !assumeTrue; + } + if (assumeTrue) { + // The assumed result is true. If check was for a primitive type, that type is the narrowed type. Otherwise we can + // remove the primitive types from the narrowed type. + return checkType === emptyObjectType ? subtractPrimitiveTypes(type, TypeFlags.String | TypeFlags.Number | TypeFlags.Boolean) : checkType; + } + else { + // The assumed result is false. If check was for a primitive type we can remove that type from the narrowed type. + // Otherwise we don't have enough information to do anything. + return checkType === emptyObjectType ? type : subtractPrimitiveTypes(type, checkType.flags); + } + } + + function narrowTypeByAnd(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { + if (assumeTrue) { + // The assumed result is true, therefore we narrow assuming each operand to be true. + return narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ true); + } + else { + // The assumed result is false. This means either the first operand was false, or the first operand was true + // and the second operand was false. We narrow with those assumptions and union the two resulting types. + return getUnionType([ + narrowType(type, expr.left, /*assumeTrue*/ false), + narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ false) + ]); + } + } + + function narrowTypeByOr(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { + if (assumeTrue) { + // The assumed result is true. This means either the first operand was true, or the first operand was false + // and the second operand was true. We narrow with those assumptions and union the two resulting types. + return getUnionType([ + narrowType(type, expr.left, /*assumeTrue*/ true), + narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ true) + ]); + } + else { + // The assumed result is false, therefore we narrow assuming each operand to be false. + return narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ false); + } + } + + function narrowTypeByInstanceof(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { + // Check that assumed result is true and we have variable symbol on the left + if (!assumeTrue || expr.left.kind !== SyntaxKind.Identifier || getResolvedSymbol(expr.left) !== symbol) { + return type; + } + // Check that right operand is a function type with a prototype property + var rightType = checkExpression(expr.right); + if (!isTypeSubtypeOf(rightType, globalFunctionType)) { + return type; + } + var prototypeProperty = getPropertyOfType(getApparentType(rightType), "prototype"); + if (!prototypeProperty) { + return type; + } + var prototypeType = getTypeOfSymbol(prototypeProperty); + // Narrow to type of prototype property if it is a subtype of current type + return isTypeSubtypeOf(prototypeType, type) ? prototypeType : type; + } + + // Narrow the given type based on the given expression having the assumed boolean value + function narrowType(type: Type, expr: Expression, assumeTrue: boolean): Type { + switch (expr.kind) { + case SyntaxKind.ParenExpression: + return narrowType(type, (expr).expression, assumeTrue); + case SyntaxKind.BinaryExpression: + var operator = (expr).operator; + if (operator === SyntaxKind.EqualsEqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) { + return narrowTypeByEquality(type, expr, assumeTrue); + } + else if (operator === SyntaxKind.AmpersandAmpersandToken) { + return narrowTypeByAnd(type, expr, assumeTrue); + } + else if (operator === SyntaxKind.BarBarToken) { + return narrowTypeByOr(type, expr, assumeTrue); + } + else if (operator === SyntaxKind.InstanceOfKeyword) { + return narrowTypeByInstanceof(type, expr, assumeTrue); + } + break; + case SyntaxKind.PrefixOperator: + if ((expr).operator === SyntaxKind.ExclamationToken) { + return narrowType(type, (expr).operand, !assumeTrue); + } + break; + } + return type; + } + } + + function checkIdentifier(node: Identifier): Type { + var symbol = getResolvedSymbol(node); + if (symbol.flags & SymbolFlags.Import) { // Mark the import as referenced so that we emit it in the final .js file. // exception: identifiers that appear in type queries getSymbolLinks(symbol).referenced = !isInTypeQuery(node); } - getNodeLinks(node).resolvedSymbol = symbol; - checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); checkCollisionWithIndexVariableInGeneratedCode(node, node); - return getTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol)); + return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); } function captureLexicalThis(node: Node, container: Node): void { @@ -3656,15 +4389,31 @@ module ts { var func = parameter.parent; if (func.kind === SyntaxKind.FunctionExpression || func.kind === SyntaxKind.ArrowFunction) { if (isContextSensitiveExpression(func)) { - var signature = getContextualSignature(func); - if (signature) { - return getTypeAtPosition(signature, indexOf(func.parameters, parameter)); + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + + var funcHasRestParameters = hasRestParameters(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + + // If last parameter is contextually rest parameter get its type + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); + } } } } return undefined; } + // In a variable, parameter or property declaration with a type annotation, the contextual type of an initializer + // expression is the type of the variable, parameter or property. In a parameter declaration of a contextually + // typed function expression, the contextual type of an initializer expression is the contextual type of the + // parameter. function getContextualTypeForInitializerExpression(node: Expression): Type { var declaration = node.parent; if (node === declaration.initializer) { @@ -3696,6 +4445,7 @@ module ts { return undefined; } + // In a typed function call, an argument expression is contextually typed by the type of the corresponding parameter. function getContextualTypeForArgument(node: Expression): Type { var callExpression = node.parent; var argIndex = indexOf(callExpression.arguments, node); @@ -3710,11 +4460,14 @@ module ts { var binaryExpression = node.parent; var operator = binaryExpression.operator; if (operator >= SyntaxKind.FirstAssignment && operator <= SyntaxKind.LastAssignment) { + // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } else if (operator === SyntaxKind.BarBarToken) { + // When an || expression has a contextual type, the operands are contextually typed by that type. When an || + // expression has no contextual type, the right operand is contextually typed by the type of the left operand. var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -3724,33 +4477,96 @@ module ts { return undefined; } + // Apply a mapping function to a contextual type and return the resulting type. If the contextual type + // is a union type, the mapping function is applied to each constituent type and a union of the resulting + // types is returned. + function applyToContextualType(type: Type, mapper: (t: Type) => Type): Type { + if (!(type.flags & TypeFlags.Union)) { + return mapper(type); + } + var types = (type).types; + var mappedType: Type; + var mappedTypes: Type[]; + for (var i = 0; i < types.length; i++) { + var t = mapper(types[i]); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; + } + + function getTypeOfPropertyOfContextualType(type: Type, name: string) { + return applyToContextualType(type, t => { + var prop = getPropertyOfType(t, name); + return prop ? getTypeOfSymbol(prop) : undefined; + }); + } + + function getIndexTypeOfContextualType(type: Type, kind: IndexKind) { + return applyToContextualType(type, t => getIndexTypeOfType(t, kind)); + } + + // Return true if the given contextual type is a tuple-like type + function contextualTypeIsTupleType(type: Type): boolean { + return !!(type.flags & TypeFlags.Union ? forEach((type).types, t => getPropertyOfType(t, "0")) : getPropertyOfType(type, "0")); + } + + // Return true if the given contextual type provides an index signature of the given kind + function contextualTypeHasIndexSignature(type: Type, kind: IndexKind): boolean { + return !!(type.flags & TypeFlags.Union ? forEach((type).types, t => getIndexTypeOfType(t, kind)) : getIndexTypeOfType(type, kind)); + } + + // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of + // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one + // exists. Otherwise, it is the type of the string index signature in T, if one exists. function getContextualTypeForPropertyExpression(node: Expression): Type { var declaration = node.parent; var objectLiteral = declaration.parent; var type = getContextualType(objectLiteral); var name = declaration.name.text; if (type && name) { - var prop = getPropertyOfType(type, name); - if (prop) { - return getTypeOfSymbol(prop); - } - return isNumericName(name) && getIndexTypeOfType(type, IndexKind.Number) || getIndexTypeOfType(type, IndexKind.String); + return getTypeOfPropertyOfContextualType(type, name) || + isNumericName(name) && getIndexTypeOfContextualType(type, IndexKind.Number) || + getIndexTypeOfContextualType(type, IndexKind.String); } return undefined; } + // In an array literal contextually typed by a type T, the contextual type of an element expression at index N is + // the type of the property with the numeric name N in T, if one exists. Otherwise, it is the type of the numeric + // index signature in T, if one exists. function getContextualTypeForElementExpression(node: Expression): Type { var arrayLiteral = node.parent; var type = getContextualType(arrayLiteral); - return type ? getIndexTypeOfType(type, IndexKind.Number) : undefined; + if (type) { + var index = indexOf(arrayLiteral.elements, node); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, IndexKind.Number); + } + return undefined; } + // In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type. function getContextualTypeForConditionalOperand(node: Expression): Type { var conditional = node.parent; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } + // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily + // be "pushed" onto a node using the contextualType property. function getContextualType(node: Expression): Type { + if (isInsideWithStatementBody(node)) { + // We cannot answer semantic questions within a with block, do not proceed any further + return undefined; + } if (node.contextualType) { return node.contextualType; } @@ -3780,18 +4596,45 @@ module ts { return undefined; } + // Return the single non-generic signature in the given type, or undefined if none exists + function getNonGenericSignature(type: Type): Signature { + var signatures = getSignaturesOfType(type, SignatureKind.Call); + if (signatures.length !== 1) { + return undefined; + } + var signature = signatures[0]; + if (signature.typeParameters) { + return undefined; + } + return signature; + } + + // Return the contextual signature for a given expression node. A contextual type provides a + // contextual signature if it has a single call signature and if that call signature is non-generic. + // If the contextual type is a union type and each constituent type that has a contextual signature + // provides the same contextual signature, then the union type provides that contextual signature. function getContextualSignature(node: Expression): Signature { var type = getContextualType(node); - if (type) { - var signatures = getSignaturesOfType(type, SignatureKind.Call); - if (signatures.length === 1) { - var signature = signatures[0]; - if (!signature.typeParameters) { - return signature; + if (!type) { + return undefined; + } + if (!(type.flags & TypeFlags.Union)) { + return getNonGenericSignature(type); + } + var result: Signature; + var types = (type).types; + for (var i = 0; i < types.length; i++) { + var signature = getNonGenericSignature(types[i]); + if (signature) { + if (!result) { + result = signature; + } + else if (!compareSignatures(result, signature, /*compareReturnTypes*/ true, isTypeIdenticalTo)) { + return undefined; } } } - return undefined; + return result; } // Presence of a contextual type mapper indicates inferential typing, except the identityMapper object is @@ -3801,29 +4644,26 @@ module ts { } function checkArrayLiteral(node: ArrayLiteral, contextualMapper?: TypeMapper): Type { - var elementTypes: Type[] = []; - forEach(node.elements, element => { - if (element.kind !== SyntaxKind.OmittedExpression) { - var type = checkExpression(element, contextualMapper); - if (!contains(elementTypes, type)) elementTypes.push(type); - } - }); - var contextualType = isInferentialContext(contextualMapper) ? undefined : getContextualType(node); - var contextualElementType = contextualType && getIndexTypeOfType(contextualType, IndexKind.Number); - var elementType = getBestCommonType(elementTypes, contextualElementType, true); - if (!elementType) elementType = elementTypes.length ? emptyObjectType : undefinedType; - return createArrayType(elementType); + var elements = node.elements; + if (!elements.length) { + return createArrayType(undefinedType); + } + var elementTypes = map(elements, e => checkExpression(e, contextualMapper)); + var contextualType = getContextualType(node); + if (contextualType && contextualTypeIsTupleType(contextualType)) { + return createTupleType(elementTypes); + } + return createArrayType(getUnionType(elementTypes)); } function isNumericName(name: string) { - return !isNaN(name); + return (name !== "") && !isNaN(name); } function checkObjectLiteral(node: ObjectLiteral, contextualMapper?: TypeMapper): Type { var members = node.symbol.members; var properties: SymbolTable = {}; var contextualType = getContextualType(node); - for (var id in members) { if (hasProperty(members, id)) { var member = members[id]; @@ -3861,30 +4701,68 @@ module ts { return createAnonymousType(node.symbol, properties, emptyArray, emptyArray, stringIndexType, numberIndexType); function getIndexType(kind: IndexKind) { - if (contextualType) { - var indexType = getIndexTypeOfType(contextualType, kind); - if (indexType) { - var propTypes: Type[] = []; - for (var id in properties) { - if (hasProperty(properties, id)) { - if (kind === IndexKind.String || isNumericName(id)) { - var type = getTypeOfSymbol(properties[id]); - if (!contains(propTypes, type)) propTypes.push(type); - } + if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { + var propTypes: Type[] = []; + for (var id in properties) { + if (hasProperty(properties, id)) { + if (kind === IndexKind.String || isNumericName(id)) { + var type = getTypeOfSymbol(properties[id]); + if (!contains(propTypes, type)) propTypes.push(type); } } - return getBestCommonType(propTypes, isInferentialContext(contextualMapper) ? undefined : indexType); } + return propTypes.length ? getUnionType(propTypes) : undefinedType; } + return undefined; } } + // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized + // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s: Symbol) { - return s.flags & SymbolFlags.Prototype ? SyntaxKind.Property : s.valueDeclaration.kind; + return s.valueDeclaration ? s.valueDeclaration.kind : SyntaxKind.Property; } function getDeclarationFlagsFromSymbol(s: Symbol) { - return s.flags & SymbolFlags.Prototype ? NodeFlags.Public | NodeFlags.Static : s.valueDeclaration.flags; + return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & SymbolFlags.Prototype ? NodeFlags.Public | NodeFlags.Static : 0; + } + + function checkClassPropertyAccess(node: PropertyAccess, type: Type, prop: Symbol) { + var flags = getDeclarationFlagsFromSymbol(prop); + // Public properties are always accessible + if (!(flags & (NodeFlags.Private | NodeFlags.Protected))) { + return; + } + // Property is known to be private or protected at this point + // Get the declaring and enclosing class instance types + var enclosingClassDeclaration = getAncestor(node, SyntaxKind.ClassDeclaration); + var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; + var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + // Private property is accessible if declaring and enclosing class are the same + if (flags & NodeFlags.Private) { + if (declaringClass !== enclosingClass) { + error(node, Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + } + return; + } + // Property is known to be protected at this point + // All protected properties of a supertype are accessible in a super access + if (node.left.kind === SyntaxKind.SuperKeyword) { + return; + } + // A protected property is accessible in the declaring class and classes derived from it + if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { + error(node, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + return; + } + // No further restrictions for static properties + if (flags & NodeFlags.Static) { + return; + } + // An instance property must be accessed through an instance of the enclosing class + if (!(getTargetType(type).flags & (TypeFlags.Class | TypeFlags.Interface) && hasBaseType(type, enclosingClass))) { + error(node, Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + } } function checkPropertyAccess(node: PropertyAccess) { @@ -3905,7 +4783,6 @@ module ts { } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & SymbolFlags.Class) { - // TS 1.0 spec (April 2014): 4.8.2 // - In a constructor, instance member function, instance member accessor, or // instance member variable initializer where this references a derived class instance, @@ -3914,13 +4791,10 @@ module ts { // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. if (node.left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.Method) { - error(node.right, Diagnostics.Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword); + error(node.right, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } - else if (getDeclarationFlagsFromSymbol(prop) & NodeFlags.Private) { - var classDeclaration = getAncestor(node, SyntaxKind.ClassDeclaration); - if (!classDeclaration || !contains(prop.parent.declarations, classDeclaration)) { - error(node, Diagnostics.Property_0_is_inaccessible, getFullyQualifiedName(prop)); - } + else { + checkClassPropertyAccess(node, type, prop); } } return getTypeOfSymbol(prop); @@ -3928,6 +4802,25 @@ module ts { return anyType; } + function isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean { + var type = checkExpression(node.left); + if (type !== unknownType && type !== anyType) { + var apparentType = getApparentType(getWidenedType(type)); + var prop = getPropertyOfApparentType(apparentType, propertyName); + if (prop && prop.parent && prop.parent.flags & SymbolFlags.Class) { + if (node.left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.Method) { + return false; + } + else { + var diagnosticsCount = diagnostics.length; + checkClassPropertyAccess(node, type, prop); + return diagnostics.length === diagnosticsCount + } + } + } + return true; + } + function checkIndexedAccess(node: IndexedAccess): Type { var objectType = checkExpression(node.object); var indexType = checkExpression(node.index); @@ -3999,55 +4892,33 @@ module ts { return unknownSignature; } - function isCandidateSignature(node: CallExpression, signature: Signature) { - var args = node.arguments || emptyArray; - return args.length >= signature.minArgumentCount && - (signature.hasRestParameter || args.length <= signature.parameters.length) && - (!node.typeArguments || signature.typeParameters && node.typeArguments.length === signature.typeParameters.length); - } - - // The candidate list orders groups in reverse, but within a group signatures are kept in declaration order - // A nit here is that we reorder only signatures that belong to the same symbol, - // so order how inherited signatures are processed is still preserved. - // interface A { (x: string): void } - // interface B extends A { (x: 'foo'): string } - // var b: B; - // b('foo') // <- here overloads should be processed as [(x:'foo'): string, (x: string): void] - function collectCandidates(node: CallExpression, signatures: Signature[]): Signature[]{ - var result: Signature[] = []; - var lastParent: Node; - var lastSymbol: Symbol; - var cutoffPos: number = 0; - var pos: number; - for (var i = 0; i < signatures.length; i++) { - var signature = signatures[i]; - if (isCandidateSignature(node, signature)) { - var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent = signature.declaration && signature.declaration.parent; - if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent === lastParent) { - pos++; - } - else { - lastParent = parent; - pos = cutoffPos; - } - } - else { - // current declaration belongs to a different symbol - // set cutoffPos so re-orderings in the future won't change result set from 0 to cutoffPos - pos = cutoffPos = result.length; - lastParent = parent; - } - lastSymbol = symbol; - - for (var j = result.length; j > pos; j--) { - result[j] = result[j - 1]; - } - result[pos] = signature; - } + function signatureHasCorrectArity(node: CallExpression, signature: Signature): boolean { + if (!node.arguments) { + // This only happens when we have something of the form: + // new C + // + return signature.minArgumentCount === 0; } - return result; + + // For IDE scenarios, since we may have an incomplete call, we make two modifications + // to arity checking. + // 1. A trailing comma is tantamount to adding another argument + // 2. If the call is incomplete (no closing paren) allow fewer arguments than expected + var args = node.arguments; + var numberOfArgs = args.hasTrailingComma ? args.length + 1 : args.length; + var hasTooManyArguments = !signature.hasRestParameter && numberOfArgs > signature.parameters.length; + var hasRightNumberOfTypeArguments = !node.typeArguments || + (signature.typeParameters && node.typeArguments.length === signature.typeParameters.length); + + if (hasTooManyArguments || !hasRightNumberOfTypeArguments) { + return false; + } + + // If we are missing the close paren, the call is incomplete, and we should skip + // the lower bound check. + var callIsIncomplete = args.end === node.end; + var hasEnoughArguments = numberOfArgs >= signature.minArgumentCount; + return callIsIncomplete || hasEnoughArguments; } // If type has a single call signature and no other members, return that signature. Otherwise, return undefined. @@ -4078,6 +4949,9 @@ module ts { var mapper = createInferenceMapper(context); // First infer from arguments that are not context sensitive for (var i = 0; i < args.length; i++) { + if (args[i].kind === SyntaxKind.OmittedExpression) { + continue; + } if (!excludeArgument || excludeArgument[i] === undefined) { var parameterType = getTypeAtPosition(signature, i); inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); @@ -4086,13 +4960,18 @@ module ts { // Next, infer from those context sensitive arguments that are no longer excluded if (excludeArgument) { for (var i = 0; i < args.length; i++) { + if (args[i].kind === SyntaxKind.OmittedExpression) { + continue; + } if (excludeArgument[i] === false) { var parameterType = getTypeAtPosition(signature, i); inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); } } } - return getInferredTypes(context); + var inferredTypes = getInferredTypes(context); + // Inference has failed if the undefined type is in list of inferences + return contains(inferredTypes, undefinedType) ? undefined : inferredTypes; } function checkTypeArguments(signature: Signature, typeArguments: TypeNode[]): Type[] { @@ -4114,6 +4993,9 @@ module ts { if (node.arguments) { for (var i = 0; i < node.arguments.length; i++) { var arg = node.arguments[i]; + if (arg.kind === SyntaxKind.OmittedExpression) { + continue; + } var paramType = getTypeAtPosition(signature, i); // String literals get string literal types unless we're reporting errors var argType = arg.kind === SyntaxKind.StringLiteral && !reportErrors ? @@ -4131,9 +5013,11 @@ module ts { return true; } - function resolveCall(node: CallExpression, signatures: Signature[]): Signature { + function resolveCall(node: CallExpression, signatures: Signature[], candidatesOutArray: Signature[]): Signature { forEach(node.typeArguments, checkSourceElement); - var candidates = collectCandidates(node, signatures); + var candidates = candidatesOutArray || []; + // collectCandidates fills up the candidates array directly + collectCandidates(); if (!candidates.length) { error(node, Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); return resolveErrorCall(node); @@ -4147,16 +5031,24 @@ module ts { } } var relation = candidates.length === 1 ? assignableRelation : subtypeRelation; + var lastCandidate: Signature; while (true) { for (var i = 0; i < candidates.length; i++) { + if (!signatureHasCorrectArity(node, candidates[i])) { + continue; + } while (true) { var candidate = candidates[i]; if (candidate.typeParameters) { var typeArguments = node.typeArguments ? checkTypeArguments(candidate, node.typeArguments) : inferTypeArguments(candidate, args, excludeArgument); + if (!typeArguments) { + break; + } candidate = getSignatureInstantiation(candidate, typeArguments); } + lastCandidate = candidate; if (!checkApplicableSignature(node, candidate, relation, excludeArgument, /*reportErrors*/ false)) { break; } @@ -4172,17 +5064,83 @@ module ts { } relation = assignableRelation; } + // No signatures were applicable. Now report errors based on the last applicable signature with // no arguments excluded from assignability checks. - checkApplicableSignature(node, candidate, relation, undefined, /*reportErrors*/ true); + // If candidate is undefined, it means that no candidates had a suitable arity. In that case, + // skip the checkApplicableSignature check. + if (lastCandidate) { + checkApplicableSignature(node, lastCandidate, relation, /*excludeArgument*/ undefined, /*reportErrors*/ true); + } + else { + error(node, Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + } + + // No signature was applicable. We have already reported the errors for the invalid signature. + // If this is a type resolution session, e.g. Language Service, try to get better information that anySignature. + // Pick the first candidate that matches the arity. This way we can get a contextual type for cases like: + // declare function f(a: { xa: number; xb: number; }); + // f({ | + if (!fullTypeCheck) { + for (var i = 0, n = candidates.length; i < n; i++) { + if (signatureHasCorrectArity(node, candidates[i])) { + return candidates[i]; + } + } + } + return resolveErrorCall(node); + + // The candidate list orders groups in reverse, but within a group signatures are kept in declaration order + // A nit here is that we reorder only signatures that belong to the same symbol, + // so order how inherited signatures are processed is still preserved. + // interface A { (x: string): void } + // interface B extends A { (x: 'foo'): string } + // var b: B; + // b('foo') // <- here overloads should be processed as [(x:'foo'): string, (x: string): void] + function collectCandidates(): void { + var result = candidates; + var lastParent: Node; + var lastSymbol: Symbol; + var cutoffPos: number = 0; + var pos: number; + Debug.assert(!result.length); + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + if (true) { + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent === lastParent) { + pos++; + } + else { + lastParent = parent; + pos = cutoffPos; + } + } + else { + // current declaration belongs to a different symbol + // set cutoffPos so re-orderings in the future won't change result set from 0 to cutoffPos + pos = cutoffPos = result.length; + lastParent = parent; + } + lastSymbol = symbol; + + for (var j = result.length; j > pos; j--) { + result[j] = result[j - 1]; + } + result[pos] = signature; + } + } + } } - function resolveCallExpression(node: CallExpression): Signature { + function resolveCallExpression(node: CallExpression, candidatesOutArray: Signature[]): Signature { if (node.func.kind === SyntaxKind.SuperKeyword) { var superType = checkSuperExpression(node.func); if (superType !== unknownType) { - return resolveCall(node, getSignaturesOfType(superType, SignatureKind.Construct)); + return resolveCall(node, getSignaturesOfType(superType, SignatureKind.Construct), candidatesOutArray); } return resolveUntypedCall(node); } @@ -4212,7 +5170,9 @@ module ts { // but is a subtype of the Function interface, the call is an untyped function call. In an // untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual // types are provided for the argument expressions, and the result is always of type Any. - if ((funcType === anyType) || (!callSignatures.length && !constructSignatures.length && isTypeAssignableTo(funcType, globalFunctionType))) { + // We exclude union types because we may have a union of function types that happen to have + // no common signatures. + if (funcType === anyType || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & TypeFlags.Union) && isTypeAssignableTo(funcType, globalFunctionType))) { if (node.typeArguments) { error(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); } @@ -4230,10 +5190,10 @@ module ts { } return resolveErrorCall(node); } - return resolveCall(node, callSignatures); + return resolveCall(node, callSignatures, candidatesOutArray); } - function resolveNewExpression(node: NewExpression): Signature { + function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[]): Signature { var expressionType = checkExpression(node.func); if (expressionType === unknownType) { // Another error has already been reported @@ -4268,7 +5228,7 @@ module ts { // that the user will not add any. var constructSignatures = getSignaturesOfType(expressionType, SignatureKind.Construct); if (constructSignatures.length) { - return resolveCall(node, constructSignatures); + return resolveCall(node, constructSignatures, candidatesOutArray); } // If ConstructExpr's apparent type is an object type with no construct signatures but @@ -4277,7 +5237,7 @@ module ts { // operation is Any. var callSignatures = getSignaturesOfType(expressionType, SignatureKind.Call); if (callSignatures.length) { - var signature = resolveCall(node, callSignatures); + var signature = resolveCall(node, callSignatures, candidatesOutArray); if (getReturnTypeOfSignature(signature) !== voidType) { error(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } @@ -4288,11 +5248,19 @@ module ts { return resolveErrorCall(node); } - function getResolvedSignature(node: CallExpression): Signature { + // candidatesOutArray is passed by signature help in the language service, and collectCandidates + // must fill it up with the appropriate candidate signatures + function getResolvedSignature(node: CallExpression, candidatesOutArray?: Signature[]): Signature { var links = getNodeLinks(node); - if (!links.resolvedSignature) { + // If getResolvedSignature has already been called, we will have cached the resolvedSignature. + // However, it is possible that either candidatesOutArray was not passed in the first time, + // or that a different candidatesOutArray was passed in. Therefore, we need to redo the work + // to correctly fill the candidatesOutArray. + if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - links.resolvedSignature = node.kind === SyntaxKind.CallExpression ? resolveCallExpression(node) : resolveNewExpression(node); + links.resolvedSignature = node.kind === SyntaxKind.CallExpression + ? resolveCallExpression(node, candidatesOutArray) + : resolveNewExpression(node, candidatesOutArray); } return links.resolvedSignature; } @@ -4348,11 +5316,12 @@ module ts { } function getReturnTypeFromBody(func: FunctionDeclaration, contextualMapper?: TypeMapper): Type { + var contextualSignature = getContextualSignature(func); if (func.body.kind !== SyntaxKind.FunctionBlock) { var unwidenedType = checkAndMarkExpression(func.body, contextualMapper); var widenedType = getWidenedType(unwidenedType); - if (fullTypeCheck && compilerOptions.noImplicitAny && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { + if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { error(func, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeToString(widenedType)); } @@ -4364,7 +5333,9 @@ module ts { // Try to return the best common type if we have any return expressions. if (types.length > 0) { - var commonType = getBestCommonType(types, /*contextualType:*/ undefined, /*candidatesOnly:*/ true); + // When return statements are contextually typed we allow the return type to be a union type. Otherwise we require the + // return expressions to have a best common supertype. + var commonType = contextualSignature ? getUnionType(types) : getCommonSupertype(types); if (!commonType) { error(func, Diagnostics.No_best_common_type_exists_among_return_expressions); @@ -4374,7 +5345,7 @@ module ts { var widenedType = getWidenedType(commonType); // Check and report for noImplicitAny if the best common type implicitly gets widened to an 'any'/arrays-of-'any' type. - if (fullTypeCheck && compilerOptions.noImplicitAny && widenedType !== commonType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { + if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== commonType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { var typeName = typeToString(widenedType); if (func.name) { @@ -4595,8 +5566,8 @@ module ts { return numberType; } - function isTypeAnyTypeObjectTypeOrTypeParameter(type: Type): boolean { - return type === anyType || ((type.flags & (TypeFlags.ObjectType | TypeFlags.TypeParameter)) !== 0); + function isTypeAnyOrObjectOrTypeParameter(type: Type): boolean { + return (type.flags & (TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) !== 0; } function checkInstanceOfExpression(node: BinaryExpression, leftType: Type, rightType: Type): Type { @@ -4604,10 +5575,12 @@ module ts { // The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type, // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. - if (!isTypeAnyTypeObjectTypeOrTypeParameter(leftType)) { + // NOTE: do not raise error if leftType is unknown as related error was already reported + if (leftType !== unknownType && !isTypeAnyOrObjectOrTypeParameter(leftType)) { error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } - if (rightType !== anyType && !isTypeSubtypeOf(rightType, globalFunctionType)) { + // NOTE: do not raise error if right is unknown as related error was already reported + if (rightType !== unknownType && rightType !== anyType && !isTypeSubtypeOf(rightType, globalFunctionType)) { error(node.right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -4621,7 +5594,7 @@ module ts { if (leftType !== anyType && leftType !== stringType && leftType !== numberType) { error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); } - if (!isTypeAnyTypeObjectTypeOrTypeParameter(rightType)) { + if (!isTypeAnyOrObjectOrTypeParameter(rightType)) { error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -4661,10 +5634,21 @@ module ts { if (leftType.flags & (TypeFlags.Undefined | TypeFlags.Null)) leftType = rightType; if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; - var leftOk = checkArithmeticOperandType(node.left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); - var rightOk = checkArithmeticOperandType(node.right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); - if (leftOk && rightOk) { - checkAssignmentOperator(numberType); + var suggestedOperator: SyntaxKind; + // if a user tries to apply a bitwise operator to 2 boolean operands + // try and return them a helpful suggestion + if ((leftType.flags & TypeFlags.Boolean) && + (rightType.flags & TypeFlags.Boolean) && + (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) { + error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operator), tokenToString(suggestedOperator)); + } + else { + // otherwise just check each operand separately and report errors as normal + var leftOk = checkArithmeticOperandType(node.left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var rightOk = checkArithmeticOperandType(node.right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + if (leftOk && rightOk) { + checkAssignmentOperator(numberType); + } } return numberType; @@ -4722,13 +5706,29 @@ module ts { case SyntaxKind.AmpersandAmpersandToken: return rightType; case SyntaxKind.BarBarToken: - return getBestCommonType([leftType, rightType], isInferentialContext(contextualMapper) ? undefined : getContextualType(node)); + return getUnionType([leftType, rightType]); case SyntaxKind.EqualsToken: checkAssignmentOperator(rightType); return rightType; case SyntaxKind.CommaToken: return rightType; } + + function getSuggestedBooleanOperator(operator: SyntaxKind): SyntaxKind { + switch (operator) { + case SyntaxKind.BarToken: + case SyntaxKind.BarEqualsToken: + return SyntaxKind.BarBarToken; + case SyntaxKind.CaretToken: + case SyntaxKind.CaretEqualsToken: + return SyntaxKind.ExclamationEqualsEqualsToken; + case SyntaxKind.AmpersandToken: + case SyntaxKind.AmpersandEqualsToken: + return SyntaxKind.AmpersandAmpersandToken; + default: + return undefined; + } + } function checkAssignmentOperator(valueType: Type): void { if (fullTypeCheck && operator >= SyntaxKind.FirstAssignment && operator <= SyntaxKind.LastAssignment) { @@ -4756,18 +5756,7 @@ module ts { checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - var contextualType = isInferentialContext(contextualMapper) ? undefined : getContextualType(node); - var resultType = getBestCommonType([type1, type2], contextualType, true); - if (!resultType) { - if (contextualType) { - error(node, Diagnostics.No_best_common_type_exists_between_0_1_and_2, typeToString(contextualType), typeToString(type1), typeToString(type2)); - } - else { - error(node, Diagnostics.No_best_common_type_exists_between_0_and_1, typeToString(type1), typeToString(type2)); - } - resultType = emptyObjectType; - } - return resultType; + return getUnionType([type1, type2]); } function checkExpressionWithContextualType(node: Expression, contextualType: Type, contextualMapper?: TypeMapper): Type { @@ -4855,6 +5844,8 @@ module ts { return checkBinaryExpression(node, contextualMapper); case SyntaxKind.ConditionalExpression: return checkConditionalExpression(node, contextualMapper); + case SyntaxKind.OmittedExpression: + return undefinedType; } return unknownType; } @@ -4876,7 +5867,8 @@ module ts { if (fullTypeCheck) { checkCollisionWithIndexVariableInGeneratedCode(parameterDeclaration, parameterDeclaration.name); - if (parameterDeclaration.flags & (NodeFlags.Public | NodeFlags.Private) && !(parameterDeclaration.parent.kind === SyntaxKind.Constructor && (parameterDeclaration.parent).body)) { + if (parameterDeclaration.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected) && + !(parameterDeclaration.parent.kind === SyntaxKind.Constructor && (parameterDeclaration.parent).body)) { error(parameterDeclaration, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } if (parameterDeclaration.flags & NodeFlags.Rest) { @@ -4934,7 +5926,7 @@ module ts { if (fullTypeCheck) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); - checkCollistionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { @@ -5069,7 +6061,7 @@ module ts { // or the containing class declares instance member variables with initializers. var superCallShouldBeFirst = forEach((node.parent).members, isInstancePropertyWithInitializer) || - forEach(node.parameters, p => p.flags & (NodeFlags.Public | NodeFlags.Private)); + forEach(node.parameters, p => p.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected)); if (superCallShouldBeFirst) { var statements = (node.body).statements; @@ -5101,8 +6093,7 @@ module ts { var otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor; var otherAccessor = getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - var visibilityFlags = NodeFlags.Private | NodeFlags.Public; - if (((node.flags & visibilityFlags) !== (otherAccessor.flags & visibilityFlags))) { + if (((node.flags & NodeFlags.AccessibilityModifier) !== (otherAccessor.flags & NodeFlags.AccessibilityModifier))) { error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } @@ -5152,7 +6143,15 @@ module ts { } function checkArrayType(node: ArrayTypeNode) { - getTypeFromArrayTypeNode(node); + checkSourceElement(node.elementType); + } + + function checkTupleType(node: TupleTypeNode) { + forEach(node.elementTypes, checkSourceElement); + } + + function checkUnionType(node: UnionTypeNode) { + forEach(node.types, checkSourceElement); } function isPrivateWithinAmbient(node: Node): boolean { @@ -5243,8 +6242,8 @@ module ts { else if (deviation & NodeFlags.Ambient) { error(o.name, Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & NodeFlags.Private) { - error(o.name, Diagnostics.Overload_signatures_must_all_be_public_or_private); + else if (deviation & (NodeFlags.Private | NodeFlags.Protected)) { + error(o.name, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } else if (deviation & NodeFlags.QuestionMark) { error(o.name, Diagnostics.Overload_signatures_must_all_be_optional_or_required); @@ -5253,7 +6252,7 @@ module ts { } } - var flagsToCheck: NodeFlags = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Private | NodeFlags.QuestionMark; + var flagsToCheck: NodeFlags = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Private | NodeFlags.Protected | NodeFlags.QuestionMark; var someNodeFlags: NodeFlags = 0; var allNodeFlags = flagsToCheck; var hasOverloads = false; @@ -5265,6 +6264,10 @@ module ts { var isConstructor = (symbol.flags & SymbolFlags.Constructor) !== 0; function reportImplementationExpectedError(node: FunctionDeclaration): void { + if (node.name && node.name.kind === SyntaxKind.Missing) { + return; + } + var seen = false; var subsequentNode = forEachChild(node.parent, c => { if (seen) { @@ -5303,6 +6306,8 @@ module ts { // when checking exported function declarations across modules check only duplicate implementations // names and consistency of modifiers are verified when we check local symbol var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & SymbolFlags.Module; + var duplicateFunctionDeclaration = false; + var multipleConstructorImplementation = false; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = isInAmbientContext(node); @@ -5325,10 +6330,10 @@ module ts { if (node.body && bodyDeclaration) { if (isConstructor) { - error(node, Diagnostics.Multiple_constructor_implementations_are_not_allowed); + multipleConstructorImplementation = true; } else { - error(node, Diagnostics.Duplicate_function_implementation); + duplicateFunctionDeclaration = true; } } else if (!isExportSymbolInsideModule && previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) { @@ -5352,6 +6357,18 @@ module ts { } } + if (multipleConstructorImplementation) { + forEach(declarations, declaration => { + error(declaration, Diagnostics.Multiple_constructor_implementations_are_not_allowed); + }); + } + + if (duplicateFunctionDeclaration) { + forEach( declarations, declaration => { + error(declaration.name, Diagnostics.Duplicate_function_implementation); + }); + } + if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } @@ -5677,7 +6694,7 @@ module ts { } } - function checkCollistionWithRequireExportsInGeneratedCode(node: Node, name: Identifier) { + function checkCollisionWithRequireExportsInGeneratedCode(node: Node, name: Identifier) { if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } @@ -5722,7 +6739,7 @@ module ts { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); - checkCollistionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); if (!useTypeFromValueDeclaration) { // TypeScript 1.0 spec (April 2014): 5.1 // Multiple declarations for the same variable name in the same declaration space are permitted, @@ -5798,7 +6815,7 @@ module ts { var exprType = checkExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeAnyTypeObjectTypeOrTypeParameter(exprType) && exprType !== unknownType) { + if (!isTypeAnyOrObjectOrTypeParameter(exprType) && exprType !== unknownType) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } @@ -5863,7 +6880,7 @@ module ts { }); } - function checkLabelledStatement(node: LabelledStatement) { + function checkLabeledStatement(node: LabeledStatement) { checkSourceElement(node.statement); } @@ -5981,7 +6998,7 @@ module ts { checkTypeNameIsReserved(node.name, Diagnostics.Class_name_cannot_be_0); checkTypeParameters(node.typeParameters); checkCollisionWithCapturedThisVariable(node, node.name); - checkCollistionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); @@ -6033,7 +7050,7 @@ module ts { } function getTargetSymbol(s: Symbol) { - // if symbol is instantiated it's flags are not copied from the 'target' + // if symbol is instantiated its flags are not copied from the 'target' // so we'll need to get back original 'target' symbol to work with correct set of flags return s.flags & SymbolFlags.Instantiated ? getSymbolLinks(s).target : s; } @@ -6174,7 +7191,7 @@ module ts { } } - function getConstantValue(node: Expression): number { + function getConstantValueForExpression(node: Expression): number { var isNegative = false; if (node.kind === SyntaxKind.PrefixOperator) { var unaryExpression = node; @@ -6191,38 +7208,54 @@ module ts { return undefined; } + function computeEnumMemberValues(node: EnumDeclaration) { + var nodeLinks = getNodeLinks(node); + + if (!(nodeLinks.flags & NodeCheckFlags.EnumValuesComputed)) { + var enumSymbol = getSymbolOfNode(node); + var enumType = getDeclaredTypeOfSymbol(enumSymbol); + var autoValue = 0; + var ambient = isInAmbientContext(node); + + forEach(node.members, member => { + if(isNumericName(member.name.text)) { + error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } + var initializer = member.initializer; + if (initializer) { + autoValue = getConstantValueForExpression(initializer); + if (autoValue === undefined && !ambient) { + // Only here do we need to check that the initializer is assignable to the enum type. + // If it is a constant value (not undefined), it is syntactically constrained to be a number. + // Also, we do not need to check this for ambients because there is already + // a syntax error if it is not a constant. + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined); + } + } + else if (ambient) { + autoValue = undefined; + } + + if (autoValue !== undefined) { + getNodeLinks(member).enumMemberValue = autoValue++; + } + }); + + nodeLinks.flags |= NodeCheckFlags.EnumValuesComputed; + } + } + function checkEnumDeclaration(node: EnumDeclaration) { if (!fullTypeCheck) { return; } + checkTypeNameIsReserved(node.name, Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); - checkCollistionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); - var enumSymbol = getSymbolOfNode(node); - var enumType = getDeclaredTypeOfSymbol(enumSymbol); - var autoValue = 0; - var ambient = isInAmbientContext(node); - forEach(node.members, member => { - var initializer = member.initializer; - if (initializer) { - autoValue = getConstantValue(initializer); - if (autoValue === undefined && !ambient) { - // Only here do we need to check that the initializer is assignable to the enum type. - // If it is a constant value (not undefined), it is syntactically constrained to be a number. - // Also, we do not need to check this for ambients because there is already - // a syntax error if it is not a constant. - checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined); - } - } - else if (ambient) { - autoValue = undefined; - } - if (autoValue !== undefined) { - getNodeLinks(member).enumMemberValue = autoValue++; - } - }); + computeEnumMemberValues(node); // Spec 2014 - Section 9.3: // It isn't possible for one enum declaration to continue the automatic numbering sequence of another, @@ -6230,6 +7263,7 @@ module ts { // for the first member. // // Only perform this check once per symbol + var enumSymbol = getSymbolOfNode(node); var firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { var seenEnumMissingInitialInitializer = false; @@ -6271,7 +7305,7 @@ module ts { function checkModuleDeclaration(node: ModuleDeclaration) { if (fullTypeCheck) { checkCollisionWithCapturedThisVariable(node, node.name); - checkCollistionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); if (symbol.flags & SymbolFlags.ValueModule && symbol.declarations.length > 1 && !isInAmbientContext(node)) { @@ -6306,7 +7340,7 @@ module ts { function checkImportDeclaration(node: ImportDeclaration) { checkCollisionWithCapturedThisVariable(node, node.name); - checkCollistionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); var symbol = getSymbolOfNode(node); var target: Symbol; @@ -6401,6 +7435,10 @@ module ts { return checkTypeLiteral(node); case SyntaxKind.ArrayType: return checkArrayType(node); + case SyntaxKind.TupleType: + return checkTupleType(node); + case SyntaxKind.UnionType: + return checkUnionType(node); case SyntaxKind.FunctionDeclaration: return checkFunctionDeclaration(node); case SyntaxKind.Block: @@ -6431,8 +7469,8 @@ module ts { return checkWithStatement(node); case SyntaxKind.SwitchStatement: return checkSwitchStatement(node); - case SyntaxKind.LabelledStatement: - return checkLabelledStatement(node); + case SyntaxKind.LabeledStatement: + return checkLabeledStatement(node); case SyntaxKind.ThrowStatement: return checkThrowStatement(node); case SyntaxKind.TryStatement: @@ -6511,7 +7549,7 @@ module ts { case SyntaxKind.SwitchStatement: case SyntaxKind.CaseClause: case SyntaxKind.DefaultClause: - case SyntaxKind.LabelledStatement: + case SyntaxKind.LabeledStatement: case SyntaxKind.ThrowStatement: case SyntaxKind.TryStatement: case SyntaxKind.TryBlock: @@ -6587,7 +7625,7 @@ module ts { // Language service support function getNodeAtPosition(sourceFile: SourceFile, position: number): Node { - function findChildAtPosition(parent: Node) { + function findChildAtPosition(parent: Node): Node { var child = forEachChild(parent, node => { if (position >= node.pos && position <= node.end && position >= getTokenPosOfNode(node)) { return findChildAtPosition(node); @@ -6600,7 +7638,20 @@ module ts { return findChildAtPosition(sourceFile); } - function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[] { + function isInsideWithStatementBody(node: Node): boolean { + if (node) { + while (node.parent) { + if (node.parent.kind === SyntaxKind.WithStatement && (node.parent).statement === node) { + return true; + } + node = node.parent; + } + } + + return false; + } + + function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]{ var symbols: SymbolTable = {}; var memberFlags: NodeFlags = 0; function copySymbol(symbol: Symbol, meaning: SymbolFlags) { @@ -6620,6 +7671,12 @@ module ts { } } } + + if (isInsideWithStatementBody(location)) { + // We cannot answer semantic questions within a with block, do not proceed any further + return []; + } + while (location) { if (location.locals && !isGlobalSourceFile(location)) { copySymbols(location.locals, meaning); @@ -6657,7 +7714,6 @@ module ts { return mapToArray(symbols); } - // True if the given identifier is the name of a type declaration node (class, interface, enum, type parameter, etc) function isTypeDeclarationName(name: Node): boolean { return name.kind == SyntaxKind.Identifier && isTypeDeclaration(name.parent) && @@ -6753,7 +7809,7 @@ module ts { } function isTypeNode(node: Node): boolean { - if (node.kind >= SyntaxKind.FirstTypeNode && node.kind <= SyntaxKind.LastTypeNode) { + if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) { return true; } @@ -6768,6 +7824,7 @@ module ts { case SyntaxKind.StringLiteral: // Specialized signatures can have string literals as their parameters' type names return node.parent.kind === SyntaxKind.Parameter; + // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case SyntaxKind.Identifier: @@ -6775,9 +7832,11 @@ module ts { if (node.parent.kind === SyntaxKind.QualifiedName) { node = node.parent; } - // Fall through + // fall through case SyntaxKind.QualifiedName: // At this point, node is either a qualified name or an identifier + Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + var parent = node.parent; if (parent.kind === SyntaxKind.TypeQuery) { return false; @@ -6788,7 +7847,7 @@ module ts { // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (parent.kind >= SyntaxKind.FirstTypeNode && parent.kind <= SyntaxKind.LastTypeNode) { + if (SyntaxKind.FirstTypeNode <= parent.kind && parent.kind <= SyntaxKind.LastTypeNode) { return true; } switch (parent.kind) { @@ -6814,7 +7873,7 @@ module ts { return node === (parent).type; case SyntaxKind.CallExpression: case SyntaxKind.NewExpression: - return (parent).typeArguments.indexOf(node) >= 0; + return (parent).typeArguments && (parent).typeArguments.indexOf(node) >= 0; } } @@ -6892,6 +7951,11 @@ module ts { } function getSymbolInfo(node: Node) { + if (isInsideWithStatementBody(node)) { + // We cannot answer semantic questions within a with block, do not proceed any further + return undefined; + } + if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); @@ -6946,9 +8010,15 @@ module ts { } function getTypeOfNode(node: Node): Type { + if (isInsideWithStatementBody(node)) { + // We cannot answer semantic questions within a with block, do not proceed any further + return unknownType; + } + if (isExpression(node)) { return getTypeOfExpression(node); } + if (isTypeNode(node)) { return getTypeFromTypeNode(node); } @@ -6961,7 +8031,7 @@ module ts { if (isTypeDeclarationName(node)) { var symbol = getSymbolInfo(node); - return getDeclaredTypeOfSymbol(symbol); + return symbol && getDeclaredTypeOfSymbol(symbol); } if (isDeclaration(node)) { @@ -6972,12 +8042,12 @@ module ts { if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { var symbol = getSymbolInfo(node); - return getTypeOfSymbol(symbol); + return symbol && getTypeOfSymbol(symbol); } if (isInRightSideOfImportOrExportAssignment(node)) { var symbol = getSymbolInfo(node); - var declaredType = getDeclaredTypeOfSymbol(symbol); + var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); } @@ -7028,8 +8098,26 @@ module ts { } } - function getRootSymbol(symbol: Symbol) { - return (symbol.flags & SymbolFlags.Transient) ? getSymbolLinks(symbol).target : symbol; + function getRootSymbol(symbol: Symbol): Symbol { + return symbol.flags & SymbolFlags.Transient && getSymbolLinks(symbol).target || symbol; + } + + function getRootSymbols(symbol: Symbol): Symbol[] { + if (symbol.flags & SymbolFlags.UnionProperty) { + var symbols: Symbol[] = []; + var name = symbol.name; + forEach(getSymbolLinks(symbol).unionType.types, t => { + symbols.push(getPropertyOfType(getApparentType(t), name)); + }); + return symbols; + } + else if (symbol.flags & SymbolFlags.Transient) { + var target = getSymbolLinks(symbol).target; + if (target) { + return [target]; + } + } + return [symbol]; } // Emitter support @@ -7063,7 +8151,7 @@ module ts { while (!isUniqueLocalName(escapeIdentifier(prefix + name), container)) { prefix += "_"; } - links.localModuleName = prefix + getSourceTextOfNode(container.name); + links.localModuleName = prefix + getTextOfNode(container.name); } return links.localModuleName; } @@ -7097,17 +8185,6 @@ module ts { } } - function getPropertyAccessSubstitution(node: PropertyAccess): string { - var symbol = getNodeLinks(node).resolvedSymbol; - if (symbol && (symbol.flags & SymbolFlags.EnumMember)) { - var declaration = symbol.valueDeclaration; - var constantValue: number; - if (declaration.kind === SyntaxKind.EnumMember && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { - return constantValue.toString() + " /* " + identifierToString(declaration.name) + " */"; - } - } - } - function getExportAssignmentName(node: SourceFile): string { var symbol = getExportAssignmentSymbol(getSymbolOfNode(node)); return symbol && symbolIsValue(symbol) ? symbolToString(symbol): undefined; @@ -7123,12 +8200,9 @@ module ts { return target !== unknownSymbol && ((target.flags & SymbolFlags.Value) !== 0); } - function shouldEmitDeclarations() { - // If the declaration emit and there are no errors being reported in program or by checker - // declarations can be emitted - return compilerOptions.declaration && - !program.getDiagnostics().length && - !getDiagnostics().length; + function hasSemanticErrors() { + // Return true if there is any semantic error in a file or globally + return getDiagnostics().length > 0 || getGlobalDiagnostics().length > 0; } function isReferencedImportDeclaration(node: ImportDeclaration): boolean { @@ -7173,44 +8247,57 @@ module ts { } function getEnumMemberValue(node: EnumMember): number { + computeEnumMemberValues(node.parent); return getNodeLinks(node).enumMemberValue; } - function writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter) { + function getConstantValue(node: PropertyAccess): number { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol && (symbol.flags & SymbolFlags.EnumMember)) { + var declaration = symbol.valueDeclaration; + var constantValue: number; + if (declaration.kind === SyntaxKind.EnumMember && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { + return constantValue; + } + } + + return undefined; + } + + function writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(location); var type = symbol && !(symbol.flags & SymbolFlags.TypeLiteral) ? getTypeOfSymbol(symbol) : getTypeFromTypeNode(location); - writeTypeToTextWriter(type, enclosingDeclaration, flags, writer); + writeType(type, writer, enclosingDeclaration, flags); } - function writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter) { + function writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { var signature = getSignatureFromDeclaration(signatureDeclaration); - writeTypeToTextWriter(getReturnTypeOfSignature(signature), enclosingDeclaration, flags , writer); + writeType(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } - function invokeEmitter() { + function invokeEmitter(targetSourceFile?: SourceFile) { var resolver: EmitResolver = { getProgram: () => program, getLocalNameOfContainer: getLocalNameOfContainer, getExpressionNamePrefix: getExpressionNamePrefix, - getPropertyAccessSubstitution: getPropertyAccessSubstitution, getExportAssignmentName: getExportAssignmentName, isReferencedImportDeclaration: isReferencedImportDeclaration, getNodeCheckFlags: getNodeCheckFlags, getEnumMemberValue: getEnumMemberValue, isTopLevelValueImportedViaEntityName: isTopLevelValueImportedViaEntityName, - shouldEmitDeclarations: shouldEmitDeclarations, + hasSemanticErrors: hasSemanticErrors, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, writeTypeAtLocation: writeTypeAtLocation, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, - writeSymbol: writeSymbolToTextWriter, isSymbolAccessible: isSymbolAccessible, - isImportDeclarationEntityNameReferenceDeclarationVisibile: isImportDeclarationEntityNameReferenceDeclarationVisibile + isImportDeclarationEntityNameReferenceDeclarationVisibile: isImportDeclarationEntityNameReferenceDeclarationVisibile, + getConstantValue: getConstantValue, }; checkProgram(); - return emitFiles(resolver); + return emitFiles(resolver, targetSourceFile); } function initializeTypeChecker() { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index c549231eacc..ee7f4701d19 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -11,7 +11,9 @@ module ts { var result: U; if (array) { for (var i = 0, len = array.length; i < len; i++) { - if (result = callback(array[i])) break; + if (result = callback(array[i])) { + break; + } } } return result; @@ -19,8 +21,7 @@ module ts { export function contains(array: T[], value: T): boolean { if (array) { - var len = array.length; - for (var i = 0; i < len; i++) { + for (var i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return true; } @@ -31,8 +32,7 @@ module ts { export function indexOf(array: T[], value: T): number { if (array) { - var len = array.length; - for (var i = 0; i < len; i++) { + for (var i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return i; } @@ -41,10 +41,21 @@ module ts { return -1; } - export function filter(array: T[], f: (x: T) => boolean): T[] { - var result: T[]; + export function countWhere(array: T[], predicate: (x: T) => boolean): number { + var count = 0; if (array) { - result = []; + for (var i = 0, len = array.length; i < len; i++) { + if (predicate(array[i])) { + count++; + } + } + } + return count; + } + + export function filter(array: T[], f: (x: T) => boolean): T[] { + if (array) { + var result: T[] = []; for (var i = 0, len = array.length; i < len; i++) { var item = array[i]; if (f(item)) { @@ -56,11 +67,9 @@ module ts { } export function map(array: T[], f: (x: T) => U): U[] { - var result: U[]; if (array) { - result = []; - var len = array.length; - for (var i = 0; i < len; i++) { + var result: U[] = []; + for (var i = 0, len = array.length; i < len; i++) { result.push(f(array[i])); } } @@ -73,6 +82,17 @@ module ts { return array1.concat(array2); } + export function deduplicate(array: T[]): T[] { + if (array) { + var result: T[] = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (!contains(result, item)) result.push(item); + } + } + return result; + } + export function sum(array: any[], prop: string): number { var result = 0; for (var i = 0; i < array.length; i++) { @@ -189,11 +209,9 @@ module ts { export var localizedDiagnosticMessages: Map = undefined; export function getLocaleSpecificMessage(message: string) { - if (ts.localizedDiagnosticMessages) { - message = localizedDiagnosticMessages[message]; - } - - return message; + return localizedDiagnosticMessages && localizedDiagnosticMessages[message] + ? localizedDiagnosticMessages[message] + : message; } export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic; @@ -401,7 +419,7 @@ module ts { return normalizedPathComponents(path, rootLength); } - export function getNormalizedPathFromPathCompoments(pathComponents: string[]) { + export function getNormalizedPathFromPathComponents(pathComponents: string[]) { if (pathComponents && pathComponents.length) { return pathComponents[0] + pathComponents.slice(1).join(directorySeparator); } @@ -458,18 +476,18 @@ module ts { } } - export function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, isAbsolutePathAnUrl: boolean) { + export function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean) { var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") { - // If the directory path given was of type test/cases/ then we really need components of directry to be only till its name + // If the directory path given was of type test/cases/ then we really need components of directory to be only till its name // that is ["test", "cases", ""] needs to be actually ["test", "cases"] directoryComponents.length--; } // Find the component that differs for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { - if (directoryComponents[joinStartIndex] !== pathComponents[joinStartIndex]) { + if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { break; } } @@ -488,7 +506,7 @@ module ts { } // Cant find the relative path, get the absolute path - var absolutePath = getNormalizedPathFromPathCompoments(pathComponents); + var absolutePath = getNormalizedPathFromPathComponents(pathComponents); if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) { absolutePath = "file:///" + absolutePath; } @@ -515,6 +533,43 @@ module ts { return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } + var supportedExtensions = [".d.ts", ".ts", ".js"]; + + export function removeFileExtension(path: string): string { + for (var i = 0; i < supportedExtensions.length; i++) { + var ext = supportedExtensions[i]; + + if (fileExtensionIs(path, ext)) { + return path.substr(0, path.length - ext.length); + } + } + + return path; + } + + var escapedCharsRegExp = /[\t\v\f\b\0\r\n\"\\\u2028\u2029\u0085]/g; + var escapedCharsMap: Map = { + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\0": "\\0", + "\r": "\\r", + "\n": "\\n", + "\"": "\\\"", + "\u2028": "\\u2028", // lineSeparator + "\u2029": "\\u2029", // paragraphSeparator + "\u0085": "\\u0085" // nextLine + }; + + /** NOTE: This *does not* support the full escape characters, it only supports the subset that can be used in file names + * or string literals. If the information encoded in the map changes, this needs to be revisited. */ + export function escapeString(s: string): string { + return escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, c => { + return escapedCharsMap[c] || c; + }) : s; + } + export interface ObjectAllocator { getNodeConstructor(kind: SyntaxKind): new () => Node; getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol; diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index aa1b793f6ac..ac2a79c603d 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -5,6 +5,7 @@ module ts { Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." }, Identifier_expected: { code: 1003, category: DiagnosticCategory.Error, key: "Identifier expected." }, _0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: DiagnosticCategory.Error, key: "A file cannot have a reference to itself." }, Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." }, Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." }, Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." }, @@ -84,6 +85,7 @@ module ts { An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name." }, An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers." }, Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty." }, Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty." }, Digit_expected: { code: 1124, category: DiagnosticCategory.Error, key: "Digit expected." }, Hexadecimal_digit_expected: { code: 1125, category: DiagnosticCategory.Error, key: "Hexadecimal digit expected." }, @@ -112,6 +114,7 @@ module ts { Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." }, Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "Filename '{0}' differs from already included filename '{1}' only in casing" }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + An_enum_member_cannot_have_a_numeric_name: { code: 1151, category: DiagnosticCategory.Error, key: "An enum member cannot have a numeric name." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -137,9 +140,9 @@ module ts { Type_0_is_not_assignable_to_type_1_Colon: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}':" }, Type_0_is_not_assignable_to_type_1: { code: 2323, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." }, Property_0_is_missing_in_type_1: { code: 2324, category: DiagnosticCategory.Error, key: "Property '{0}' is missing in type '{1}'." }, - Private_property_0_cannot_be_reimplemented: { code: 2325, category: DiagnosticCategory.Error, key: "Private property '{0}' cannot be reimplemented." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: DiagnosticCategory.Error, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, Types_of_property_0_are_incompatible_Colon: { code: 2326, category: DiagnosticCategory.Error, key: "Types of property '{0}' are incompatible:" }, - Required_property_0_cannot_be_reimplemented_with_optional_property_in_1: { code: 2327, category: DiagnosticCategory.Error, key: "Required property '{0}' cannot be reimplemented with optional property in '{1}'." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: DiagnosticCategory.Error, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, Types_of_parameters_0_and_1_are_incompatible_Colon: { code: 2328, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible:" }, Index_signature_is_missing_in_type_0: { code: 2329, category: DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." }, Index_signatures_are_incompatible_Colon: { code: 2330, category: DiagnosticCategory.Error, key: "Index signatures are incompatible:" }, @@ -152,8 +155,8 @@ module ts { Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: DiagnosticCategory.Error, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: DiagnosticCategory.Error, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_inaccessible: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is inaccessible." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, Type_0_does_not_satisfy_the_constraint_1_Colon: { code: 2343, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}':" }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, @@ -178,8 +181,6 @@ module ts { The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: DiagnosticCategory.Error, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: DiagnosticCategory.Error, key: "Invalid left-hand side of assignment expression." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: DiagnosticCategory.Error, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - No_best_common_type_exists_between_0_1_and_2: { code: 2366, category: DiagnosticCategory.Error, key: "No best common type exists between '{0}', '{1}', and '{2}'." }, - No_best_common_type_exists_between_0_and_1: { code: 2367, category: DiagnosticCategory.Error, key: "No best common type exists between '{0}' and '{1}'." }, Type_parameter_name_cannot_be_0: { code: 2368, category: DiagnosticCategory.Error, key: "Type parameter name cannot be '{0}'" }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: DiagnosticCategory.Error, key: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: DiagnosticCategory.Error, key: "A rest parameter must be of an array type." }, @@ -197,7 +198,7 @@ module ts { Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: DiagnosticCategory.Error, key: "Specialized overload signature is not assignable to any non-specialized signature." }, Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: DiagnosticCategory.Error, key: "Overload signatures must all be exported or not exported." }, Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: DiagnosticCategory.Error, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_or_private: { code: 2385, category: DiagnosticCategory.Error, key: "Overload signatures must all be public or private." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: DiagnosticCategory.Error, key: "Overload signatures must all be public, private or protected." }, Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: DiagnosticCategory.Error, key: "Overload signatures must all be optional or required." }, Function_overload_must_be_static: { code: 2387, category: DiagnosticCategory.Error, key: "Function overload must be static." }, Function_overload_must_not_be_static: { code: 2388, category: DiagnosticCategory.Error, key: "Function overload must not be static." }, @@ -254,6 +255,12 @@ module ts { Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local declaration of '{0}'" }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: DiagnosticCategory.Error, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: DiagnosticCategory.Error, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: DiagnosticCategory.Error, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: DiagnosticCategory.Error, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, @@ -390,6 +397,10 @@ module ts { Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index eef8da8c857..d8895d15144 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -11,6 +11,10 @@ "category": "Error", "code": 1005 }, + "A file cannot have a reference to itself.": { + "category": "Error", + "code": 1006 + }, "Trailing comma not allowed.": { "category": "Error", "code": 1009 @@ -183,7 +187,7 @@ "category": "Error", "code": 1066 }, - "Unexpected token. A constructor, method, accessor, or property was expected." : { + "Unexpected token. A constructor, method, accessor, or property was expected.": { "category": "Error", "code": 1068 }, @@ -327,6 +331,10 @@ "category": "Error", "code": 1121 }, + "A tuple type element list cannot be empty.": { + "category": "Error", + "code": 1122 + }, "Variable declaration list cannot be empty.": { "category": "Error", "code": 1123 @@ -436,9 +444,13 @@ "code": 1149 }, "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": { - "category": "Error", - "code": 1150 - }, + "category": "Error", + "code": 1150 + }, + "An enum member cannot have a numeric name.": { + "category": "Error", + "code": 1151 + }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -540,7 +552,7 @@ "category": "Error", "code": 2324 }, - "Private property '{0}' cannot be reimplemented.": { + "Property '{0}' is private in type '{1}' but not in type '{2}'.": { "category": "Error", "code": 2325 }, @@ -548,7 +560,7 @@ "category": "Error", "code": 2326 }, - "Required property '{0}' cannot be reimplemented with optional property in '{1}'.": { + "Property '{0}' is optional in type '{1}' but required in type '{2}'.": { "category": "Error", "code": 2327 }, @@ -600,11 +612,11 @@ "category": "Error", "code": 2339 }, - "Only public methods of the base class are accessible via the 'super' keyword": { + "Only public and protected methods of the base class are accessible via the 'super' keyword": { "category": "Error", "code": 2340 }, - "Property '{0}' is inaccessible.": { + "Property '{0}' is private and only accessible within class '{1}'.": { "category": "Error", "code": 2341 }, @@ -704,14 +716,6 @@ "category": "Error", "code": 2365 }, - "No best common type exists between '{0}', '{1}', and '{2}'.": { - "category": "Error", - "code": 2366 - }, - "No best common type exists between '{0}' and '{1}'.": { - "category": "Error", - "code": 2367 - }, "Type parameter name cannot be '{0}'": { "category": "Error", "code": 2368 @@ -780,7 +784,7 @@ "category": "Error", "code": 2384 }, - "Overload signatures must all be public or private.": { + "Overload signatures must all be public, private or protected.": { "category": "Error", "code": 2385 }, @@ -1008,7 +1012,30 @@ "category": "Error", "code": 2441 }, - + "Types have separate declarations of a private property '{0}'.": { + "category": "Error", + "code": 2442 + }, + "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'.": { + "category": "Error", + "code": 2443 + }, + "Property '{0}' is protected in type '{1}' but public in type '{2}'.": { + "category": "Error", + "code": 2444 + }, + "Property '{0}' is protected and only accessible within class '{1}' and its subclasses.": { + "category": "Error", + "code": 2445 + }, + "Property '{0}' is protected and only accessible through an instance of class '{1}'.": { + "category": "Error", + "code": 2446 + }, + "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead.": { + "category": "Error", + "code": 2447 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -1332,6 +1359,7 @@ "category": "Error", "code": 5001 }, + "Cannot find the common subdirectory path for the input files.": { "category": "Error", "code": 5009 @@ -1557,6 +1585,22 @@ "category": "Error", "code": 7020 }, + "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.": { + "category": "Error", + "code": 7021 + }, + "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.": { + "category": "Error", + "code": 7022 + }, + "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.": { + "category": "Error", + "code": 7023 + }, + "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.": { + "category": "Error", + "code": 7024 + }, "You cannot rename this element.": { "category": "Error", "code": 8000 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 6b18ad4c133..c038cf39868 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4,7 +4,9 @@ /// module ts { - interface EmitTextWriter extends TextWriter { + interface EmitTextWriter extends SymbolWriter { + write(s: string): void; + getText(): string; rawWrite(s: string): void; writeLiteral(s: string): void; getTextPos(): number; @@ -14,7 +16,7 @@ module ts { } var indentStrings: string[] = ["", " "]; - function getIndentString(level: number) { + export function getIndentString(level: number) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; } @@ -25,7 +27,22 @@ module ts { return indentStrings[1].length; } - export function emitFiles(resolver: EmitResolver): EmitResult { + export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean { + if (!isDeclarationFile(sourceFile)) { + if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.filename, ".js")) { + return true; + } + return false; + } + return false; + } + + export function isExternalModuleOrDeclarationFile(sourceFile: SourceFile) { + return isExternalModule(sourceFile) || isDeclarationFile(sourceFile); + } + + // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compilerOnSave feature + export function emitFiles(resolver: EmitResolver, targetSourceFile?: SourceFile): EmitResult { var program = resolver.getProgram(); var compilerHost = program.getCompilerHost(); var compilerOptions = program.getCompilerOptions(); @@ -34,34 +51,22 @@ module ts { var newLine = program.getCompilerHost().getNewLine(); function getSourceFilePathInNewDir(newDirPath: string, sourceFile: SourceFile) { - var sourceFilePath = getNormalizedPathFromPathCompoments(getNormalizedPathComponents(sourceFile.filename, compilerHost.getCurrentDirectory())); + var sourceFilePath = getNormalizedPathFromPathComponents(getNormalizedPathComponents(sourceFile.filename, compilerHost.getCurrentDirectory())); sourceFilePath = sourceFilePath.replace(program.getCommonSourceDirectory(), ""); return combinePaths(newDirPath, sourceFilePath); } - function shouldEmitToOwnFile(sourceFile: SourceFile) { - if (!(sourceFile.flags & NodeFlags.DeclarationFile)) { - if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.filename, ".js")) { - return true; - } - } - } - function getOwnEmitOutputFilePath(sourceFile: SourceFile, extension: string) { - if (program.getCompilerOptions().outDir) { - var emitOutputFilePathWithoutExtension = getModuleNameFromFilename(getSourceFilePathInNewDir(program.getCompilerOptions().outDir, sourceFile)); + if (compilerOptions.outDir) { + var emitOutputFilePathWithoutExtension = removeFileExtension(getSourceFilePathInNewDir(compilerOptions.outDir, sourceFile)); } else { - var emitOutputFilePathWithoutExtension = getModuleNameFromFilename(sourceFile.filename); + var emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.filename); } return emitOutputFilePathWithoutExtension + extension; } - function isExternalModuleOrDeclarationFile(sourceFile: SourceFile) { - return isExternalModule(sourceFile) || (sourceFile.flags & NodeFlags.DeclarationFile) !== 0; - } - function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration { return forEach(node.members, member => { if (member.kind === SyntaxKind.Constructor && (member).body) { @@ -98,7 +103,7 @@ module ts { }; } - function createTextWriter(writeSymbol: (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags)=> void): EmitTextWriter { + function createTextWriter(trackSymbol: (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags)=> void): EmitTextWriter { var output = ""; var indent = 0; var lineStart = true; @@ -144,8 +149,16 @@ module ts { } } + function writeKind(text: string, kind: SymbolDisplayPartKind) { + write(text); + } + function writeSymbol(text: string, symbol: Symbol) { + write(text); + } return { write: write, + trackSymbol: trackSymbol, + writeKind: writeKind, writeSymbol: writeSymbol, rawWrite: rawWrite, writeLiteral: writeLiteral, @@ -157,6 +170,7 @@ module ts { getLine: () => lineCount + 1, getColumn: () => lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1, getText: () => output, + clear: () => { } }; } @@ -179,7 +193,7 @@ module ts { }); } - function emitComments(comments: Comment[], trailingSeparator: boolean, writer: EmitTextWriter, writeComment: (comment: Comment, writer: EmitTextWriter) => void) { + function emitComments(comments: CommentRange[], trailingSeparator: boolean, writer: EmitTextWriter, writeComment: (comment: CommentRange, writer: EmitTextWriter) => void) { var emitLeadingSpace = !trailingSeparator; forEach(comments, comment => { if (emitLeadingSpace) { @@ -200,7 +214,7 @@ module ts { }); } - function emitNewLineBeforeLeadingComments(node: TextRange, leadingComments: Comment[], writer: EmitTextWriter) { + function emitNewLineBeforeLeadingComments(node: TextRange, leadingComments: CommentRange[], writer: EmitTextWriter) { // If the leading comments start on different line than the start of node, write new line if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(node.pos) !== getLineOfLocalPosition(leadingComments[0].pos)) { @@ -208,7 +222,7 @@ module ts { } } - function writeCommentRange(comment: Comment, writer: EmitTextWriter) { + function writeCommentRange(comment: CommentRange, writer: EmitTextWriter) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { var firstCommentLineAndCharacter = currentSourceFile.getLineAndCharacterFromPosition(comment.pos); var firstCommentLineIndent: number; @@ -304,7 +318,7 @@ module ts { } function emitJavaScript(jsFilePath: string, root?: SourceFile) { - var writer = createTextWriter(writeSymbol); + var writer = createTextWriter(trackSymbol); var write = writer.write; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; @@ -360,7 +374,7 @@ module ts { /** Sourcemap data that will get encoded */ var sourceMapData: SourceMapData; - function writeSymbol(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) { } + function trackSymbol(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) { } function initializeEmitterWithSourceMaps() { var sourceMapDir: string; // The directory in which sourcemap will be @@ -524,7 +538,8 @@ module ts { sourceMapData.sourceMapSources.push(getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.filename, compilerHost.getCurrentDirectory(), - /*isAbsolutePathAnUrl*/ true)); + compilerHost.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true)); sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; // The one that can be used from program to get the actual source file @@ -582,23 +597,48 @@ module ts { sourceMapNameIndices.pop(); }; - function writeCommentRangeWithMap(comment: Comment, writer: EmitTextWriter) { + function writeCommentRangeWithMap(comment: CommentRange, writer: EmitTextWriter) { recordSourceMapSpan(comment.pos); writeCommentRange(comment, writer); recordSourceMapSpan(comment.end); } + function serializeSourceMapContents(version: number, file: string, sourceRoot: string, sources: string[], names: string[], mappings: string) { + if (typeof JSON !== "undefined") { + return JSON.stringify({ + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }); + } + + return "{\"version\":" + version + ",\"file\":\"" + escapeString(file) + "\",\"sourceRoot\":\"" + escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + escapeString(mappings) + "\"}"; + + function serializeStringArray(list: string[]): string { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + escapeString(list[i]) + "\""; + } + return output; + } + } + function writeJavaScriptAndSourceMapFile(emitOutput: string, writeByteOrderMark: boolean) { // Write source map file encodeLastRecordedSourceMapSpan(); - writeFile(sourceMapData.sourceMapFilePath, JSON.stringify({ - version: 3, - file: sourceMapData.sourceMapFile, - sourceRoot: sourceMapData.sourceMapSourceRoot, - sources: sourceMapData.sourceMapSources, - names: sourceMapData.sourceMapNames, - mappings: sourceMapData.sourceMapMappings - }), /*writeByteOrderMark*/ false); + writeFile(sourceMapData.sourceMapFilePath, serializeSourceMapContents( + 3, + sourceMapData.sourceMapFile, + sourceMapData.sourceMapSourceRoot, + sourceMapData.sourceMapSources, + sourceMapData.sourceMapNames, + sourceMapData.sourceMapMappings), /*writeByteOrderMark*/ false); sourceMapDataList.push(sourceMapData); // Write sourcemap url to the js file and write the js file @@ -641,7 +681,8 @@ module ts { getDirectoryPath(normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap compilerHost.getCurrentDirectory(), - /*isAbsolutePathAnUrl*/ true); + compilerHost.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); } else { sourceMapData.jsSourceMappingURL = combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); @@ -697,23 +738,46 @@ module ts { } } - function emitCommaList(nodes: Node[], count?: number) { - if (!(count >= 0)) count = nodes.length; - if (nodes) { - for (var i = 0; i < count; i++) { - if (i) write(", "); - emit(nodes[i]); + function emitTrailingCommaIfPresent(nodeList: NodeArray, isMultiline: boolean): void { + if (nodeList.hasTrailingComma) { + write(","); + if (isMultiline) { + writeLine(); } } } - function emitMultiLineList(nodes: Node[]) { + function emitCommaList(nodes: NodeArray, includeTrailingComma: boolean, count?: number) { + if (!(count >= 0)) { + count = nodes.length; + } + if (nodes) { + for (var i = 0; i < count; i++) { + if (i) { + write(", "); + } + emit(nodes[i]); + } + + if (includeTrailingComma) { + emitTrailingCommaIfPresent(nodes, /*isMultiline*/ false); + } + } + } + + function emitMultiLineList(nodes: NodeArray, includeTrailingComma: boolean) { if (nodes) { for (var i = 0; i < nodes.length; i++) { - if (i) write(","); + if (i) { + write(","); + } writeLine(); emit(nodes[i]); } + + if (includeTrailingComma) { + emitTrailingCommaIfPresent(nodes, /*isMultiline*/ true); + } } } @@ -781,8 +845,8 @@ module ts { case SyntaxKind.ContinueStatement: case SyntaxKind.ExportAssignment: return false; - case SyntaxKind.LabelledStatement: - return (node.parent).label === node; + case SyntaxKind.LabeledStatement: + return (node.parent).label === node; case SyntaxKind.CatchBlock: return (node.parent).variable === node; } @@ -825,14 +889,14 @@ module ts { if (node.flags & NodeFlags.MultiLine) { write("["); increaseIndent(); - emitMultiLineList(node.elements); + emitMultiLineList(node.elements, /*includeTrailingComma*/ true); decreaseIndent(); writeLine(); write("]"); } else { write("["); - emitCommaList(node.elements); + emitCommaList(node.elements, /*includeTrailingComma*/ true); write("]"); } } @@ -844,14 +908,14 @@ module ts { else if (node.flags & NodeFlags.MultiLine) { write("{"); increaseIndent(); - emitMultiLineList(node.properties); + emitMultiLineList(node.properties, /*includeTrailingComma*/ compilerOptions.target >= ScriptTarget.ES5); decreaseIndent(); writeLine(); write("}"); } else { write("{ "); - emitCommaList(node.properties); + emitCommaList(node.properties, /*includeTrailingComma*/ compilerOptions.target >= ScriptTarget.ES5); write(" }"); } } @@ -865,14 +929,15 @@ module ts { } function emitPropertyAccess(node: PropertyAccess) { - var text = resolver.getPropertyAccessSubstitution(node); - if (text) { - write(text); - return; + var constantValue = resolver.getConstantValue(node); + if (constantValue !== undefined) { + write(constantValue.toString() + " /* " + identifierToString(node.right) + " */"); + } + else { + emit(node.left); + write("."); + emit(node.right); } - emit(node.left); - write("."); - emit(node.right); } function emitIndexedAccess(node: IndexedAccess) { @@ -897,13 +962,13 @@ module ts { emitThis(node.func); if (node.arguments.length) { write(", "); - emitCommaList(node.arguments); + emitCommaList(node.arguments, /*includeTrailingComma*/ false); } write(")"); } else { write("("); - emitCommaList(node.arguments); + emitCommaList(node.arguments, /*includeTrailingComma*/ false); write(")"); } } @@ -913,7 +978,7 @@ module ts { emit(node.func); if (node.arguments) { write("("); - emitCommaList(node.arguments); + emitCommaList(node.arguments, /*includeTrailingComma*/ false); write(")"); } } @@ -1086,7 +1151,7 @@ module ts { if (node.declarations) { emitToken(SyntaxKind.VarKeyword, endPos); write(" "); - emitCommaList(node.declarations); + emitCommaList(node.declarations, /*includeTrailingComma*/ false); } if (node.initializer) { emit(node.initializer); @@ -1200,7 +1265,7 @@ module ts { write(";"); } - function emitLabelledStatement(node: LabelledStatement) { + function emitLabelledStatement(node: LabeledStatement) { emit(node.label); write(": "); emit(node.statement); @@ -1234,7 +1299,7 @@ module ts { function emitVariableStatement(node: VariableStatement) { emitLeadingComments(node); if (!(node.flags & NodeFlags.Export)) write("var "); - emitCommaList(node.declarations); + emitCommaList(node.declarations, /*includeTrailingComma*/ false); write(";"); emitTrailingComments(node); } @@ -1343,7 +1408,7 @@ module ts { increaseIndent(); write("("); if (node) { - emitCommaList(node.parameters, node.parameters.length - (hasRestParameters(node) ? 1 : 0)); + emitCommaList(node.parameters, /*includeTrailingComma*/ false, node.parameters.length - (hasRestParameters(node) ? 1 : 0)); } write(")"); decreaseIndent(); @@ -1431,7 +1496,7 @@ module ts { function emitParameterPropertyAssignments(node: ConstructorDeclaration) { forEach(node.parameters, param => { - if (param.flags & (NodeFlags.Public | NodeFlags.Private)) { + if (param.flags & NodeFlags.AccessibilityModifier) { writeLine(); emitStart(param); emitStart(param.name); @@ -1973,7 +2038,7 @@ module ts { } } - function emitNode(node: Node) { + function emitNode(node: Node): void { if (!node) { return; } @@ -2071,8 +2136,8 @@ module ts { case SyntaxKind.CaseClause: case SyntaxKind.DefaultClause: return emitCaseOrDefaultClause(node); - case SyntaxKind.LabelledStatement: - return emitLabelledStatement(node); + case SyntaxKind.LabeledStatement: + return emitLabelledStatement(node); case SyntaxKind.ThrowStatement: return emitThrowStatement(node); case SyntaxKind.TryStatement: @@ -2104,7 +2169,7 @@ module ts { function getLeadingCommentsWithoutDetachedComments() { // get the leading comments from detachedPos - var leadingComments = getLeadingComments(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); + var leadingComments = getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); if (detachedCommentsInfo.length - 1) { detachedCommentsInfo.pop(); } @@ -2118,14 +2183,14 @@ module ts { function getLeadingCommentsToEmit(node: Node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) { - var leadingComments: Comment[]; + var leadingComments: CommentRange[]; if (hasDetachedComments(node.pos)) { // get comments without detached comments leadingComments = getLeadingCommentsWithoutDetachedComments(); } else { // get the leading comments from the node - leadingComments = getLeadingCommentsOfNode(node, currentSourceFile); + leadingComments = getLeadingCommentRangesOfNode(node, currentSourceFile); } return leadingComments; } @@ -2141,21 +2206,21 @@ module ts { function emitTrailingDeclarationComments(node: Node) { // Emit the trailing comments only if the parent's end doesn't match if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) { - var trailingComments = getTrailingComments(currentSourceFile.text, node.end); + var trailingComments = getTrailingCommentRanges(currentSourceFile.text, node.end); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ emitComments(trailingComments, /*trailingSeparator*/ false, writer, writeComment); } } function emitLeadingCommentsOfLocalPosition(pos: number) { - var leadingComments: Comment[]; + var leadingComments: CommentRange[]; if (hasDetachedComments(pos)) { // get comments without detached comments leadingComments = getLeadingCommentsWithoutDetachedComments(); } else { // get the leading comments from the node - leadingComments = getLeadingComments(currentSourceFile.text, pos); + leadingComments = getLeadingCommentRanges(currentSourceFile.text, pos); } emitNewLineBeforeLeadingComments({ pos: pos, end: pos }, leadingComments, writer); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space @@ -2163,10 +2228,10 @@ module ts { } function emitDetachedCommentsAtPosition(node: TextRange) { - var leadingComments = getLeadingComments(currentSourceFile.text, node.pos); + var leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos); if (leadingComments) { - var detachedComments: Comment[] = []; - var lastComment: Comment; + var detachedComments: CommentRange[] = []; + var lastComment: CommentRange; forEach(leadingComments, comment => { if (lastComment) { @@ -2210,7 +2275,7 @@ module ts { function emitPinnedOrTripleSlashCommentsOfNode(node: Node) { var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); - function isPinnedOrTripleSlashComment(comment: Comment) { + function isPinnedOrTripleSlashComment(comment: CommentRange) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; } @@ -2249,7 +2314,7 @@ module ts { } function emitDeclarations(jsFilePath: string, root?: SourceFile) { - var writer = createTextWriter(writeSymbol); + var writer = createTextWriter(trackSymbol); var write = writer.write; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; @@ -2277,7 +2342,7 @@ module ts { var oldWriter = writer; forEach(importDeclarations, aliasToWrite => { var aliasEmitInfo = forEach(aliasDeclarationEmitInfo, declEmitInfo => declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined); - writer = createTextWriter(writeSymbol); + writer = createTextWriter(trackSymbol); for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { writer.increaseIndent(); } @@ -2288,10 +2353,9 @@ module ts { writer = oldWriter; } - function writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) { + function trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) { var symbolAccesibilityResult = resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning); if (symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) { - resolver.writeSymbol(symbol, enclosingDeclaration, meaning, writer); // write the aliases if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { @@ -2368,12 +2432,18 @@ module ts { if (node.flags & NodeFlags.Private) { write("private "); } + else if (node.flags & NodeFlags.Protected) { + write("protected "); + } write("static "); } else { if (node.flags & NodeFlags.Private) { write("private "); } + else if (node.flags & NodeFlags.Protected) { + write("protected "); + } // If the node is parented in the current source file we need to emit export declare or just export else if (node.parent === currentSourceFile) { // If the node is exported @@ -2630,7 +2700,7 @@ module ts { function emitParameterProperties(constructorDeclaration: ConstructorDeclaration) { if (constructorDeclaration) { forEach(constructorDeclaration.parameters, param => { - if (param.flags & (NodeFlags.Public | NodeFlags.Private)) { + if (param.flags & NodeFlags.AccessibilityModifier) { emitPropertyDeclaration(param); } }); @@ -3070,7 +3140,7 @@ module ts { } } - function resolveScriptReference(sourceFile: SourceFile, reference: FileReference) { + function tryResolveScriptReference(sourceFile: SourceFile, reference: FileReference) { var referenceFileName = normalizePath(combinePaths(getDirectoryPath(sourceFile.filename), reference.filename)); return program.getSourceFile(referenceFileName); } @@ -3082,15 +3152,16 @@ module ts { function writeReferencePath(referencedFile: SourceFile) { var declFileName = referencedFile.flags & NodeFlags.DeclarationFile ? referencedFile.filename // Declaration file, use declaration file name - : shouldEmitToOwnFile(referencedFile) + : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, ".d.ts") // Own output file so get the .d.ts file - : getModuleNameFromFilename(compilerOptions.out) + ".d.ts";// Global out file + : removeFileExtension(compilerOptions.out) + ".d.ts";// Global out file declFileName = getRelativePathToDirectoryOrUrl( getDirectoryPath(normalizeSlashes(jsFilePath)), declFileName, compilerHost.getCurrentDirectory(), - /*isAbsolutePathAnUrl*/ false); + compilerHost.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ false); referencePathsOutput += "/// " + newLine; } @@ -3100,12 +3171,12 @@ module ts { if (!compilerOptions.noResolve) { var addedGlobalFileReference = false; forEach(root.referencedFiles, fileReference => { - var referencedFile = resolveScriptReference(root, fileReference); + var referencedFile = tryResolveScriptReference(root, fileReference); // All the references that are not going to be part of same file - if ((referencedFile.flags & NodeFlags.DeclarationFile) || // This is a declare file reference - shouldEmitToOwnFile(referencedFile) || // This is referenced file is emitting its own js file - !addedGlobalFileReference) { // Or the global out file corresponding to this reference was not added + if (referencedFile && ((referencedFile.flags & NodeFlags.DeclarationFile) || // This is a declare file reference + shouldEmitToOwnFile(referencedFile, compilerOptions) || // This is referenced file is emitting its own js file + !addedGlobalFileReference)) { // Or the global out file corresponding to this reference was not added writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { @@ -3125,11 +3196,11 @@ module ts { // Check what references need to be added if (!compilerOptions.noResolve) { forEach(sourceFile.referencedFiles, fileReference => { - var referencedFile = resolveScriptReference(sourceFile, fileReference); + var referencedFile = tryResolveScriptReference(sourceFile, fileReference); // If the reference file is a declaration file or an external module, emit that reference - if (isExternalModuleOrDeclarationFile(referencedFile) && - !contains(emittedReferencedFiles, referencedFile)) { // If the file reference was not already emitted + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !contains(emittedReferencedFiles, referencedFile))) { // If the file reference was not already emitted writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); @@ -3157,33 +3228,67 @@ module ts { } }); declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos); - writeFile(getModuleNameFromFilename(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); + writeFile(removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); } } - var shouldEmitDeclarations = resolver.shouldEmitDeclarations(); + var hasSemanticErrors = resolver.hasSemanticErrors(); + function emitFile(jsFilePath: string, sourceFile?: SourceFile) { emitJavaScript(jsFilePath, sourceFile); - if (shouldEmitDeclarations) { + if (!hasSemanticErrors && compilerOptions.declaration) { emitDeclarations(jsFilePath, sourceFile); } } - forEach(program.getSourceFiles(), sourceFile => { - if (shouldEmitToOwnFile(sourceFile)) { - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - if (compilerOptions.out) { - emitFile(compilerOptions.out); - } + if (targetSourceFile === undefined) { + // No targetSourceFile is specified (e.g. calling emitter from batch compiler) + forEach(program.getSourceFiles(), sourceFile => { + if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + if (compilerOptions.out) { + emitFile(compilerOptions.out); + } + } + else { + // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) + if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + // If shouldEmitToOwnFile returns true or targetSourceFile is an external module file, then emit targetSourceFile in its own output file + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, ".js"); + emitFile(jsFilePath, targetSourceFile); + } + else if (!isDeclarationFile(targetSourceFile) && compilerOptions.out) { + // Otherwise, if --out is specified and targetSourceFile is not a declaration file, + // Emit all, non-external-module file, into one single output file + emitFile(compilerOptions.out); + } + } + // Sort and make the unique list of diagnostics diagnostics.sort(compareDiagnostics); diagnostics = deduplicateSortedDiagnostics(diagnostics); + // Update returnCode if there is any EmitterError + var hasEmitterError = forEach(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error); + + // Check and update returnCode for syntactic and semantic + var returnCode: EmitReturnStatus; + if (hasEmitterError) { + returnCode = EmitReturnStatus.EmitErrorsEncountered; + } else if (hasSemanticErrors && compilerOptions.declaration) { + returnCode = EmitReturnStatus.DeclarationGenerationSkipped; + } else if (hasSemanticErrors && !compilerOptions.declaration) { + returnCode = EmitReturnStatus.JSGeneratedWithSemanticErrors; + } else { + returnCode = EmitReturnStatus.Succeeded; + } + return { + emitResultStatus: returnCode, errors: diagnostics, sourceMaps: sourceMapDataList }; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index dde11576817..b7582b9ed06 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -17,22 +17,11 @@ module ts { return node; } - var moduleExtensions = [".d.ts", ".ts", ".js"]; - interface ReferenceComments { referencedFiles: FileReference[]; amdDependencies: string[]; } - export function getModuleNameFromFilename(filename: string) { - for (var i = 0; i < moduleExtensions.length; i++) { - var ext = moduleExtensions[i]; - var len = filename.length - ext.length; - if (len > 0 && filename.substr(len) === ext) return filename.substr(0, len); - } - return filename; - } - export function getSourceFileOfNode(node: Node): SourceFile { while (node && node.kind !== SyntaxKind.SourceFile) node = node.parent; return node; @@ -50,15 +39,15 @@ module ts { return node.pos; } - export function getTokenPosOfNode(node: Node): number { - return skipTrivia(getSourceFileOfNode(node).text, node.pos); + export function getTokenPosOfNode(node: Node, sourceFile?: SourceFile): number { + return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } - export function getSourceTextOfNodeFromSourceText(sourceText: string, node: Node): string { + export function getTextOfNodeFromSourceText(sourceText: string, node: Node): string { return sourceText.substring(skipTrivia(sourceText, node.pos), node.end); } - export function getSourceTextOfNode(node: Node): string { + export function getTextOfNode(node: Node): string { var text = getSourceFileOfNode(node).text; return text.substring(skipTrivia(text, node.pos), node.end); } @@ -75,7 +64,7 @@ module ts { // Return display name of an identifier export function identifierToString(identifier: Identifier) { - return identifier.kind === SyntaxKind.Missing ? "(Missing)" : getSourceTextOfNode(identifier); + return identifier.kind === SyntaxKind.Missing ? "(Missing)" : getTextOfNode(identifier); } export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic { @@ -122,6 +111,10 @@ module ts { return file.externalModuleIndicator !== undefined; } + export function isDeclarationFile(file: SourceFile): boolean { + return (file.flags & NodeFlags.DeclarationFile) !== 0; + } + export function isPrologueDirective(node: Node): boolean { return node.kind === SyntaxKind.ExpressionStatement && (node).expression.kind === SyntaxKind.StringLiteral; } @@ -138,25 +131,27 @@ module ts { return ((node).expression).text === "use strict"; } - export function getLeadingCommentsOfNode(node: Node, sourceFileOfNode: SourceFile) { + export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile) { + sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); + // If parameter/type parameter, the prev token trailing comments are part of this node too if (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) { // e.g. (/** blah */ a, /** blah */ b); - return concatenate(getTrailingComments(sourceFileOfNode.text, node.pos), + return concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos), // e.g.: ( // /** blah */ a, // /** blah */ b); - getLeadingComments(sourceFileOfNode.text, node.pos)); + getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); } else { - return getLeadingComments(sourceFileOfNode.text, node.pos); + return getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } } export function getJsDocComments(node: Declaration, sourceFileOfNode: SourceFile) { - return filter(getLeadingCommentsOfNode(node, sourceFileOfNode), comment => isJsDocComment(comment)); + return filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), comment => isJsDocComment(comment)); - function isJsDocComment(comment: Comment) { + function isJsDocComment(comment: CommentRange) { // True if the comment starts with '/**' but not if it is '/**/' return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === CharacterCodes.asterisk && @@ -228,6 +223,10 @@ module ts { return children((node).members); case SyntaxKind.ArrayType: return child((node).elementType); + case SyntaxKind.TupleType: + return children((node).elementTypes); + case SyntaxKind.UnionType: + return children((node).types); case SyntaxKind.ArrayLiteral: return children((node).elements); case SyntaxKind.ObjectLiteral: @@ -305,9 +304,9 @@ module ts { case SyntaxKind.DefaultClause: return child((node).expression) || children((node).statements); - case SyntaxKind.LabelledStatement: - return child((node).label) || - child((node).statement); + case SyntaxKind.LabeledStatement: + return child((node).label) || + child((node).statement); case SyntaxKind.ThrowStatement: return child((node).expression); case SyntaxKind.TryStatement: @@ -371,7 +370,7 @@ module ts { case SyntaxKind.SwitchStatement: case SyntaxKind.CaseClause: case SyntaxKind.DefaultClause: - case SyntaxKind.LabelledStatement: + case SyntaxKind.LabeledStatement: case SyntaxKind.TryStatement: case SyntaxKind.TryBlock: case SyntaxKind.CatchBlock: @@ -485,6 +484,32 @@ module ts { return false; } + export function isStatement(n: Node): boolean { + switch(n.kind) { + case SyntaxKind.BreakStatement: + case SyntaxKind.ContinueStatement: + case SyntaxKind.DebuggerStatement: + case SyntaxKind.DoStatement: + case SyntaxKind.ExpressionStatement: + case SyntaxKind.EmptyStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.ForStatement: + case SyntaxKind.IfStatement: + case SyntaxKind.LabeledStatement: + case SyntaxKind.ReturnStatement: + case SyntaxKind.SwitchStatement: + case SyntaxKind.ThrowKeyword: + case SyntaxKind.TryStatement: + case SyntaxKind.VariableStatement: + case SyntaxKind.WhileStatement: + case SyntaxKind.WithStatement: + case SyntaxKind.ExportAssignment: + return true; + default: + return false; + } + } + // True if the given identifier, string literal, or number literal is the name of a declaration node export function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean { if (name.kind !== SyntaxKind.Identifier && name.kind !== SyntaxKind.StringLiteral && name.kind !== SyntaxKind.NumericLiteral) { @@ -503,6 +528,39 @@ module ts { return false; } + export function getAncestor(node: Node, kind: SyntaxKind): Node { + switch (kind) { + // special-cases that can be come first + case SyntaxKind.ClassDeclaration: + while (node) { + switch (node.kind) { + case SyntaxKind.ClassDeclaration: + return node; + case SyntaxKind.EnumDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.ImportDeclaration: + // early exit cases - declarations cannot be nested in classes + return undefined; + default: + node = node.parent; + continue; + } + } + break; + default: + while (node) { + if (node.kind === kind) { + return node; + } + node = node.parent; + } + break; + } + + return undefined; + } + enum ParsingContext { SourceElements, // Elements in source file ModuleElements, // Elements in module declaration @@ -520,6 +578,7 @@ module ts { Parameters, // Parameters in parameter list TypeParameters, // Type parameters in type parameter list TypeArguments, // Type arguments in type argument list + TupleElementTypes, // Element types in tuple element type list Count // Number of parsing contexts } @@ -547,6 +606,7 @@ module ts { case ParsingContext.Parameters: return Diagnostics.Parameter_declaration_expected; case ParsingContext.TypeParameters: return Diagnostics.Type_parameter_declaration_expected; case ParsingContext.TypeArguments: return Diagnostics.Type_argument_expected; + case ParsingContext.TupleElementTypes: return Diagnostics.Type_expected; } }; @@ -563,12 +623,6 @@ module ts { Parameters, // Parameters in parameter list } - enum TrailingCommaBehavior { - Disallow, - Allow, - Preserve - } - // Tracks whether we nested (directly or indirectly) in a certain control block. // Used for validating break and continue statements. enum ControlBlockContext { @@ -589,10 +643,15 @@ module ts { return SyntaxKind.FirstKeyword <= token && token <= SyntaxKind.LastKeyword; } + export function isTrivia(token: SyntaxKind) { + return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken; + } + export function isModifier(token: SyntaxKind): boolean { switch (token) { case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: case SyntaxKind.ExportKeyword: case SyntaxKind.DeclareKeyword: @@ -755,7 +814,7 @@ module ts { // applying some stricter checks on that node. function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { var span = getErrorSpanForNode(node); - var start = skipTrivia(file.text, span.pos); + var start = span.end > span.pos ? skipTrivia(file.text, span.pos) : span.pos; var length = span.end - start; file.syntacticErrors.push(createFileDiagnostic(file, start, length, message, arg0, arg1, arg2)); @@ -949,7 +1008,10 @@ module ts { return finishNode(node); } error(Diagnostics.Identifier_expected); - return createMissingNode(); + + var node = createMissingNode(); + node.text = ""; + return node; } function parseIdentifier(): Identifier { @@ -1009,12 +1071,13 @@ module ts { case ParsingContext.TypeParameters: return isIdentifier(); case ParsingContext.ArgumentExpressions: - return isExpression(); + return token === SyntaxKind.CommaToken || isExpression(); case ParsingContext.ArrayLiteralMembers: return token === SyntaxKind.CommaToken || isExpression(); case ParsingContext.Parameters: return isParameter(); case ParsingContext.TypeArguments: + case ParsingContext.TupleElementTypes: return isType(); } @@ -1050,6 +1113,7 @@ module ts { // Tokens other than ')' are here for better error recovery return token === SyntaxKind.CloseParenToken || token === SyntaxKind.SemicolonToken; case ParsingContext.ArrayLiteralMembers: + case ParsingContext.TupleElementTypes: return token === SyntaxKind.CloseBracketToken; case ParsingContext.Parameters: // Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery @@ -1137,7 +1201,7 @@ module ts { } // Parses a comma-delimited list of elements - function parseDelimitedList(kind: ParsingContext, parseElement: () => T, trailingCommaBehavior: TrailingCommaBehavior): NodeArray { + function parseDelimitedList(kind: ParsingContext, parseElement: () => T, allowTrailingComma: boolean): NodeArray { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; var result = >[]; @@ -1160,19 +1224,6 @@ module ts { error(Diagnostics._0_expected, ","); } else if (isListTerminator(kind)) { - // Check if the last token was a comma. - if (commaStart >= 0) { - if (trailingCommaBehavior === TrailingCommaBehavior.Disallow) { - if (file.syntacticErrors.length === errorCountBeforeParsingList) { - // Report a grammar error so we don't affect lookahead - grammarErrorAtPos(commaStart, scanner.getStartPos() - commaStart, Diagnostics.Trailing_comma_not_allowed); - } - } - else if (trailingCommaBehavior === TrailingCommaBehavior.Preserve) { - result.push(createNode(SyntaxKind.OmittedExpression)); - } - } - break; } else { @@ -1183,6 +1234,23 @@ module ts { nextToken(); } } + + // Recording the trailing comma is deliberately done after the previous + // loop, and not just if we see a list terminator. This is because the list + // may have ended incorrectly, but it is still important to know if there + // was a trailing comma. + // Check if the last token was a comma. + if (commaStart >= 0) { + if (!allowTrailingComma) { + if (file.syntacticErrors.length === errorCountBeforeParsingList) { + // Report a grammar error so we don't affect lookahead + grammarErrorAtPos(commaStart, scanner.getStartPos() - commaStart, Diagnostics.Trailing_comma_not_allowed); + } + } + // Always preserve a trailing comma by marking it on the NodeArray + result.hasTrailingComma = true; + } + result.end = getNodeEnd(); parsingContext = saveParsingContext; return result; @@ -1205,7 +1273,7 @@ module ts { function parseBracketedList(kind: ParsingContext, parseElement: () => T, startToken: SyntaxKind, endToken: SyntaxKind): NodeArray { if (parseExpected(startToken)) { - var result = parseDelimitedList(kind, parseElement, TrailingCommaBehavior.Disallow); + var result = parseDelimitedList(kind, parseElement, /*allowTrailingComma*/ false); parseExpected(endToken); return result; } @@ -1368,14 +1436,25 @@ module ts { return finishNode(node); } - function parseSignature(kind: SyntaxKind, returnToken: SyntaxKind): ParsedSignature { + function parseSignature(kind: SyntaxKind, returnToken: SyntaxKind, returnTokenRequired: boolean): ParsedSignature { if (kind === SyntaxKind.ConstructSignature) { parseExpected(SyntaxKind.NewKeyword); } var typeParameters = parseTypeParameters(); var parameters = parseParameterList(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken); checkParameterList(parameters); - var type = parseOptional(returnToken) ? parseType() : undefined; + + var type: TypeNode; + + if (returnTokenRequired) { + parseExpected(returnToken); + type = parseType(); + } + else if (parseOptional(returnToken)) + { + type = parseType(); + } + return { typeParameters: typeParameters, parameters: parameters, @@ -1439,7 +1518,7 @@ module ts { function parseSignatureMember(kind: SyntaxKind, returnToken: SyntaxKind): SignatureDeclaration { var node = createNode(kind); - var sig = parseSignature(kind, returnToken); + var sig = parseSignature(kind, returnToken, /* returnTokenRequired */ false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -1512,7 +1591,7 @@ module ts { } if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { node.kind = SyntaxKind.Method; - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); (node).typeParameters = sig.typeParameters; (node).parameters = sig.parameters; (node).type = sig.type; @@ -1570,10 +1649,21 @@ module ts { return finishNode(node); } + function parseTupleType(): TupleTypeNode { + var node = createNode(SyntaxKind.TupleType); + var startTokenPos = scanner.getTokenPos(); + var startErrorCount = file.syntacticErrors.length; + node.elementTypes = parseBracketedList(ParsingContext.TupleElementTypes, parseType, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); + if (!node.elementTypes.length && file.syntacticErrors.length === startErrorCount) { + grammarErrorAtPos(startTokenPos, scanner.getStartPos() - startTokenPos, Diagnostics.A_tuple_type_element_list_cannot_be_empty); + } + return finishNode(node); + } + function parseFunctionType(signatureKind: SyntaxKind): TypeLiteralNode { var node = createNode(SyntaxKind.TypeLiteral); var member = createNode(signatureKind); - var sig = parseSignature(signatureKind, SyntaxKind.EqualsGreaterThanToken); + var sig = parseSignature(signatureKind, SyntaxKind.EqualsGreaterThanToken, /* returnTokenRequired */ true); member.typeParameters = sig.typeParameters; member.parameters = sig.parameters; member.type = sig.type; @@ -1600,6 +1690,8 @@ module ts { return parseTypeQuery(); case SyntaxKind.OpenBraceToken: return parseTypeLiteral(); + case SyntaxKind.OpenBracketToken: + return parseTupleType(); case SyntaxKind.OpenParenToken: case SyntaxKind.LessThanToken: return parseFunctionType(SyntaxKind.CallSignature); @@ -1623,6 +1715,7 @@ module ts { case SyntaxKind.VoidKeyword: case SyntaxKind.TypeOfKeyword: case SyntaxKind.OpenBraceToken: + case SyntaxKind.OpenBracketToken: case SyntaxKind.LessThanToken: case SyntaxKind.NewKeyword: return true; @@ -1638,9 +1731,9 @@ module ts { } } - function parseType(): TypeNode { + function parseNonUnionType(): TypeNode { var type = parseNonArrayType(); - while (type && !scanner.hasPrecedingLineBreak() && parseOptional(SyntaxKind.OpenBracketToken)) { + while (!scanner.hasPrecedingLineBreak() && parseOptional(SyntaxKind.OpenBracketToken)) { parseExpected(SyntaxKind.CloseBracketToken); var node = createNode(SyntaxKind.ArrayType, type.pos); node.elementType = type; @@ -1649,6 +1742,22 @@ module ts { return type; } + function parseType(): TypeNode { + var type = parseNonUnionType(); + if (token === SyntaxKind.BarToken) { + var types = >[type]; + types.pos = type.pos; + while (parseOptional(SyntaxKind.BarToken)) { + types.push(parseNonUnionType()); + } + types.end = getNodeEnd(); + var node = createNode(SyntaxKind.UnionType, type.pos); + node.types = types; + type = finishNode(node); + } + return type; + } + function parseTypeAnnotation(): TypeNode { return parseOptional(SyntaxKind.ColonToken) ? parseType() : undefined; } @@ -1829,7 +1938,7 @@ module ts { var pos = getNodePos(); if (triState === Tristate.True) { - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); // If we have an arrow, then try to parse the body. // Even if not, try to parse if we have an opening brace, just in case we're in an error state. @@ -1932,7 +2041,7 @@ module ts { function tryParseSignatureIfArrowOrBraceFollows(): ParsedSignature { return tryParse(() => { - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); // Parsing a signature isn't enough. // Parenthesized arrow signatures often look like other valid expressions. @@ -2081,10 +2190,10 @@ module ts { // The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator - if ((token === SyntaxKind.PlusPlusToken || token === SyntaxKind.MinusMinusToken) && isEvalOrArgumentsIdentifier(operand)) { + if ((operator === SyntaxKind.PlusPlusToken || operator === SyntaxKind.MinusMinusToken) && isEvalOrArgumentsIdentifier(operand)) { reportInvalidUseInStrictMode(operand); } - else if (token === SyntaxKind.DeleteKeyword && operand.kind === SyntaxKind.Identifier) { + else if (operator === SyntaxKind.DeleteKeyword && operand.kind === SyntaxKind.Identifier) { // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its // UnaryExpression is a direct reference to a variable, function argument, or function name grammarErrorOnNode(operand, Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); @@ -2143,10 +2252,38 @@ module ts { function parseCallAndAccess(expr: Expression, inNewExpression: boolean): Expression { while (true) { + var dotStart = scanner.getTokenPos(); if (parseOptional(SyntaxKind.DotToken)) { var propertyAccess = createNode(SyntaxKind.PropertyAccess, expr.pos); + // Technically a keyword is valid here as all keywords are identifier names. + // However, often we'll encounter this in error situations when the keyword + // is actually starting another valid construct. + // + // So, we check for the following specific case: + // + // name. + // keyword identifierNameOrKeyword + // + // Note: the newlines are important here. For example, if that above code + // were rewritten into: + // + // name.keyword + // identifierNameOrKeyword + // + // Then we would consider it valid. That's because ASI would take effect and + // the code would be implicitly: "name.keyword; identifierNameOrKeyword". + // In the first case though, ASI will not take effect because there is not a + // line terminator after the keyword. + if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord() && lookAhead(() => scanner.isReservedWord())) { + grammarErrorAtPos(dotStart, scanner.getStartPos() - dotStart, Diagnostics.Identifier_expected); + var id = createMissingNode(); + } + else { + var id = parseIdentifierName(); + } + propertyAccess.left = expr; - propertyAccess.right = parseIdentifierName(); + propertyAccess.right = id; expr = finishNode(propertyAccess); continue; } @@ -2188,7 +2325,8 @@ module ts { else { parseExpected(SyntaxKind.OpenParenToken); } - callExpr.arguments = parseDelimitedList(ParsingContext.ArgumentExpressions, parseAssignmentExpression, TrailingCommaBehavior.Disallow); + callExpr.arguments = parseDelimitedList(ParsingContext.ArgumentExpressions, + parseArgumentExpression, /*allowTrailingComma*/ false); parseExpected(SyntaxKind.CloseParenToken); expr = finishNode(callExpr); continue; @@ -2257,15 +2395,33 @@ module ts { return finishNode(node); } + function parseAssignmentExpressionOrOmittedExpression(omittedExpressionDiagnostic: DiagnosticMessage): Expression { + if (token === SyntaxKind.CommaToken) { + if (omittedExpressionDiagnostic) { + var errorStart = scanner.getTokenPos(); + var errorLength = scanner.getTextPos() - errorStart; + grammarErrorAtPos(errorStart, errorLength, omittedExpressionDiagnostic); + } + return createNode(SyntaxKind.OmittedExpression); + } + + return parseAssignmentExpression(); + } + function parseArrayLiteralElement(): Expression { - return token === SyntaxKind.CommaToken ? createNode(SyntaxKind.OmittedExpression) : parseAssignmentExpression(); + return parseAssignmentExpressionOrOmittedExpression(/*omittedExpressionDiagnostic*/ undefined); + } + + function parseArgumentExpression(): Expression { + return parseAssignmentExpressionOrOmittedExpression(Diagnostics.Argument_expression_expected); } function parseArrayLiteral(): ArrayLiteral { var node = createNode(SyntaxKind.ArrayLiteral); parseExpected(SyntaxKind.OpenBracketToken); if (scanner.hasPrecedingLineBreak()) node.flags |= NodeFlags.MultiLine; - node.elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArrayLiteralElement, TrailingCommaBehavior.Preserve); + node.elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, + parseArrayLiteralElement, /*allowTrailingComma*/ true); parseExpected(SyntaxKind.CloseBracketToken); return finishNode(node); } @@ -2274,7 +2430,7 @@ module ts { var node = createNode(SyntaxKind.PropertyAssignment); node.name = parsePropertyName(); if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); var body = parseBody(/* ignoreMissingOpenBrace */ false); // do not propagate property name as name for function expression // for scenarios like @@ -2307,10 +2463,7 @@ module ts { node.flags |= NodeFlags.MultiLine; } - // ES3 itself does not accept a trailing comma in an object literal, however, we'd like to preserve it in ES5. - var trailingCommaBehavior = languageVersion === ScriptTarget.ES3 ? TrailingCommaBehavior.Allow : TrailingCommaBehavior.Preserve; - - node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralMember, trailingCommaBehavior); + node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralMember, /*allowTrailingComma*/ true); parseExpected(SyntaxKind.CloseBraceToken); var seen: Map = {}; @@ -2374,7 +2527,7 @@ module ts { var pos = getNodePos(); parseExpected(SyntaxKind.FunctionKeyword); var name = isIdentifier() ? parseIdentifier() : undefined; - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); var body = parseBody(/* ignoreMissingOpenBrace */ false); if (name && isInStrictMode && isEvalOrArgumentsIdentifier(name)) { // It is a SyntaxError to use within strict mode code the identifiers eval or arguments as the @@ -2399,7 +2552,8 @@ module ts { parseExpected(SyntaxKind.NewKeyword); node.func = parseCallAndAccess(parsePrimaryExpression(), /* inNewExpression */ true); if (parseOptional(SyntaxKind.OpenParenToken) || token === SyntaxKind.LessThanToken && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { - node.arguments = parseDelimitedList(ParsingContext.ArgumentExpressions, parseAssignmentExpression, TrailingCommaBehavior.Disallow); + node.arguments = parseDelimitedList(ParsingContext.ArgumentExpressions, + parseArgumentExpression, /*allowTrailingComma*/ false); parseExpected(SyntaxKind.CloseParenToken); } return finishNode(node); @@ -2799,13 +2953,13 @@ module ts { return isIdentifier() && lookAhead(() => nextToken() === SyntaxKind.ColonToken); } - function parseLabelledStatement(): LabelledStatement { - var node = createNode(SyntaxKind.LabelledStatement); + function parseLabelledStatement(): LabeledStatement { + var node = createNode(SyntaxKind.LabeledStatement); node.label = parseIdentifier(); parseExpected(SyntaxKind.ColonToken); if (labelledStatementInfo.nodeIsNestedInLabel(node.label, /*requireIterationStatement*/ false, /*stopAtFunctionBoundary*/ true)) { - grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getSourceTextOfNodeFromSourceText(sourceText, node.label)); + grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getTextOfNodeFromSourceText(sourceText, node.label)); } labelledStatementInfo.addLabel(node.label); @@ -2863,6 +3017,7 @@ module ts { } case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: // When followed by an identifier or keyword, these do not start a statement but // might instead be following type members @@ -2967,7 +3122,8 @@ module ts { } function parseVariableDeclarationList(flags: NodeFlags, noIn?: boolean): NodeArray { - return parseDelimitedList(ParsingContext.VariableDeclarations, () => parseVariableDeclaration(flags, noIn), TrailingCommaBehavior.Disallow); + return parseDelimitedList(ParsingContext.VariableDeclarations, + () => parseVariableDeclaration(flags, noIn), /*allowTrailingComma*/ false); } function parseVariableStatement(pos?: number, flags?: NodeFlags): VariableStatement { @@ -2989,7 +3145,7 @@ module ts { if (flags) node.flags = flags; parseExpected(SyntaxKind.FunctionKeyword); node.name = parseIdentifier(); - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -3006,7 +3162,7 @@ module ts { var node = createNode(SyntaxKind.Constructor, pos); node.flags = flags; parseExpected(SyntaxKind.ConstructorKeyword); - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -3033,7 +3189,7 @@ module ts { var method = createNode(SyntaxKind.Method, pos); method.flags = flags; method.name = name; - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); method.typeParameters = sig.typeParameters; method.parameters = sig.parameters; method.type = sig.type; @@ -3106,7 +3262,7 @@ module ts { var node = createNode(kind, pos); node.flags = flags; node.name = parsePropertyName(); - var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken); + var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -3181,6 +3337,8 @@ module ts { var lastDeclareModifierLength: number; var lastPrivateModifierStart: number; var lastPrivateModifierLength: number; + var lastProtectedModifierStart: number; + var lastProtectedModifierLength: number; while (true) { var modifierStart = scanner.getTokenPos(); @@ -3193,7 +3351,7 @@ module ts { switch (modifierToken) { case SyntaxKind.PublicKeyword: - if (flags & NodeFlags.Private || flags & NodeFlags.Public) { + if (flags & NodeFlags.AccessibilityModifier) { grammarErrorAtPos(modifierStart, modifierLength, Diagnostics.Accessibility_modifier_already_seen); } else if (flags & NodeFlags.Static) { @@ -3206,7 +3364,7 @@ module ts { break; case SyntaxKind.PrivateKeyword: - if (flags & NodeFlags.Private || flags & NodeFlags.Public) { + if (flags & NodeFlags.AccessibilityModifier) { grammarErrorAtPos(modifierStart, modifierLength, Diagnostics.Accessibility_modifier_already_seen); } else if (flags & NodeFlags.Static) { @@ -3220,6 +3378,21 @@ module ts { flags |= NodeFlags.Private; break; + case SyntaxKind.ProtectedKeyword: + if (flags & NodeFlags.Public || flags & NodeFlags.Private || flags & NodeFlags.Protected) { + grammarErrorAtPos(modifierStart, modifierLength, Diagnostics.Accessibility_modifier_already_seen); + } + else if (flags & NodeFlags.Static) { + grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_must_precede_1_modifier, "protected", "static"); + } + else if (context === ModifierContext.ModuleElements || context === ModifierContext.SourceElements) { + grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "protected"); + } + lastProtectedModifierStart = modifierStart; + lastProtectedModifierLength = modifierLength; + flags |= NodeFlags.Protected; + break; + case SyntaxKind.StaticKeyword: if (flags & NodeFlags.Static) { grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_already_seen, "static"); @@ -3277,6 +3450,9 @@ module ts { else if (token === SyntaxKind.ConstructorKeyword && flags & NodeFlags.Private) { grammarErrorAtPos(lastPrivateModifierStart, lastPrivateModifierLength, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } + else if (token === SyntaxKind.ConstructorKeyword && flags & NodeFlags.Protected) { + grammarErrorAtPos(lastProtectedModifierStart, lastProtectedModifierLength, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); + } else if (token === SyntaxKind.ImportKeyword) { if (flags & NodeFlags.Ambient) { grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); @@ -3346,7 +3522,8 @@ module ts { var implementsKeywordLength: number; if (parseOptional(SyntaxKind.ImplementsKeyword)) { implementsKeywordLength = scanner.getStartPos() - implementsKeywordStart; - node.implementedTypes = parseDelimitedList(ParsingContext.BaseTypeReferences, parseTypeReference, TrailingCommaBehavior.Disallow); + node.implementedTypes = parseDelimitedList(ParsingContext.BaseTypeReferences, + parseTypeReference, /*allowTrailingComma*/ false); } var errorCountBeforeClassBody = file.syntacticErrors.length; if (parseExpected(SyntaxKind.OpenBraceToken)) { @@ -3374,7 +3551,8 @@ module ts { var extendsKeywordLength: number; if (parseOptional(SyntaxKind.ExtendsKeyword)) { extendsKeywordLength = scanner.getStartPos() - extendsKeywordStart; - node.baseTypes = parseDelimitedList(ParsingContext.BaseTypeReferences, parseTypeReference, TrailingCommaBehavior.Disallow); + node.baseTypes = parseDelimitedList(ParsingContext.BaseTypeReferences, + parseTypeReference, /*allowTrailingComma*/ false); } var errorCountBeforeInterfaceBody = file.syntacticErrors.length; node.members = parseTypeLiteral().members; @@ -3383,7 +3561,7 @@ module ts { } return finishNode(node); } - + function parseAndCheckEnumDeclaration(pos: number, flags: NodeFlags): EnumDeclaration { function isIntegerLiteral(expression: Expression): boolean { function isInteger(literalExpression: LiteralExpression): boolean { @@ -3438,7 +3616,8 @@ module ts { parseExpected(SyntaxKind.EnumKeyword); node.name = parseIdentifier(); if (parseExpected(SyntaxKind.OpenBraceToken)) { - node.members = parseDelimitedList(ParsingContext.EnumMembers, parseAndCheckEnumMember, TrailingCommaBehavior.Allow); + node.members = parseDelimitedList(ParsingContext.EnumMembers, + parseAndCheckEnumMember, /*allowTrailingComma*/ true); parseExpected(SyntaxKind.CloseBraceToken); } else { @@ -3533,7 +3712,7 @@ module ts { return finishNode(node); } - function isDeclaration() { + function isDeclaration(): boolean { switch (token) { case SyntaxKind.VarKeyword: case SyntaxKind.FunctionKeyword: @@ -3553,6 +3732,7 @@ module ts { case SyntaxKind.DeclareKeyword: case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: // Check for modifier on source element return lookAhead(() => { nextToken(); return isDeclaration(); }); @@ -3659,15 +3839,17 @@ module ts { } else { var matchResult = fullTripleSlashReferencePathRegEx.exec(comment); + var start = range.pos; + var end = range.end; + var length = end - start; + if (!matchResult) { - var start = range.pos; - var length = range.end - start; errorAtPos(start, length, Diagnostics.Invalid_reference_directive_syntax); } else { referencedFiles.push({ - pos: range.pos, - end: range.end, + pos: start, + end: end, filename: matchResult[3] }); } @@ -3697,7 +3879,7 @@ module ts { : undefined); } - scanner = createScanner(languageVersion, sourceText, scanError, onComment); + scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError, onComment); var rootNodeFlags: NodeFlags = 0; if (fileExtensionIs(filename, ".d.ts")) { rootNodeFlags = NodeFlags.DeclarationFile; @@ -3776,17 +3958,31 @@ module ts { var start = refPos; var length = refEnd - refPos; } + var diagnostic: DiagnosticMessage; if (hasExtension(filename)) { if (!fileExtensionIs(filename, ".ts")) { - errors.push(createFileDiagnostic(refFile, start, length, Diagnostics.File_0_must_have_extension_ts_or_d_ts, filename)); + diagnostic = Diagnostics.File_0_must_have_extension_ts_or_d_ts; } else if (!findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { - errors.push(createFileDiagnostic(refFile, start, length, Diagnostics.File_0_not_found, filename)); + diagnostic = Diagnostics.File_0_not_found; + } + else if (refFile && host.getCanonicalFileName(filename) === host.getCanonicalFileName(refFile.filename)) { + diagnostic = Diagnostics.A_file_cannot_have_a_reference_to_itself; } } else { if (!(findSourceFile(filename + ".ts", isDefaultLib, refFile, refPos, refEnd) || findSourceFile(filename + ".d.ts", isDefaultLib, refFile, refPos, refEnd))) { - errors.push(createFileDiagnostic(refFile, start, length, Diagnostics.File_0_not_found, filename + ".ts")); + diagnostic = Diagnostics.File_0_not_found; + filename += ".ts"; + } + } + + if (diagnostic) { + if (refFile) { + errors.push(createFileDiagnostic(refFile, start, length, diagnostic, filename)); + } + else { + errors.push(createCompilerDiagnostic(diagnostic, filename)); } } } @@ -3831,7 +4027,8 @@ module ts { function processReferencedFiles(file: SourceFile, basePath: string) { forEach(file.referencedFiles, ref => { - processSourceFile(normalizePath(combinePaths(basePath, ref.filename)), /* isDefaultLib */ false, file, ref.pos, ref.end); + var referencedFilename = isRootedDiskPath(ref.filename) ? ref.filename : combinePaths(basePath, ref.filename); + processSourceFile(normalizePath(referencedFilename), /* isDefaultLib */ false, file, ref.pos, ref.end); }); } @@ -3856,7 +4053,7 @@ module ts { } } } - else if (node.kind === SyntaxKind.ModuleDeclaration && (node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || file.flags & NodeFlags.DeclarationFile)) { + else if (node.kind === SyntaxKind.ModuleDeclaration && (node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) { // TypeScript 1.0 spec (April 2014): 12.1.6 // An AmbientExternalModuleDeclaration declares an external module. // This type of declaration is permitted only in the global module. @@ -3919,11 +4116,11 @@ module ts { // Each file contributes into common source file path if (!(sourceFile.flags & NodeFlags.DeclarationFile) && !fileExtensionIs(sourceFile.filename, ".js")) { - var sourcePathCompoments = getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory()); - sourcePathCompoments.pop(); // FileName is not part of directory + var sourcePathComponents = getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory()); + sourcePathComponents.pop(); // FileName is not part of directory if (commonPathComponents) { - for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathCompoments.length); i++) { - if (commonPathComponents[i] !== sourcePathCompoments[i]) { + for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { errors.push(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); return; @@ -3936,18 +4133,18 @@ module ts { } // If the fileComponent path completely matched and less than already found update the length - if (sourcePathCompoments.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathCompoments.length; + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; } } else { // first file - commonPathComponents = sourcePathCompoments; + commonPathComponents = sourcePathComponents; } } }); - commonSourceDirectory = getNormalizedPathFromPathCompoments(commonPathComponents); + commonSourceDirectory = getNormalizedPathFromPathComponents(commonPathComponents); if (commonSourceDirectory) { // Make sure directory path ends with directory separator so this string can directly // used to replace with "" to get the relative path of the source file and the relative path doesn't diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 59c7913e24a..81d16b5f487 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -371,8 +371,8 @@ module ts { // between the given position and the next line break are returned. The return value is an array containing a TextRange for each // comment. Single-line comment ranges include the beginning '//' characters but not the ending line break. Multi-line comment // ranges include the beginning '/* and ending '*/' characters. The return value is undefined if no comments were found. - function getCommentRanges(text: string, pos: number, trailing: boolean): Comment[] { - var result: Comment[]; + function getCommentRanges(text: string, pos: number, trailing: boolean): CommentRange[] { + var result: CommentRange[]; var collecting = trailing || pos === 0; while (true) { var ch = text.charCodeAt(pos); @@ -440,11 +440,11 @@ module ts { } } - export function getLeadingComments(text: string, pos: number): Comment[] { + export function getLeadingCommentRanges(text: string, pos: number): CommentRange[] { return getCommentRanges(text, pos, /*trailing*/ false); } - export function getTrailingComments(text: string, pos: number): Comment[] { + export function getTrailingCommentRanges(text: string, pos: number): CommentRange[] { return getCommentRanges(text, pos, /*trailing*/ true); } @@ -460,7 +460,7 @@ module ts { ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion); } - export function createScanner(languageVersion: ScriptTarget, text?: string, onError?: ErrorCallback, onComment?: CommentCallback): Scanner { + export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback, onComment?: CommentCallback): Scanner { var pos: number; // Current position (end position of text of current token) var len: number; // Length of text var startPos: number; // Start position of whitespace before current token @@ -694,12 +694,34 @@ module ts { case CharacterCodes.lineFeed: case CharacterCodes.carriageReturn: precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; + } + else { + if (ch === CharacterCodes.carriageReturn && pos + 1 < len && text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) { + // consume both CR and LF + pos += 2; + } + else { + pos++; + } + return token = SyntaxKind.NewLineTrivia; + } case CharacterCodes.tab: case CharacterCodes.verticalTab: case CharacterCodes.formFeed: case CharacterCodes.space: - pos++; - continue; + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { + pos++; + } + return token = SyntaxKind.WhitespaceTrivia; + } case CharacterCodes.exclamation: if (text.charCodeAt(pos + 1) === CharacterCodes.equals) { if (text.charCodeAt(pos + 2) === CharacterCodes.equals) { @@ -776,7 +798,13 @@ module ts { if (onComment) { onComment(tokenPos, pos); } - continue; + + if (skipTrivia) { + continue; + } + else { + return token = SyntaxKind.SingleLineCommentTrivia; + } } // Multi-line comment if (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) { @@ -806,7 +834,12 @@ module ts { onComment(tokenPos, pos); } - continue; + if (skipTrivia) { + continue; + } + else { + return token = SyntaxKind.MultiLineCommentTrivia; + } } if (text.charCodeAt(pos + 1) === CharacterCodes.equals) { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 8188cb8e4d1..c8cccd2da1c 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -9,7 +9,7 @@ /// module ts { - var version = "1.1.0.0"; + var version = "1.3.0.0"; /** * Checks to see if the locale is in the appropriate format, @@ -199,8 +199,14 @@ module ts { export function executeCommandLine(args: string[]): void { var commandLine = parseCommandLine(args); + var compilerOptions = commandLine.options; + + if (compilerOptions.locale) { + if (typeof JSON === "undefined") { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--locale")); + return sys.exit(1); + } - if (commandLine.options.locale) { validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); } @@ -208,32 +214,38 @@ module ts { // setting up localization, report them and quit. if (commandLine.errors.length > 0) { reportDiagnostics(commandLine.errors); - return sys.exit(1); + return sys.exit(EmitReturnStatus.CompilerOptionsErrors); } - if (commandLine.options.version) { + if (compilerOptions.version) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.Version_0, version)); - return sys.exit(0); + return sys.exit(EmitReturnStatus.Succeeded); } - if (commandLine.options.help || commandLine.filenames.length === 0) { + if (compilerOptions.help) { printVersion(); printHelp(); - return sys.exit(0); + return sys.exit(EmitReturnStatus.Succeeded); } - var defaultCompilerHost = createCompilerHost(commandLine.options); + if (commandLine.filenames.length === 0) { + printVersion(); + printHelp(); + return sys.exit(EmitReturnStatus.CompilerOptionsErrors); + } + + var defaultCompilerHost = createCompilerHost(compilerOptions); - if (commandLine.options.watch) { + if (compilerOptions.watch) { if (!sys.watchFile) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); - return sys.exit(1); + return sys.exit(EmitReturnStatus.CompilerOptionsErrors); } watchProgram(commandLine, defaultCompilerHost); } else { - var result = compile(commandLine, defaultCompilerHost).errors.length > 0 ? 1 : 0; + var result = compile(commandLine, defaultCompilerHost).exitStatus return sys.exit(result); } } @@ -328,21 +340,27 @@ module ts { function compile(commandLine: ParsedCommandLine, compilerHost: CompilerHost) { var parseStart = new Date().getTime(); - var program = createProgram(commandLine.filenames, commandLine.options, compilerHost); + var compilerOptions = commandLine.options; + var program = createProgram(commandLine.filenames, compilerOptions, compilerHost); var bindStart = new Date().getTime(); - var errors = program.getDiagnostics(); + var errors: Diagnostic[] = program.getDiagnostics(); + var exitStatus: EmitReturnStatus; + if (errors.length) { var checkStart = bindStart; var emitStart = bindStart; var reportStart = bindStart; + exitStatus = EmitReturnStatus.AllOutputGenerationSkipped; } else { var checker = program.getTypeChecker(/*fullTypeCheckMode*/ true); var checkStart = new Date().getTime(); var semanticErrors = checker.getDiagnostics(); var emitStart = new Date().getTime(); - var emitErrors = checker.emitFiles().errors; + var emitOutput = checker.emitFiles(); + var emitErrors = emitOutput.errors; + exitStatus = emitOutput.emitResultStatus; var reportStart = new Date().getTime(); errors = concatenate(semanticErrors, emitErrors); } @@ -366,8 +384,7 @@ module ts { reportTimeStatistic("Total time", reportStart - parseStart); } - return { program: program, errors: errors }; - + return { program: program, exitStatus: exitStatus } } function printVersion() { @@ -392,7 +409,7 @@ module ts { // Build up the list of examples. var padding = makePadding(marginLength); output += getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine; - output += padding + "tsc --out foo.js foo.ts" + sys.newLine; + output += padding + "tsc --out file.js file.ts" + sys.newLine; output += padding + "tsc @args.txt" + sys.newLine; output += sys.newLine; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 715d01926f0..b2da87c4ec0 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -12,6 +12,10 @@ module ts { export enum SyntaxKind { Unknown, EndOfFileToken, + SingleLineCommentTrivia, + MultiLineCommentTrivia, + NewLineTrivia, + WhitespaceTrivia, // Literals NumericLiteral, StringLiteral, @@ -149,6 +153,8 @@ module ts { TypeQuery, TypeLiteral, ArrayType, + TupleType, + UnionType, // Expression ArrayLiteral, ObjectLiteral, @@ -183,7 +189,7 @@ module ts { SwitchStatement, CaseClause, DefaultClause, - LabelledStatement, + LabeledStatement, ThrowStatement, TryStatement, TryBlock, @@ -219,9 +225,13 @@ module ts { FirstFutureReservedWord = ImplementsKeyword, LastFutureReservedWord = YieldKeyword, FirstTypeNode = TypeReference, - LastTypeNode = ArrayType, + LastTypeNode = UnionType, FirstPunctuation = OpenBraceToken, - LastPunctuation = CaretEqualsToken + LastPunctuation = CaretEqualsToken, + FirstToken = EndOfFileToken, + LastToken = StringKeyword, + FirstTriviaToken = SingleLineCommentTrivia, + LastTriviaToken = WhitespaceTrivia } export enum NodeFlags { @@ -231,12 +241,14 @@ module ts { Rest = 0x00000008, // Parameter Public = 0x00000010, // Property/Method Private = 0x00000020, // Property/Method - Static = 0x00000040, // Property/Method - MultiLine = 0x00000080, // Multi-line array or object literal - Synthetic = 0x00000100, // Synthetic node (for full fidelity) - DeclarationFile = 0x00000200, // Node is a .d.ts file + Protected = 0x00000040, // Property/Method + Static = 0x00000080, // Property/Method + MultiLine = 0x00000100, // Multi-line array or object literal + Synthetic = 0x00000200, // Synthetic node (for full fidelity) + DeclarationFile = 0x00000400, // Node is a .d.ts file - Modifier = Export | Ambient | Public | Private | Static + Modifier = Export | Ambient | Public | Private | Protected | Static, + AccessibilityModifier = Public | Private | Protected } export interface Node extends TextRange { @@ -250,7 +262,9 @@ module ts { localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes) } - export interface NodeArray extends Array, TextRange { } + export interface NodeArray extends Array, TextRange { + hasTrailingComma?: boolean; + } export interface Identifier extends Node { text: string; // Text of identifier (with escapes converted to characters) @@ -320,6 +334,14 @@ module ts { elementType: TypeNode; } + export interface TupleTypeNode extends TypeNode { + elementTypes: NodeArray; + } + + export interface UnionTypeNode extends TypeNode { + types: NodeArray; + } + export interface StringLiteralTypeNode extends TypeNode { text: string; } @@ -459,7 +481,7 @@ module ts { statements: NodeArray; } - export interface LabelledStatement extends Statement { + export interface LabeledStatement extends Statement { label: Identifier; statement: Statement; } @@ -516,7 +538,7 @@ module ts { filename: string; } - export interface Comment extends TextRange { + export interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; } @@ -569,7 +591,7 @@ module ts { export interface SourceMapData { /** Where the sourcemap file is written */ sourceMapFilePath: string; - /** source map url written in the js file */ + /** source map URL written in the js file */ jsSourceMappingURL: string; /** Source map's file field - js file name*/ sourceMapFile: string; @@ -588,7 +610,18 @@ module ts { sourceMapDecodedMappings: SourceMapSpan[]; } + // Return code used by getEmitOutput function to indicate status of the function + export enum EmitReturnStatus { + Succeeded = 0, // All outputs generated as requested (.js, .map, .d.ts), no errors reported + AllOutputGenerationSkipped = 1, // No .js generated because of syntax errors, nothing generated + JSGeneratedWithSemanticErrors = 2, // .js and .map generated with semantic errors + DeclarationGenerationSkipped = 3, // .d.ts generation skipped because of semantic errors or declaration emitter specific errors; Output .js with semantic errors + EmitErrorsEncountered = 4, // Emitter errors occurred during emitting process + CompilerOptionsErrors = 5, // Errors occurred in parsing compiler options, nothing generated + } + export interface EmitResult { + emitResultStatus: EmitReturnStatus; errors: Diagnostic[]; sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps } @@ -602,7 +635,7 @@ module ts { getSymbolCount(): number; getTypeCount(): number; checkProgram(): void; - emitFiles(): EmitResult; + emitFiles(targetSourceFile?: SourceFile): EmitResult; getParentOfSymbol(symbol: Symbol): Symbol; getTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; @@ -615,26 +648,63 @@ module ts { getTypeOfNode(node: Node): Type; getApparentType(type: Type): ApparentType; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; + writeType(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; + writeSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; + getFullyQualifiedName(symbol: Symbol): string; getAugmentedPropertiesOfApparentType(type: Type): Symbol[]; - getRootSymbol(symbol: Symbol): Symbol; + getRootSymbols(symbol: Symbol): Symbol[]; getContextualType(node: Node): Type; + getResolvedSignature(node: CallExpression, candidatesOutArray?: Signature[]): Signature; + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; + writeSignature(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + writeTypeParameter(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + writeTypeParametersOfSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; + isImplementationOfOverload(node: FunctionDeclaration): boolean; + isUndefinedSymbol(symbol: Symbol): boolean; + isArgumentsSymbol(symbol: Symbol): boolean; + + // Returns the constant value of this enum member, or 'undefined' if the enum member has a + // computed value. + getEnumMemberValue(node: EnumMember): number; + + isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean; + getAliasedSymbol(symbol: Symbol): Symbol; } - export interface TextWriter { - write(s: string): void; - writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; + export interface SymbolWriter { + writeKind(text: string, kind: SymbolDisplayPartKind): void; + writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; decreaseIndent(): void; - getText(): string; + clear(): void; + + // Called when the symbol writer encounters a symbol to write. Currently only used by the + // declaration emitter to help determine if it should patch up the final declaration file + // with import statements it previously saw (but chose not to emit). + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; } export enum TypeFormatFlags { - None = 0x00000000, - WriteArrayAsGenericType = 0x00000001, // Write Array instead T[] - UseTypeOfFunction = 0x00000002, // Write typeof instead of function type literal - NoTruncation = 0x00000004, // Don't truncate typeToString result + None = 0x00000000, + WriteArrayAsGenericType = 0x00000001, // Write Array instead T[] + UseTypeOfFunction = 0x00000002, // Write typeof instead of function type literal + NoTruncation = 0x00000004, // Don't truncate typeToString result + WriteArrowStyleSignature = 0x00000008, // Write arrow style signature + WriteOwnNameForAnyLike = 0x00000010, // Write symbol's own name instead of 'any' for any like types (eg. unknown, __resolving__ etc) + WriteTypeArgumentsOfSignature = 0x00000020, // Write the type arguments instead of type parameters of the signature + } + + export enum SymbolFormatFlags { + None = 0x00000000, + WriteTypeParametersOrArguments = 0x00000001, // Write symbols's type argument if it is instantiated symbol + // eg. class C { p: T } <-- Show p as C.p here + // var a: C; + // var p = a.p; <--- Here p is property of C so show it as C.p instead of just C.p + UseOnlyExternalAliasing = 0x00000002, // Use only external alias information to get the symbol name in the given context + // eg. module m { export class c { } } import x = m.c; + // When this flag is specified m.c will be used to refer to the class instead of alias symbol x } export enum SymbolAccessibility { @@ -654,20 +724,22 @@ module ts { getProgram(): Program; getLocalNameOfContainer(container: Declaration): string; getExpressionNamePrefix(node: Identifier): string; - getPropertyAccessSubstitution(node: PropertyAccess): string; getExportAssignmentName(node: SourceFile): string; isReferencedImportDeclaration(node: ImportDeclaration): boolean; isTopLevelValueImportedViaEntityName(node: ImportDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; getEnumMemberValue(node: EnumMember): number; - shouldEmitDeclarations(): boolean; + hasSemanticErrors(): boolean; isDeclarationVisible(node: Declaration): boolean; isImplementationOfOverload(node: FunctionDeclaration): boolean; - writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter): void; - writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter): void; - writeSymbol(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, writer: TextWriter): void; + writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isImportDeclarationEntityNameReferenceDeclarationVisibile(entityName: EntityName): SymbolAccessiblityResult; + + // Returns the constant value this property access resolves to, or 'undefined' if it does + // resolve to a constant. + getConstantValue(node: PropertyAccess): number; } export enum SymbolFlags { @@ -690,19 +762,22 @@ module ts { ConstructSignature = 0x00010000, // Construct signature IndexSignature = 0x00020000, // Index signature TypeParameter = 0x00040000, // Type parameter + UnionProperty = 0x00080000, // Property in union type // Export markers (see comment in declareModuleMember in binder) - ExportValue = 0x00080000, // Exported value marker - ExportType = 0x00100000, // Exported type marker - ExportNamespace = 0x00200000, // Exported namespace marker + ExportValue = 0x00100000, // Exported value marker + ExportType = 0x00200000, // Exported type marker + ExportNamespace = 0x00400000, // Exported namespace marker - Import = 0x00400000, // Import - Instantiated = 0x00800000, // Instantiated symbol - Merged = 0x01000000, // Merged symbol (created during program binding) - Transient = 0x02000000, // Transient symbol (created during type check) - Prototype = 0x04000000, // Symbol for the prototype property (without source code representation) + Import = 0x00800000, // Import + Instantiated = 0x01000000, // Instantiated symbol + Merged = 0x02000000, // Merged symbol (created during program binding) + Transient = 0x04000000, // Transient symbol (created during type check) + Prototype = 0x08000000, // Prototype property (no source representation) + Undefined = 0x10000000, // Symbol for the undefined - Value = Variable | Property | EnumMember | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor, + Value = Variable | Property | EnumMember | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor | UnionProperty, + Type = Class | Interface | Enum | TypeLiteral | ObjectLiteral | TypeParameter, Namespace = ValueModule | NamespaceModule, Module = ValueModule | NamespaceModule, @@ -760,6 +835,7 @@ module ts { mapper?: TypeMapper; // Type mapper for instantiation alias referenced?: boolean; // True if alias symbol has been referenced as a value exportAssignSymbol?: Symbol; // Symbol exported from external module + unionType?: UnionType; // Containing union type for union property } export interface TransientSymbol extends Symbol, SymbolLinks { } @@ -769,24 +845,28 @@ module ts { } export enum NodeCheckFlags { - TypeChecked = 0x00000001, // Node has been type checked - LexicalThis = 0x00000002, // Lexical 'this' reference - CaptureThis = 0x00000004, // Lexical 'this' used in body - EmitExtends = 0x00000008, // Emit __extends - SuperInstance = 0x00000010, // Instance 'super' reference - SuperStatic = 0x00000020, // Static 'super' reference - ContextChecked = 0x00000040, // Contextual types have been assigned + TypeChecked = 0x00000001, // Node has been type checked + LexicalThis = 0x00000002, // Lexical 'this' reference + CaptureThis = 0x00000004, // Lexical 'this' used in body + EmitExtends = 0x00000008, // Emit __extends + SuperInstance = 0x00000010, // Instance 'super' reference + SuperStatic = 0x00000020, // Static 'super' reference + ContextChecked = 0x00000040, // Contextual types have been assigned + + // Values for enum members have been computed, and any errors have been reported for them. + EnumValuesComputed = 0x00000080, } export interface NodeLinks { - resolvedType?: Type; // Cached type of type node - resolvedSignature?: Signature; // Cached signature of signature node or call expression - resolvedSymbol?: Symbol; // Cached name resolution result - flags?: NodeCheckFlags; // Set of flags specific to Node - enumMemberValue?: number; // Constant value of enum member + resolvedType?: Type; // Cached type of type node + resolvedSignature?: Signature; // Cached signature of signature node or call expression + resolvedSymbol?: Symbol; // Cached name resolution result + flags?: NodeCheckFlags; // Set of flags specific to Node + enumMemberValue?: number; // Constant value of enum member isIllegalTypeReferenceInConstraint?: boolean; // Is type reference in constraint refers to the type parameter from the same list - isVisible?: boolean; // Is this node visible - localModuleName?: string; // Local name for module instance + isVisible?: boolean; // Is this node visible + localModuleName?: string; // Local name for module instance + assignmentChecks?: Map; // Cache of assignment checks } export enum TypeFlags { @@ -803,13 +883,15 @@ module ts { Class = 0x00000400, // Class Interface = 0x00000800, // Interface Reference = 0x00001000, // Generic type reference - Anonymous = 0x00002000, // Anonymous - FromSignature = 0x00004000, // Created for signature assignment check + Tuple = 0x00002000, // Tuple + Union = 0x00004000, // Union + Anonymous = 0x00008000, // Anonymous + FromSignature = 0x00010000, // Created for signature assignment check - Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null, + Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null, StringLike = String | StringLiteral, NumberLike = Number | Enum, - ObjectType = Class | Interface | Reference | Anonymous + ObjectType = Class | Interface | Reference | Tuple | Union | Anonymous, } // Properties common to all types @@ -862,6 +944,15 @@ module ts { openReferenceChecks: Map; // Open type reference check cache } + export interface TupleType extends ObjectType { + elementTypes: Type[]; // Element types + baseArrayType: TypeReference; // Array where T is best common type of element types + } + + export interface UnionType extends ObjectType { + types: Type[]; // Constituent types + } + // Resolved object type export interface ResolvedObjectType extends ObjectType { members: SymbolTable; // Properties by name @@ -891,9 +982,10 @@ module ts { resolvedReturnType: Type; // Resolved return type minArgumentCount: number; // Number of non-optional parameters hasRestParameter: boolean; // True if last parameter is rest parameter - hasStringLiterals: boolean; // True if instantiated + hasStringLiterals: boolean; // True if specialized target?: Signature; // Instantiation target mapper?: TypeMapper; // Instantiation mapper + unionSignatures?: Signature[]; // Underlying signatures of a union signature erasedSignatureCache?: Signature; // Erased version of signature (deferred) isolatedSignatureType?: ObjectType; // A manufactured type that just contains the signature for purposes of signature comparison } @@ -908,9 +1000,10 @@ module ts { } export interface InferenceContext { - typeParameters: TypeParameter[]; - inferences: Type[][]; - inferredTypes: Type[]; + typeParameters: TypeParameter[]; // Type parameters for which inferences are made + inferenceCount: number; // Incremented for every inference made (whether new or not) + inferences: Type[][]; // Inferences made for each type parameter + inferredTypes: Type[]; // Inferred type for each type parameter } export interface DiagnosticMessage { @@ -977,6 +1070,15 @@ module ts { AMD, } + export interface LineAndCharacter { + line: number; + /* + * This value denotes the character position in line and is different from the 'column' because of tab characters. + */ + character: number; + } + + export enum ScriptTarget { ES3, ES5, @@ -1131,6 +1233,31 @@ module ts { verticalTab = 0x0B, // \v } + export enum SymbolDisplayPartKind { + aliasName, + className, + enumName, + fieldName, + interfaceName, + keyword, + lineBreak, + numericLiteral, + stringLiteral, + localName, + methodName, + moduleName, + operator, + parameterName, + propertyName, + punctuation, + space, + text, + typeParameterName, + enumMemberName, + functionName, + regularExpressionLiteral, + } + export interface CancellationToken { isCancellationRequested(): boolean; } diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index e6d171a9780..6e211892437 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -156,10 +156,7 @@ class CompilerBaselineRunner extends RunnerBase { return file.writeByteOrderMark ? "\u00EF\u00BB\u00BF" : ""; } - function getErrorBaseline(toBeCompiled: { unitName: string; content: string }[], - otherFiles: { unitName: string; content: string }[], - result: Harness.Compiler.CompilerResult - ) { + function getErrorBaseline(toBeCompiled: { unitName: string; content: string }[], otherFiles: { unitName: string; content: string }[], result: Harness.Compiler.CompilerResult) { return Harness.Compiler.getErrorBaseline(toBeCompiled.concat(otherFiles), result.errors); } @@ -168,7 +165,7 @@ class CompilerBaselineRunner extends RunnerBase { if (this.errors) { Harness.Baseline.runBaseline('Correct errors for ' + fileName, justName.replace(/\.ts$/, '.errors.txt'), (): string => { if (result.errors.length === 0) return null; - + return getErrorBaseline(toBeCompiled, otherFiles, result); }); } diff --git a/src/harness/external/es5compat.js b/src/harness/external/es5compat.js deleted file mode 100644 index 0fa88ee3685..00000000000 --- a/src/harness/external/es5compat.js +++ /dev/null @@ -1,225 +0,0 @@ -if (!String.prototype.trim) { - String.prototype.trim = function () { - return this.replace(/^\s+|\s+$/g, ''); - }; -} - -if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function (searchElement, fromIndex) { - "use strict"; - if (this == null) { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - if (len === 0) { - return -1; - } - var n = 0; - if (arguments.length > 0) { - n = Number(arguments[1]); - if (n != n) { - n = 0; - } else if (n != 0 && n != Infinity && n != -Infinity) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - } - if (n >= len) { - return -1; - } - var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); - for (; k < len; k++) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - }; -} - -if (!Array.prototype.filter) { - Array.prototype.filter = function (fun, thisp) { - "use strict"; - - if (this == null) - throw new TypeError(); - - var t = Object(this); - var len = t.length >>> 0; - if (typeof fun != "function") - throw new TypeError(); - - var res = []; - for (var i = 0; i < len; i++) { - if (i in t) { - var val = t[i]; - if (fun.call(thisp, val, i, t)) - res.push(val); - } - } - - return res; - }; -} - -if (!Array.prototype.map) { - Array.prototype.map = function (callback, thisArg) { - var T = undefined, A, k; - - if (this == null) { - throw new TypeError(" this is null or not defined"); - } - - // 1. Let O be the result of calling ToObject passing the |this| value as the argument. - var O = Object(this); - - // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". - // 3. Let len be ToUint32(lenValue). - var len = O.length >>> 0; - - if ({}.toString.call(callback) != "[object Function]") { - throw new TypeError(callback + " is not a function"); - } - - if (thisArg) { - T = thisArg; - } - - // 6. Let A be a new array created as if by the expression new Array(len) where Array is - // the standard built-in constructor with that name and len is the value of len. - A = new Array(len); - - // 7. Let k be 0 - k = 0; - - while (k < len) { - var kValue, mappedValue; - - if (k in O) { - // i. Let kValue be the result of calling the Get internal method of O with argument Pk. - kValue = O[k]; - - // ii. Let mappedValue be the result of calling the Call internal method of callback - // with T as the this value and argument list containing kValue, k, and O. - mappedValue = callback.call(T, kValue, k, O); - - // iii. Call the DefineOwnProperty internal method of A with arguments - // Pk, Property Descriptor {Value: mappedValue, : true, Enumerable: true, Configurable: true}, - // and false. - // In browsers that support Object.defineProperty, use the following: - // Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true }); - // For best browser support, use the following: - A[k] = mappedValue; - } - - // d. Increase k by 1. - k++; - } - - // 9. return A - return A; - }; -} - -if (!Array.prototype.reduce) { - Array.prototype.reduce = function reduce(accumulator) { - if (this === null || this === undefined) - throw new TypeError("Object is null or undefined"); - var i = 0, l = this.length >> 0, curr; - - if (typeof accumulator !== "function") - throw new TypeError("First argument is not callable"); - - if (arguments.length < 2) { - if (l === 0) - throw new TypeError("Array length is 0 and no second argument"); - curr = this[0]; - i = 1; - } else - curr = arguments[1]; - - while (i < l) { - if (i in this) - curr = accumulator.call(undefined, curr, this[i], i, this); - ++i; - } - - return curr; - }; -} - -if (!Array.prototype.forEach) { - Array.prototype.forEach = function (callback, thisArg) { - var T, k; - - if (this == null) { - throw new TypeError(" this is null or not defined"); - } - - // 1. Let O be the result of calling ToObject passing the |this| value as the argument. - var O = Object(this); - - // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". - // 3. Let len be ToUint32(lenValue). - var len = O.length >>> 0; - - if ({}.toString.call(callback) != "[object Function]") { - throw new TypeError(callback + " is not a function"); - } - - if (thisArg) { - T = thisArg; - } else { - T = undefined; - } - - // 6. Let k be 0 - k = 0; - - while (k < len) { - var kValue; - - if (k in O) { - // i. Let kValue be the result of calling the Get internal method of O with argument Pk. - kValue = O[k]; - - // ii. Call the Call internal method of callback with T as the this value and - // argument list containing kValue, k, and O. - callback.call(T, kValue, k, O); - } - - // d. Increase k by 1. - k++; - } - // 8. return undefined - }; -} - -if (!Date.now) { - Date.now = function () { - return (new Date()).getTime(); - }; -} - -if (!Array.prototype.some) { - Array.prototype.some = function (fun/*, thisp */ ) { - "use strict"; - - if (this == null) - throw new TypeError(); - - var t = Object(this); - var len = t.length >>> 0; - if (typeof fun != "function") - throw new TypeError(); - - var thisp = arguments[1]; - for (var i = 0; i < len; i++) { - var idx = i.toString(); - if (idx in t && fun.call(thisp, t[i], i, t)) - return true; - } - - return false; - }; -} diff --git a/src/harness/external/es5compat.ts b/src/harness/external/es5compat.ts deleted file mode 100644 index 1cd6a50905a..00000000000 --- a/src/harness/external/es5compat.ts +++ /dev/null @@ -1,354 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/*----------------- ThirdPartyNotices ------------------------------------------------------- - -This file is based on or incorporates material from the projects listed below -(collectively "Third Party Code"). Microsoft is not the original author of the -Third Party Code. The original copyright notice and the license, under which -Microsoft received such Third Party Code, are set forth below. Such license and -notices are provided for informational purposes only. Microsoft licenses the Third -Party Code to you under the terms of the Apache 2.0 License. - --- -Array filter Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter - -Array forEach Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach - -Array indexOf Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf - -Array map Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map - -Array Reduce Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce - -Array some Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some - -String Trim Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim - -Date now Compatibility Method, -Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now - -Copyright (c) 2007 - 2012 Mozilla Developer Network and individual contributors - -Licensed by Microsoft under the Apache License, Version 2.0 (the "License"); you -may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR -CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions and -limitations under the License. - --- -Original License provided for Informational Purposes Only -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -------------- End of ThirdPartyNotices --------------------------------------------------- */ - - -// Compatibility with non ES5 compliant engines -if (!String.prototype.trim) { - String.prototype.trim = function() { - return this.replace(/^\s+|\s+$/g, ''); - }; -} - -// Compatibility with non ES5 compliant engines -if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function (searchElement: any, fromIndex?: any) { - "use strict"; - if (this == null) { - throw new TypeError(); - } - var t = Object(this); - var len: any = t.length >>> 0; - if (len === 0) { - return -1; - } - var n: any = 0; - if (arguments.length > 0) { - n = Number(arguments[1]); - if (n != n) { // shortcut for verifying if it's NaN - n = 0; - } - else if (n != 0 && n != Infinity && n != -Infinity) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - } - if (n >= len) { - return -1; - } - var k: any = n >= 0 ? n : Math.max(len - Math.abs(n), 0); - for (; k < len; k++) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - } -} - -if (!Array.prototype.filter) -{ - Array.prototype.filter = function(fun: any, thisp?: any) - { - "use strict"; - - if (this == null) - throw new TypeError(); - - var t = Object(this); - var len = t.length >>> 0; - if (typeof fun != "function") - throw new TypeError(); - - var res: any[] = []; - for (var i = 0; i < len; i++) - { - if (i in t) - { - var val = t[i]; // in case fun mutates this - if (fun.call(thisp, val, i, t)) - res.push(val); - } - } - - return res; - }; -} - -// Production steps of ECMA-262, Edition 5, 15.4.4.19 -// Reference: http://es5.github.com/#x15.4.4.19 -if (!Array.prototype.map) { - Array.prototype.map = function(callback: any, thisArg?: any) { - - var T: any = undefined, A: any, k: any; - - if (this == null) { - throw new TypeError(" this is null or not defined"); - } - - // 1. Let O be the result of calling ToObject passing the |this| value as the argument. - var O = Object(this); - - // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". - // 3. Let len be ToUint32(lenValue). - var len = O.length >>> 0; - - // 4. If IsCallable(callback) is false, throw a TypeError exception. - // See: http://es5.github.com/#x9.11 - if ({}.toString.call(callback) != "[object Function]") { - throw new TypeError(callback + " is not a function"); - } - - // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. - if (thisArg) { - T = thisArg; - } - - // 6. Let A be a new array created as if by the expression new Array(len) where Array is - // the standard built-in constructor with that name and len is the value of len. - A = new Array(len); - - // 7. Let k be 0 - k = 0; - - // 8. Repeat, while k < len - while(k < len) { - - var kValue: any, mappedValue: any; - - // a. Let Pk be ToString(k). - // This is implicit for LHS operands of the in operator - // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk. - // This step can be combined with c - // c. If kPresent is true, then - if (k in O) { - - // i. Let kValue be the result of calling the Get internal method of O with argument Pk. - kValue = O[ k ]; - - // ii. Let mappedValue be the result of calling the Call internal method of callback - // with T as the this value and argument list containing kValue, k, and O. - mappedValue = callback.call(T, kValue, k, O); - - // iii. Call the DefineOwnProperty internal method of A with arguments - // Pk, Property Descriptor {Value: mappedValue, : true, Enumerable: true, Configurable: true}, - // and false. - - // In browsers that support Object.defineProperty, use the following: - // Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true }); - - // For best browser support, use the following: - A[ k ] = mappedValue; - } - // d. Increase k by 1. - k++; - } - - // 9. return A - return A; - }; -} - -if (!Array.prototype.reduce) { - Array.prototype.reduce = function reduce(accumulator: any){ - if (this===null || this===undefined) throw new TypeError("Object is null or undefined"); - var i = 0, l = this.length >> 0, curr: any; - - if(typeof accumulator !== "function") // ES5 : "If IsCallable(callbackfn) is false, throw a TypeError exception." - throw new TypeError("First argument is not callable"); - - if(arguments.length < 2) { - if (l === 0) throw new TypeError("Array length is 0 and no second argument"); - curr = this[0]; - i = 1; // start accumulating at the second element - } - else - curr = arguments[1]; - - while (i < l) { - if(i in this) curr = accumulator.call(undefined, curr, this[i], i, this); - ++i; - } - - return curr; - }; -} - -// Compatibility with non ES5 compliant engines -// Production steps of ECMA-262, Edition 5, 15.4.4.18 -// Reference: http://es5.github.com/#x15.4.4.18 -if (!Array.prototype.forEach) { - Array.prototype.forEach = function(callback: any, thisArg?: any) { - - var T: any, k: any; - - if (this == null) { - throw new TypeError(" this is null or not defined"); - } - - // 1. Let O be the result of calling ToObject passing the |this| value as the argument. - var O = Object(this); - - // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". - // 3. Let len be ToUint32(lenValue). - var len = O.length >>> 0; // Hack to convert O.length to a UInt32 - - // 4. If IsCallable(callback) is false, throw a TypeError exception. - // See: http://es5.github.com/#x9.11 - if ({ }.toString.call(callback) != "[object Function]") { - throw new TypeError(callback + " is not a function"); - } - - // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. - if (thisArg) { - T = thisArg; - } - else { - T = undefined; // added to stop definite assignment error - } - - // 6. Let k be 0 - k = 0; - - // 7. Repeat, while k < len - while (k < len) { - - var kValue: any; - - // a. Let Pk be ToString(k). - // This is implicit for LHS operands of the in operator - // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk. - // This step can be combined with c - // c. If kPresent is true, then - if (k in O) { - - // i. Let kValue be the result of calling the Get internal method of O with argument Pk. - kValue = O[k]; - - // ii. Call the Call internal method of callback with T as the this value and - // argument list containing kValue, k, and O. - callback.call(T, kValue, k, O); - } - // d. Increase k by 1. - k++; - } - // 8. return undefined - }; -} - -// Compatibility with non ES5 compliant engines -if (!Date.now) { - Date.now = function() { - return (new Date()).getTime(); - }; -} - -// Compatibility with non ES5 compliant engines -// Production steps of ECMA-262, Edition 5.1, 15.4.4.17 -if (!Array.prototype.some) -{ - Array.prototype.some = function(fun: any /*, thisp */) - { - "use strict"; - - if (this == null) - throw new TypeError(); - - var t = Object(this); - var len = t.length >>> 0; - if (typeof fun != "function") - throw new TypeError(); - - var thisp = arguments[1]; - for (var i = 0; i < len; i++) - { - var idx = i.toString(); // REVIEW: this line is not from the Mozilla page, necessary to avoid our compile time checks against non-string/any types in an in expression - if (idx in t && fun.call(thisp, t[i], i, t)) - return true; - } - - return false; - }; -} \ No newline at end of file diff --git a/src/harness/external/json2.js b/src/harness/external/json2.js deleted file mode 100644 index 0fe3388d253..00000000000 --- a/src/harness/external/json2.js +++ /dev/null @@ -1,486 +0,0 @@ -/* - json2.js - 2013-05-26 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - See http://www.JSON.org/js.html - - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. - - - This file creates a global JSON object containing two methods: stringify - and parse. - - JSON.stringify(value, replacer, space) - value any JavaScript value, usually an object or array. - - replacer an optional parameter that determines how object - values are stringified for objects. It can be a - function or an array of strings. - - space an optional parameter that specifies the indentation - of nested structures. If it is omitted, the text will - be packed without extra whitespace. If it is a number, - it will specify the number of spaces to indent at each - level. If it is a string (such as '\t' or ' '), - it contains the characters used to indent at each level. - - This method produces a JSON text from a JavaScript value. - - When an object value is found, if the object contains a toJSON - method, its toJSON method will be called and the result will be - stringified. A toJSON method does not serialize: it returns the - value represented by the name/value pair that should be serialized, - or undefined if nothing should be serialized. The toJSON method - will be passed the key associated with the value, and this will be - bound to the value - - For example, this would serialize Dates as ISO strings. - - Date.prototype.toJSON = function (key) { - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - return this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z'; - }; - - You can provide an optional replacer method. It will be passed the - key and value of each member, with this bound to the containing - object. The value that is returned from your method will be - serialized. If your method returns undefined, then the member will - be excluded from the serialization. - - If the replacer parameter is an array of strings, then it will be - used to select the members to be serialized. It filters the results - such that only members with keys listed in the replacer array are - stringified. - - Values that do not have JSON representations, such as undefined or - functions, will not be serialized. Such values in objects will be - dropped; in arrays they will be replaced with null. You can use - a replacer function to replace those with JSON values. - JSON.stringify(undefined) returns undefined. - - The optional space parameter produces a stringification of the - value that is filled with line breaks and indentation to make it - easier to read. - - If the space parameter is a non-empty string, then that string will - be used for indentation. If the space parameter is a number, then - the indentation will be that many spaces. - - Example: - - text = JSON.stringify(['e', {pluribus: 'unum'}]); - // text is '["e",{"pluribus":"unum"}]' - - - text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); - // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' - - text = JSON.stringify([new Date()], function (key, value) { - return this[key] instanceof Date ? - 'Date(' + this[key] + ')' : value; - }); - // text is '["Date(---current time---)"]' - - - JSON.parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = JSON.parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { - var d; - if (typeof value === 'string' && - value.slice(0, 5) === 'Date(' && - value.slice(-1) === ')') { - d = new Date(value.slice(5, -1)); - if (d) { - return d; - } - } - return value; - }); - - - This is a reference implementation. You are free to copy, modify, or - redistribute. -*/ - -/*jslint evil: true, regexp: true */ - -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, - getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, - lastIndex, length, parse, prototype, push, replace, slice, stringify, - test, toJSON, toString, valueOf -*/ - - -// Create a JSON object only if one does not already exist. We create the -// methods in a closure to avoid creating global variables. - -if (typeof JSON !== 'object') { - JSON = {}; -} - -(function () { - 'use strict'; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - if (typeof Date.prototype.toJSON !== 'function') { - - Date.prototype.toJSON = function () { - - return isFinite(this.valueOf()) - ? this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z' - : null; - }; - - String.prototype.toJSON = - Number.prototype.toJSON = - Boolean.prototype.toJSON = function () { - return this.valueOf(); - }; - } - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - - - function quote(string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' - ? c - : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; - } - - - function str(key, holder) { - -// Produce a string from holder[key]. - - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key]; - -// If the value has a toJSON method, call it to obtain a replacement value. - - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - -// If we were called with a replacer function, then call the replacer to -// obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - -// What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - return quote(value); - - case 'number': - -// JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - -// If the value is a boolean or null, convert it to a string. Note: -// typeof null does not produce 'null'. The case is included here in -// the remote chance that this gets fixed someday. - - return String(value); - -// If the type is 'object', we might be dealing with an object or an array or -// null. - - case 'object': - -// Due to a specification blunder in ECMAScript, typeof null is 'object', -// so watch out for that case. - - if (!value) { - return 'null'; - } - -// Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - -// Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - -// The value is an array. Stringify every element. Use null as a placeholder -// for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - -// Join all of the elements together, separated with commas, and wrap them in -// brackets. - - v = partial.length === 0 - ? '[]' - : gap - ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' - : '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - -// If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - if (typeof rep[i] === 'string') { - k = rep[i]; - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - -// Otherwise, iterate through all of the keys in the object. - - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - -// Join all of the member texts together, separated with commas, -// and wrap them in braces. - - v = partial.length === 0 - ? '{}' - : gap - ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' - : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - -// If the JSON object does not yet have a stringify method, give it one. - - if (typeof JSON.stringify !== 'function') { - JSON.stringify = function (value, replacer, space) { - -// The stringify method takes a value and an optional replacer, and an optional -// space parameter, and returns a JSON text. The replacer can be a function -// that can replace values, or an array of strings that will select the keys. -// A default replacer method can be provided. Use of the space parameter can -// produce text that is more easily readable. - - var i; - gap = ''; - indent = ''; - -// If the space parameter is a number, make an indent string containing that -// many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - -// If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - -// If there is a replacer, it must be a function or an array. -// Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - -// Make a fake root object containing our value under the key of ''. -// Return the result of stringifying the value. - - return str('', {'': value}); - }; - } - - -// If the JSON object does not yet have a parse method, give it one. - - if (typeof JSON.parse !== 'function') { - JSON.parse = function (text, reviver) { - -// The parse method takes a text and an optional reviver function, and returns -// a JavaScript value if the text is a valid JSON text. - - var j; - - function walk(holder, key) { - -// The walk method is used to recursively walk the resulting structure so -// that modifications can be made. - - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - } - - -// Parsing happens in four stages. In the first stage, we replace certain -// Unicode characters with escape sequences. JavaScript handles many characters -// incorrectly, either silently deleting them, or treating them as line endings. - - text = String(text); - cx.lastIndex = 0; - if (cx.test(text)) { - text = text.replace(cx, function (a) { - return '\\u' + - ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - -// In the second stage, we run the text against regular expressions that look -// for non-JSON patterns. We are especially concerned with '()' and 'new' -// because they can cause invocation, and '=' because it can cause mutation. -// But just to be safe, we want to reject all unexpected forms. - -// We split the second stage into 4 regexp operations in order to work around -// crippling inefficiencies in IE's and Safari's regexp engines. First we -// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we -// replace all simple value tokens with ']' characters. Third, we delete all -// open brackets that follow a colon or comma or that begin the text. Finally, -// we look to see that the remaining characters are only whitespace or ']' or -// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - if (/^[\],:{}\s]*$/ - .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') - .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - -// In the third stage we use the eval function to compile the text into a -// JavaScript structure. The '{' operator is subject to a syntactic ambiguity -// in JavaScript: it can begin a block or an object literal. We wrap the text -// in parens to eliminate the ambiguity. - - j = eval('(' + text + ')'); - -// In the optional fourth stage, we recursively walk the new structure, passing -// each name/value pair to a reviver function for possible transformation. - - return typeof reviver === 'function' - ? walk({'': j}, '') - : j; - } - -// If the text is not JSON parseable, then a SyntaxError is thrown. - - throw new SyntaxError('JSON.parse'); - }; - } -}()); diff --git a/src/harness/external/json2.ts b/src/harness/external/json2.ts deleted file mode 100644 index 4645a0476af..00000000000 --- a/src/harness/external/json2.ts +++ /dev/null @@ -1,486 +0,0 @@ -/* - json2.js - 2013-05-26 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - See http://www.JSON.org/js.html - - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. - - - This file creates a global JSON object containing two methods: stringify - and parse. - - JSON.stringify(value, replacer, space) - value any JavaScript value, usually an object or array. - - replacer an optional parameter that determines how object - values are stringified for objects. It can be a - function or an array of strings. - - space an optional parameter that specifies the indentation - of nested structures. If it is omitted, the text will - be packed without extra whitespace. If it is a number, - it will specify the number of spaces to indent at each - level. If it is a string (such as '\t' or ' '), - it contains the characters used to indent at each level. - - This method produces a JSON text from a JavaScript value. - - When an object value is found, if the object contains a toJSON - method, its toJSON method will be called and the result will be - stringified. A toJSON method does not serialize: it returns the - value represented by the name/value pair that should be serialized, - or undefined if nothing should be serialized. The toJSON method - will be passed the key associated with the value, and this will be - bound to the value - - For example, this would serialize Dates as ISO strings. - - Date.prototype.toJSON = function (key) { - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - return this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z'; - }; - - You can provide an optional replacer method. It will be passed the - key and value of each member, with this bound to the containing - object. The value that is returned from your method will be - serialized. If your method returns undefined, then the member will - be excluded from the serialization. - - If the replacer parameter is an array of strings, then it will be - used to select the members to be serialized. It filters the results - such that only members with keys listed in the replacer array are - stringified. - - Values that do not have JSON representations, such as undefined or - functions, will not be serialized. Such values in objects will be - dropped; in arrays they will be replaced with null. You can use - a replacer function to replace those with JSON values. - JSON.stringify(undefined) returns undefined. - - The optional space parameter produces a stringification of the - value that is filled with line breaks and indentation to make it - easier to read. - - If the space parameter is a non-empty string, then that string will - be used for indentation. If the space parameter is a number, then - the indentation will be that many spaces. - - Example: - - text = JSON.stringify(['e', {pluribus: 'unum'}]); - // text is '["e",{"pluribus":"unum"}]' - - - text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); - // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' - - text = JSON.stringify([new Date()], function (key, value) { - return this[key] instanceof Date ? - 'Date(' + this[key] + ')' : value; - }); - // text is '["Date(---current time---)"]' - - - JSON.parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = JSON.parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { - var d; - if (typeof value === 'string' && - value.slice(0, 5) === 'Date(' && - value.slice(-1) === ')') { - d = new Date(value.slice(5, -1)); - if (d) { - return d; - } - } - return value; - }); - - - This is a reference implementation. You are free to copy, modify, or - redistribute. -*/ - -/*jslint evil: true, regexp: true */ - -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, - getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, - lastIndex, length, parse, prototype, push, replace, slice, stringify, - test, toJSON, toString, valueOf -*/ - - -// Create a JSON object only if one does not already exist. We create the -// methods in a closure to avoid creating global variables. - -if (typeof JSON !== 'object') { - JSON = {}; -} - -(function () { - 'use strict'; - - function f(n: any) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - if (typeof Date.prototype.toJSON !== 'function') { - - Date.prototype.toJSON = function () { - - return isFinite(this.valueOf()) - ? this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z' - : null; - }; - - (String.prototype).toJSON = - (Number.prototype).toJSON = - (Boolean.prototype).toJSON = function () { - return this.valueOf(); - }; - } - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap: any, - indent: any, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep: any; - - - function quote(string: string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' - ? c - : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; - } - - - function str(key: any, holder: any) { - -// Produce a string from holder[key]. - - var i: any, // The loop counter. - k: any, // The member key. - v: any, // The member value. - length: number, - mind = gap, - partial: any, - value = holder[key]; - -// If the value has a toJSON method, call it to obtain a replacement value. - - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - -// If we were called with a replacer function, then call the replacer to -// obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - -// What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - return quote(value); - - case 'number': - -// JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - -// If the value is a boolean or null, convert it to a string. Note: -// typeof null does not produce 'null'. The case is included here in -// the remote chance that this gets fixed someday. - - return String(value); - -// If the type is 'object', we might be dealing with an object or an array or -// null. - - case 'object': - -// Due to a specification blunder in ECMAScript, typeof null is 'object', -// so watch out for that case. - - if (!value) { - return 'null'; - } - -// Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - -// Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - -// The value is an array. Stringify every element. Use null as a placeholder -// for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - -// Join all of the elements together, separated with commas, and wrap them in -// brackets. - - v = partial.length === 0 - ? '[]' - : gap - ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' - : '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - -// If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - if (typeof rep[i] === 'string') { - k = rep[i]; - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - -// Otherwise, iterate through all of the keys in the object. - - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - -// Join all of the member texts together, separated with commas, -// and wrap them in braces. - - v = partial.length === 0 - ? '{}' - : gap - ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' - : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - -// If the JSON object does not yet have a stringify method, give it one. - - if (typeof JSON.stringify !== 'function') { - JSON.stringify = function (value: any, replacer: any, space: any) { - -// The stringify method takes a value and an optional replacer, and an optional -// space parameter, and returns a JSON text. The replacer can be a function -// that can replace values, or an array of strings that will select the keys. -// A default replacer method can be provided. Use of the space parameter can -// produce text that is more easily readable. - - var i: any; - gap = ''; - indent = ''; - -// If the space parameter is a number, make an indent string containing that -// many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - -// If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - -// If there is a replacer, it must be a function or an array. -// Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - -// Make a fake root object containing our value under the key of ''. -// Return the result of stringifying the value. - - return str('', {'': value}); - }; - } - - -// If the JSON object does not yet have a parse method, give it one. - - if (typeof JSON.parse !== 'function') { - JSON.parse = function (text, reviver) { - -// The parse method takes a text and an optional reviver function, and returns -// a JavaScript value if the text is a valid JSON text. - - var j: any; - - function walk(holder: any, key: any) { - -// The walk method is used to recursively walk the resulting structure so -// that modifications can be made. - - var k: any, v: any, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - } - - -// Parsing happens in four stages. In the first stage, we replace certain -// Unicode characters with escape sequences. JavaScript handles many characters -// incorrectly, either silently deleting them, or treating them as line endings. - - text = String(text); - cx.lastIndex = 0; - if (cx.test(text)) { - text = text.replace(cx, function (a) { - return '\\u' + - ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - -// In the second stage, we run the text against regular expressions that look -// for non-JSON patterns. We are especially concerned with '()' and 'new' -// because they can cause invocation, and '=' because it can cause mutation. -// But just to be safe, we want to reject all unexpected forms. - -// We split the second stage into 4 regexp operations in order to work around -// crippling inefficiencies in IE's and Safari's regexp engines. First we -// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we -// replace all simple value tokens with ']' characters. Third, we delete all -// open brackets that follow a colon or comma or that begin the text. Finally, -// we look to see that the remaining characters are only whitespace or ']' or -// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - if (/^[\],:{}\s]*$/ - .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') - .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - -// In the third stage we use the eval function to compile the text into a -// JavaScript structure. The '{' operator is subject to a syntactic ambiguity -// in JavaScript: it can begin a block or an object literal. We wrap the text -// in parens to eliminate the ambiguity. - - j = eval('(' + text + ')'); - -// In the optional fourth stage, we recursively walk the new structure, passing -// each name/value pair to a reviver function for possible transformation. - - return typeof reviver === 'function' - ? walk({'': j}, '') - : j; - } - -// If the text is not JSON parseable, then a SyntaxError is thrown. - - throw new SyntaxError('JSON.parse'); - }; - } -}()); diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c571a7d9f94..9dad3dddf60 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -122,11 +122,76 @@ module FourSlash { return s.replace(/[&<>"'\/]/g, ch => entityMap[ch]); } + // Name of testcase metadata including ts.CompilerOptions properties that will be used by globalOptions + // To add additional option, add property into the testOptMetadataNames, refer the property in either globalMetadataNames or fileMetadataNames + // Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data + var testOptMetadataNames = { + baselineFile: 'BaselineFile', + declaration: 'declaration', + emitThisFile: 'emitThisFile', // This flag is used for testing getEmitOutput feature. It allows test-cases to indicate what file to be output in multiple files project + filename: 'Filename', + mapRoot: 'mapRoot', + module: 'module', + out: 'out', + outDir: 'outDir', + sourceMap: 'sourceMap', + sourceRoot: 'sourceRoot', + }; + // List of allowed metadata names - var fileMetadataNames = ['Filename']; - var globalMetadataNames = ['Module', 'Target', 'BaselineFile']; // Note: Only BaselineFile is actually supported at the moment + var fileMetadataNames = [testOptMetadataNames.filename, testOptMetadataNames.emitThisFile]; + var globalMetadataNames = [testOptMetadataNames.baselineFile, testOptMetadataNames.declaration, + testOptMetadataNames.mapRoot, testOptMetadataNames.module, testOptMetadataNames.out, + testOptMetadataNames.outDir, testOptMetadataNames.sourceMap, testOptMetadataNames.sourceRoot] + + function convertGlobalOptionsToCompilationSettings(globalOptions: { [idx: string]: string }): ts.CompilationSettings { + var settings: ts.CompilationSettings = {}; + // Convert all property in globalOptions into ts.CompilationSettings + for (var prop in globalOptions) { + if (globalOptions.hasOwnProperty(prop)) { + switch (prop) { + case testOptMetadataNames.declaration: + settings.generateDeclarationFiles = true; + break; + case testOptMetadataNames.mapRoot: + settings.mapRoot = globalOptions[prop]; + break; + case testOptMetadataNames.module: + // create appropriate external module target for CompilationSettings + switch (globalOptions[prop]) { + case "AMD": + settings.moduleGenTarget = ts.ModuleGenTarget.Asynchronous; + break; + case "CommonJS": + settings.moduleGenTarget = ts.ModuleGenTarget.Synchronous; + break; + default: + settings.moduleGenTarget = ts.ModuleGenTarget.Unspecified; + break; + } + break; + case testOptMetadataNames.out: + settings.outFileOption = globalOptions[prop]; + break; + case testOptMetadataNames.outDir: + settings.outDirOption = globalOptions[prop]; + break; + case testOptMetadataNames.sourceMap: + settings.mapSourceFiles = true; + break; + case testOptMetadataNames.sourceRoot: + settings.sourceRoot = globalOptions[prop]; + break; + } + } + } + return settings; + } export var currentTestState: TestState = null; + function assertionMessage(msg: string) { + return "\nMarker: " + currentTestState.lastKnownMarker + "\nChecking: " + msg + "\n\n"; + } export class TestCancellationToken implements ts.CancellationToken { // 0 - cancelled @@ -199,11 +264,15 @@ module FourSlash { private scenarioActions: string[] = []; private taoInvalidReason: string = null; + constructor(public testData: FourSlashData) { // Initialize the language service with all the scripts this.cancellationToken = new TestCancellationToken(); this.languageServiceShimHost = new Harness.LanguageService.TypeScriptLS(this.cancellationToken); + var compilationSettings = convertGlobalOptionsToCompilationSettings(this.testData.globalOptions); + this.languageServiceShimHost.setCompilationSettings(compilationSettings); + var inputFiles: { unitName: string; content: string }[] = []; testData.files.forEach(file => { @@ -220,9 +289,9 @@ module FourSlash { //if (/require\(/.test(lastFile.content) || /reference\spath/.test(lastFile.content)) { // inputFiles.push({ unitName: lastFile.fileName, content: lastFile.content }); //} else { - inputFiles = testData.files.map(file => { - return { unitName: file.fileName, content: file.content }; - }); + inputFiles = testData.files.map(file => { + return { unitName: file.fileName, content: file.content }; + }); //} @@ -346,6 +415,15 @@ module FourSlash { } } + private raiseError(message: string) { + message = this.messageAtLastKnownMarker(message); + throw new Error(message); + } + + private messageAtLastKnownMarker(message: string) { + return "Marker: " + currentTestState.lastKnownMarker + "\n" + message; + } + private getDiagnostics(fileName: string): ts.Diagnostic[] { var syntacticErrors = this.languageService.getSyntacticDiagnostics(fileName); var semanticErrors = this.languageService.getSemanticDiagnostics(fileName); @@ -434,7 +512,7 @@ module FourSlash { this.printErrorLog(false, errors); var errorMsg = "Actual number of errors (" + actual + ") does not match expected number (" + expected + ")"; Harness.IO.log(errorMsg); - throw new Error(errorMsg); + this.raiseError(errorMsg); } } @@ -448,24 +526,24 @@ module FourSlash { var evaluation = new Function(emit.outputFiles[0].text + ';\r\nreturn (' + expr + ');')(); if (evaluation !== value) { - throw new Error('Expected evaluation of expression "' + expr + '" to equal "' + value + '", but got "' + evaluation + '"'); + this.raiseError('Expected evaluation of expression "' + expr + '" to equal "' + value + '", but got "' + evaluation + '"'); } } - public verifyMemberListContains(symbol: string, type?: string, docComment?: string, fullSymbolName?: string, kind?: string) { + public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) { this.scenarioActions.push(''); this.scenarioActions.push(''); - if (type || docComment || fullSymbolName || kind) { + if (text || documentation || kind) { this.taoInvalidReason = 'verifyMemberListContains only supports the "symbol" parameter'; } var members = this.getMemberListAtCaret(); if (members) { - this.assertItemInCompletionList(members.entries, symbol, type, docComment, fullSymbolName, kind); + this.assertItemInCompletionList(members.entries, symbol, text, documentation, kind); } else { - throw new Error("Expected a member list, but none was provided"); + this.raiseError("Expected a member list, but none was provided"); } } @@ -488,11 +566,11 @@ module FourSlash { var match = members.entries.length === expectedCount; if ((!match && !negative) || (match && negative)) { - throw new Error("Member list count was " + members.entries.length + ". Expected " + expectedCount); + this.raiseError("Member list count was " + members.entries.length + ". Expected " + expectedCount); } } else if (expectedCount) { - throw new Error("Member list count was 0. Expected " + expectedCount); + this.raiseError("Member list count was 0. Expected " + expectedCount); } } @@ -502,7 +580,7 @@ module FourSlash { var members = this.getMemberListAtCaret(); if (members.entries.filter(e => e.name === symbol).length !== 0) { - throw new Error('Member list did contain ' + symbol); + this.raiseError('Member list did contain ' + symbol); } } @@ -513,7 +591,7 @@ module FourSlash { var itemsCount = completions.entries.length; if (itemsCount <= count) { - throw new Error('Expected completion list items count to be greater than ' + count + ', but is actually ' + itemsCount); + this.raiseError('Expected completion list items count to be greater than ' + count + ', but is actually ' + itemsCount); } } @@ -526,7 +604,7 @@ module FourSlash { var members = this.getMemberListAtCaret(); if ((!members || members.entries.length === 0) && negative) { - throw new Error("Member list is empty at Caret"); + this.raiseError("Member list is empty at Caret"); } else if ((members && members.entries.length !== 0) && !negative) { var errorMsg = "\n" + "Member List contains: [" + members.entries[0].name; @@ -536,7 +614,7 @@ module FourSlash { errorMsg += "]\n"; Harness.IO.log(errorMsg); - throw new Error("Member list is not empty at Caret"); + this.raiseError("Member list is not empty at Caret"); } } @@ -546,7 +624,7 @@ module FourSlash { var completions = this.getCompletionListAtCaret(); if ((!completions || completions.entries.length === 0) && negative) { - throw new Error("Completion list is empty at Caret"); + this.raiseError("Completion list is empty at Caret"); } else if ((completions && completions.entries.length !== 0) && !negative) { var errorMsg = "\n" + "Completion List contains: [" + completions.entries[0].name; @@ -556,14 +634,14 @@ module FourSlash { errorMsg += "]\n"; Harness.IO.log(errorMsg); - throw new Error("Completion list is not empty at Caret"); + this.raiseError("Completion list is not empty at Caret"); } } - public verifyCompletionListContains(symbol: string, type?: string, docComment?: string, fullSymbolName?: string, kind?: string) { + public verifyCompletionListContains(symbol: string, text?: string, documentation?: string, kind?: string) { var completions = this.getCompletionListAtCaret(); - this.assertItemInCompletionList(completions.entries, symbol, type, docComment, fullSymbolName, kind); + this.assertItemInCompletionList(completions.entries, symbol, text, documentation, kind); } public verifyCompletionListDoesNotContain(symbol: string) { @@ -572,27 +650,23 @@ module FourSlash { var completions = this.getCompletionListAtCaret(); if (completions && completions.entries && completions.entries.filter(e => e.name === symbol).length !== 0) { - throw new Error('Completion list did contain ' + symbol); + this.raiseError('Completion list did contain ' + symbol); } } - public verifyCompletionEntryDetails(entryName: string, type: string, docComment?: string, fullSymbolName?: string, kind?: string) { + public verifyCompletionEntryDetails(entryName: string, expectedText: string, expectedDocumentation?: string, kind?: string) { this.taoInvalidReason = 'verifyCompletionEntryDetails NYI'; var details = this.getCompletionEntryDetails(entryName); - assert.equal(details.type, type); + assert.equal(ts.displayPartsToString(details.displayParts), expectedText, assertionMessage("completion entry details text")); - if (docComment != undefined) { - assert.equal(details.docComment, docComment); - } - - if (fullSymbolName !== undefined) { - assert.equal(details.fullSymbolName, fullSymbolName); + if (expectedDocumentation !== undefined) { + assert.equal(ts.displayPartsToString(details.documentation), expectedDocumentation, assertionMessage("completion entry documentation")); } if (kind !== undefined) { - assert.equal(details.kind, kind); + assert.equal(details.kind, kind, assertionMessage("completion entry kind")); } } @@ -602,21 +676,21 @@ module FourSlash { var references = this.getReferencesAtCaret(); if (!references || references.length === 0) { - throw new Error('verifyReferencesAtPositionListContains failed - found 0 references, expected at least one.'); + this.raiseError('verifyReferencesAtPositionListContains failed - found 0 references, expected at least one.'); } for (var i = 0; i < references.length; i++) { var reference = references[i]; if (reference && reference.fileName === fileName && reference.textSpan.start() === start && reference.textSpan.end() === end) { if (typeof isWriteAccess !== "undefined" && reference.isWriteAccess !== isWriteAccess) { - throw new Error('verifyReferencesAtPositionListContains failed - item isWriteAccess value doe not match, actual: ' + reference.isWriteAccess + ', expected: ' + isWriteAccess + '.'); + this.raiseError('verifyReferencesAtPositionListContains failed - item isWriteAccess value doe not match, actual: ' + reference.isWriteAccess + ', expected: ' + isWriteAccess + '.'); } return; } } var missingItem = { fileName: fileName, start: start, end: end, isWriteAccess: isWriteAccess }; - throw new Error('verifyReferencesAtPositionListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(references) + ')'); + this.raiseError('verifyReferencesAtPositionListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(references) + ')'); } public verifyReferencesCountIs(count: number, localFilesOnly: boolean = true) { @@ -640,7 +714,7 @@ module FourSlash { if (referencesCount !== count) { var condition = localFilesOnly ? "excluding libs" : "including libs"; - throw new Error("Expected references count (" + condition + ") to be " + count + ", but is actually " + referencesCount); + this.raiseError("Expected references count (" + condition + ") to be " + count + ", but is actually " + referencesCount); } } @@ -663,7 +737,7 @@ module FourSlash { if (implementorsCount !== count) { var condition = localFilesOnly ? "excluding libs" : "including libs"; - throw new Error("Expected implementors count (" + condition + ") to be " + count + ", but is actually " + implementors.length); + this.raiseError("Expected implementors count (" + condition + ") to be " + count + ", but is actually " + implementors.length); } } @@ -687,65 +761,83 @@ module FourSlash { return this.languageService.getImplementorsAtPosition(this.activeFile.fileName, this.currentCaretPosition); } - public verifyQuickInfo(negative: boolean, expectedTypeName?: string, docComment?: string, symbolName?: string, kind?: string) { - [expectedTypeName, docComment, symbolName, kind].forEach(str => { + private assertionMessage(name: string, actualValue: any, expectedValue: any) { + return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue; + } + + public verifyQuickInfo(negative: boolean, expectedText?: string, expectedDocumentation?: string) { + [expectedText, expectedDocumentation].forEach(str => { if (str) { this.scenarioActions.push(''); this.scenarioActions.push(''); } }); - var actualQuickInfo = this.languageService.getTypeAtPosition(this.activeFile.fileName, this.currentCaretPosition); - var actualQuickInfoMemberName = actualQuickInfo ? actualQuickInfo.memberName.toString() : ""; - var actualQuickInfoDocComment = actualQuickInfo ? actualQuickInfo.docComment : ""; - var actualQuickInfoSymbolName = actualQuickInfo ? actualQuickInfo.fullSymbolName : ""; - var actualQuickInfoKind = actualQuickInfo ? actualQuickInfo.kind : ""; - - function assertionMessage(name: string, actualValue: string, expectedValue: string) { - return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue; - } + var actualQuickInfo = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, this.currentCaretPosition); + var actualQuickInfoText = actualQuickInfo ? ts.displayPartsToString(actualQuickInfo.displayParts) : ""; + var actualQuickInfoDocumentation = actualQuickInfo ? ts.displayPartsToString(actualQuickInfo.documentation) : ""; if (negative) { - if (expectedTypeName !== undefined) { - assert.notEqual(actualQuickInfoMemberName, expectedTypeName, assertionMessage("quick info member name", actualQuickInfoMemberName, expectedTypeName)); + if (expectedText !== undefined) { + assert.notEqual(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text")); } - if (docComment != undefined) { - assert.notEqual(actualQuickInfoDocComment, docComment, assertionMessage("quick info doc comment", actualQuickInfoDocComment, docComment)); - } - if (symbolName !== undefined) { - assert.notEqual(actualQuickInfoSymbolName, symbolName, assertionMessage("quick info symbol name", actualQuickInfoSymbolName, symbolName)); - } - if (kind !== undefined) { - assert.notEqual(actualQuickInfoKind, kind, assertionMessage("quick info kind", actualQuickInfoKind, kind)); + if (expectedDocumentation != undefined) { + assert.notEqual(actualQuickInfoDocumentation, expectedDocumentation, this.messageAtLastKnownMarker("quick info doc comment")); } } else { - if (expectedTypeName !== undefined) { - assert.equal(actualQuickInfoMemberName, expectedTypeName, assertionMessage("quick info member", actualQuickInfoMemberName, expectedTypeName)); + if (expectedText !== undefined) { + assert.equal(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text")); } - if (docComment != undefined) { - assert.equal(actualQuickInfoDocComment, docComment, assertionMessage("quick info doc", actualQuickInfoDocComment, docComment)); - } - if (symbolName !== undefined) { - assert.equal(actualQuickInfoSymbolName, symbolName, assertionMessage("quick info symbol name", actualQuickInfoSymbolName, symbolName)); - } - if (kind !== undefined) { - assert.equal(actualQuickInfoKind, kind, assertionMessage("quick info kind", actualQuickInfoKind, kind)); + if (expectedDocumentation != undefined) { + assert.equal(actualQuickInfoDocumentation, expectedDocumentation, assertionMessage("quick info doc")); } } } - public verifyQuickInfoExists(negative: number) { + public verifyRenameLocations(findInStrings: boolean, findInComments: boolean) { + var renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition); + if (renameInfo.canRename) { + var references = this.languageService.findRenameLocations( + this.activeFile.fileName, this.currentCaretPosition, findInStrings, findInComments); + + var ranges = this.getRanges(); + if (ranges.length !== references.length) { + this.raiseError(this.assertionMessage("Rename locations", references.length, ranges.length)); + } + + ranges = ranges.sort((r1, r2) => r1.start - r2.start); + references = references.sort((r1, r2) => r1.textSpan.start() - r2.textSpan.start()); + + for (var i = 0, n = ranges.length; i < n; i++) { + var reference = references[i]; + var range = ranges[i]; + + if (reference.textSpan.start() !== range.start || + reference.textSpan.end() !== range.end) { + + this.raiseError(this.assertionMessage("Rename location", + "[" + reference.textSpan.start() + "," + reference.textSpan.end() + ")", + "[" + range.start + "," + range.end + ")")); + } + } + } + else { + this.raiseError("Expected rename to succeed, but it actually failed."); + } + } + + public verifyQuickInfoExists(negative: boolean) { this.taoInvalidReason = 'verifyQuickInfoExists NYI'; - var actualQuickInfo = this.languageService.getTypeAtPosition(this.activeFile.fileName, this.currentCaretPosition); + var actualQuickInfo = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, this.currentCaretPosition); if (negative) { if (actualQuickInfo) { - throw new Error('verifyQuickInfoExists failed. Expected quick info NOT to exist'); + this.raiseError('verifyQuickInfoExists failed. Expected quick info NOT to exist'); } } else { if (!actualQuickInfo) { - throw new Error('verifyQuickInfoExists failed. Expected quick info to exist'); + this.raiseError('verifyQuickInfoExists failed. Expected quick info to exist'); } } } @@ -753,14 +845,17 @@ module FourSlash { public verifyCurrentSignatureHelpIs(expected: string) { this.taoInvalidReason = 'verifyCurrentSignatureHelpIs NYI'; - var help = this.getActiveSignatureHelp(); - assert.equal(help.prefix + help.parameters.map(p => p.display).join(help.separator) + help.suffix, expected); + var help = this.getActiveSignatureHelpItem(); + assert.equal( + ts.displayPartsToString(help.prefixDisplayParts) + + help.parameters.map(p => ts.displayPartsToString(p.displayParts)).join(ts.displayPartsToString(help.separatorDisplayParts)) + + ts.displayPartsToString(help.suffixDisplayParts), expected); } public verifyCurrentParameterIsVariable(isVariable: boolean) { this.taoInvalidReason = 'verifyCurrentParameterIsVariable NYI'; - var signature = this.getActiveSignatureHelp(); + var signature = this.getActiveSignatureHelpItem(); assert.isNotNull(signature); assert.equal(isVariable, signature.isVariadic); } @@ -776,9 +871,9 @@ module FourSlash { public verifyCurrentParameterSpanIs(parameter: string) { this.taoInvalidReason = 'verifyCurrentParameterSpanIs NYI'; - var activeSignature = this.getActiveSignatureHelp(); + var activeSignature = this.getActiveSignatureHelpItem(); var activeParameter = this.getActiveParameter(); - assert.equal(activeParameter.display, parameter); + assert.equal(ts.displayPartsToString(activeParameter.displayParts), parameter); } public verifyCurrentParameterHelpDocComment(docComment: string) { @@ -786,26 +881,26 @@ module FourSlash { var activeParameter = this.getActiveParameter(); var activeParameterDocComment = activeParameter.documentation; - assert.equal(activeParameterDocComment, docComment); + assert.equal(ts.displayPartsToString(activeParameterDocComment), docComment, assertionMessage("current parameter Help DocComment")); } public verifyCurrentSignatureHelpParameterCount(expectedCount: number) { this.taoInvalidReason = 'verifyCurrentSignatureHelpParameterCount NYI'; - assert.equal(this.getActiveSignatureHelp().parameters.length, expectedCount); + assert.equal(this.getActiveSignatureHelpItem().parameters.length, expectedCount); } public verifyCurrentSignatureHelpTypeParameterCount(expectedCount: number) { this.taoInvalidReason = 'verifyCurrentSignatureHelpTypeParameterCount NYI'; - // assert.equal(this.getActiveSignatureHelp().typeParameters.length, expectedCount); + // assert.equal(this.getActiveSignatureHelpItem().typeParameters.length, expectedCount); } public verifyCurrentSignatureHelpDocComment(docComment: string) { this.taoInvalidReason = 'verifyCurrentSignatureHelpDocComment NYI'; - var actualDocComment = this.getActiveSignatureHelp().documentation; - assert.equal(actualDocComment, docComment); + var actualDocComment = this.getActiveSignatureHelpItem().documentation; + assert.equal(ts.displayPartsToString(actualDocComment), docComment, assertionMessage("current signature help doc comment")); } public verifySignatureHelpCount(expected: number) { @@ -817,46 +912,76 @@ module FourSlash { assert.equal(actual, expected); } + public verifySignatureHelpArgumentCount(expected: number) { + this.taoInvalidReason = 'verifySignatureHelpArgumentCount NYI'; + var signatureHelpItems = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition); + var actual = signatureHelpItems.argumentCount; + assert.equal(actual, expected); + } + public verifySignatureHelpPresent(shouldBePresent = true) { this.taoInvalidReason = 'verifySignatureHelpPresent NYI'; var actual = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition); if (shouldBePresent) { if (!actual) { - throw new Error("Expected signature help to be present, but it wasn't"); + this.raiseError("Expected signature help to be present, but it wasn't"); } } else { if (actual) { - throw new Error("Expected no signature help, but got '" + JSON.stringify(actual) + "'"); + this.raiseError("Expected no signature help, but got '" + JSON.stringify(actual) + "'"); } } } - //private getFormalParameter() { - // var help = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition); - // return help.formal; - //} + private validate(name: string, expected: string, actual: string) { + if (expected && expected !== actual) { + this.raiseError("Expected " + name + " '" + expected + "'. Got '" + actual + "' instead."); + } + } - private getActiveSignatureHelp() { + public verifyRenameInfoSucceeded(displayName?: string, fullDisplayName?: string, kind?: string, kindModifiers?: string) { + var renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition); + if (!renameInfo.canRename) { + this.raiseError("Rename did not succeed"); + } + + this.validate("displayName", displayName, renameInfo.displayName); + this.validate("fullDisplayName", fullDisplayName, renameInfo.fullDisplayName); + this.validate("kind", kind, renameInfo.kind); + this.validate("kindModifiers", kindModifiers, renameInfo.kindModifiers); + + if (this.getRanges().length !== 1) { + this.raiseError("Expected a single range to be selected in the test file."); + } + + var expectedRange = this.getRanges()[0]; + if (renameInfo.triggerSpan.start() !== expectedRange.start || + renameInfo.triggerSpan.end() !== expectedRange.end) { + this.raiseError("Expected triggerSpan [" + expectedRange.start + "," + expectedRange.end + "). Got [" + + renameInfo.triggerSpan.start() + "," + renameInfo.triggerSpan.end() + ") instead."); + } + } + + public verifyRenameInfoFailed(message?: string) { + var renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition); + if (renameInfo.canRename) { + this.raiseError("Rename was expected to fail"); + } + + this.validate("error", message, renameInfo.localizedErrorMessage); + } + + private getActiveSignatureHelpItem() { var help = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition); - - // If the signature hasn't been narrowed down yet (e.g. no parameters have yet been entered), - // 'activeFormal' will be -1 (even if there is only 1 signature). Signature help will show the - // first signature in the signature group, so go with that - var index = help.selectedItemIndex < 0 ? 0 : help.selectedItemIndex; - + var index = help.selectedItemIndex; return help.items[index]; } private getActiveParameter(): ts.SignatureHelpParameter { - var currentSig = this.getActiveSignatureHelp(); var help = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition); - var item = help.items[help.selectedItemIndex]; - var state = this.languageService.getSignatureHelpCurrentArgumentState(this.activeFile.fileName, this.currentCaretPosition, help.applicableSpan.start()); - - // Same logic as in getActiveSignatureHelp - this value might be -1 until a parameter value actually gets typed - var currentParam = state === null ? 0 : state.argumentIndex; + var currentParam = help.argumentIndex; return item.parameters[currentParam]; } @@ -876,7 +1001,7 @@ module FourSlash { Harness.Baseline.runBaseline( "Breakpoint Locations for " + this.activeFile.fileName, - this.testData.globalOptions['BaselineFile'], + this.testData.globalOptions[testOptMetadataNames.baselineFile], () => { var fileLength = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getLength(); var resultString = ""; @@ -888,6 +1013,48 @@ module FourSlash { true /* run immediately */); } + public baselineGetEmitOutput() { + this.taoInvalidReason = 'baselineGetEmitOutput impossible'; + // Find file to be emitted + var emitFiles: FourSlashFile[] = []; // List of FourSlashFile that has emitThisFile flag on + + var allFourSlashFiles = this.testData.files; + for (var idx = 0; idx < allFourSlashFiles.length; ++idx) { + var file = allFourSlashFiles[idx]; + if (file.fileOptions[testOptMetadataNames.emitThisFile]) { + // Find a file with the flag emitThisFile turned on + emitFiles.push(file); + } + } + + // If there is not emiThisFile flag specified in the test file, throw an error + if (emitFiles.length === 0) { + this.raiseError("No emitThisFile is specified in the test file"); + } + + Harness.Baseline.runBaseline( + "Generate getEmitOutput baseline : " + emitFiles.join(" "), + this.testData.globalOptions[testOptMetadataNames.baselineFile], + () => { + var resultString = ""; + // Loop through all the emittedFiles and emit them one by one + emitFiles.forEach(emitFile => { + var emitOutput = this.languageService.getEmitOutput(emitFile.fileName); + var emitOutputStatus = emitOutput.emitOutputStatus; + // Print emitOutputStatus in readable format + resultString += "EmitOutputStatus : " + ts.EmitReturnStatus[emitOutputStatus]; + resultString += "\n"; + emitOutput.outputFiles.forEach((outputFile, idx, array) => { + var filename = "Filename : " + outputFile.name + "\n"; + resultString = resultString + filename + outputFile.text; + }); + resultString += "\n"; + }); + return resultString; + }, + true /* run immediately */); + } + public printBreakpointLocation(pos: number) { Harness.IO.log(this.getBreakpointStatementLocation(pos)); } @@ -902,7 +1069,7 @@ module FourSlash { } public printCurrentQuickInfo() { - var quickInfo = this.languageService.getTypeAtPosition(this.activeFile.fileName, this.currentCaretPosition); + var quickInfo = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, this.currentCaretPosition); Harness.IO.log(JSON.stringify(quickInfo)); } @@ -937,7 +1104,7 @@ module FourSlash { } public printCurrentSignatureHelp() { - var sigHelp = this.getActiveSignatureHelp(); + var sigHelp = this.getActiveSignatureHelpItem(); Harness.IO.log(JSON.stringify(sigHelp)); } @@ -1162,7 +1329,7 @@ module FourSlash { //var fullSyntaxErrs = JSON.stringify(refSyntaxTree.diagnostics()); //if (incrSyntaxErrs !== fullSyntaxErrs) { - // throw new Error('Mismatched incremental/full syntactic errors for file ' + this.activeFile.fileName + '.\n=== Incremental errors ===\n' + incrSyntaxErrs + '\n=== Full Errors ===\n' + fullSyntaxErrs); + // this.raiseError('Mismatched incremental/full syntactic errors for file ' + this.activeFile.fileName + '.\n=== Incremental errors ===\n' + incrSyntaxErrs + '\n=== Full Errors ===\n' + fullSyntaxErrs); //} // if (this.editValidation !== IncrementalEditValidation.SyntacticOnly) { @@ -1179,7 +1346,7 @@ module FourSlash { // var incrSemanticErrs = JSON.stringify(this.languageService.getSemanticDiagnostics(this.testData.files[i].fileName)); // if (incrSemanticErrs !== refSemanticErrs) { - // throw new Error('Mismatched incremental/full semantic errors for file ' + this.testData.files[i].fileName + '\n=== Incremental errors ===\n' + incrSemanticErrs + '\n=== Full Errors ===\n' + refSemanticErrs); + // this.raiseError('Mismatched incremental/full semantic errors for file ' + this.testData.files[i].fileName + '\n=== Incremental errors ===\n' + incrSemanticErrs + '\n=== Full Errors ===\n' + refSemanticErrs); // } // } // } @@ -1198,7 +1365,7 @@ module FourSlash { private applyEdits(fileName: string, edits: ts.TextChange[], isFormattingEdit = false): number { // We get back a set of edits, but langSvc.editScript only accepts one at a time. Use this to keep track - // of the incremental offest from each edit to the next. Assumption is that these edit ranges don't overlap + // of the incremental offset from each edit to the next. Assumption is that these edit ranges don't overlap var runningOffset = 0; edits = edits.sort((a, b) => a.span.start() - b.span.start()); // Get a snapshot of the content of the file so we can make sure any formatting edits didn't destroy non-whitespace characters @@ -1218,7 +1385,7 @@ module FourSlash { var newContent = snapshot.getText(0, snapshot.getLength()); if (newContent.replace(/\s/g, '') !== oldContent.replace(/\s/g, '')) { - throw new Error('Formatting operation destroyed non-whitespace content'); + this.raiseError('Formatting operation destroyed non-whitespace content'); } } return runningOffset; @@ -1275,11 +1442,11 @@ module FourSlash { var definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition); if (!definitions || !definitions.length) { - throw new Error('goToDefinition failed - expected to at least one defintion location but got 0'); + this.raiseError('goToDefinition failed - expected to at least one definition location but got 0'); } if (definitionIndex >= definitions.length) { - throw new Error('goToDefinition failed - definitionIndex value (' + definitionIndex + ') exceeds definition list size (' + definitions.length + ')'); + this.raiseError('goToDefinition failed - definitionIndex value (' + definitionIndex + ') exceeds definition list size (' + definitions.length + ')'); } var definition = definitions[definitionIndex]; @@ -1295,10 +1462,25 @@ module FourSlash { var foundDefinitions = definitions && definitions.length; if (foundDefinitions && negative) { - throw new Error('goToDefinition - expected to 0 defintion locations but got ' + definitions.length); + this.raiseError('goToDefinition - expected to 0 definition locations but got ' + definitions.length); } else if (!foundDefinitions && !negative) { - throw new Error('goToDefinition - expected to at least one defintion location but got 0'); + this.raiseError('goToDefinition - expected to at least one definition location but got 0'); + } + } + + public verifyDefinitionsName(negative: boolean, expectedName: string, expectedContainerName: string) { + this.taoInvalidReason = 'verifyDefinititionsInfo NYI'; + + var definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition); + var actualDefinitionName = definitions && definitions.length ? definitions[0].name : ""; + var actualDefinitionContainerName = definitions && definitions.length ? definitions[0].containerName : ""; + if (negative) { + assert.notEqual(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Name")); + assert.notEqual(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Container Name")); + } else { + assert.equal(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Name")); + assert.equal(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Container Name")); } } @@ -1333,7 +1515,7 @@ module FourSlash { var actual = this.getIndentation(this.activeFile.fileName, this.currentCaretPosition); if (actual != numberOfSpaces) { - throw new Error('verifyIndentationAtCurrentPosition failed - expected: ' + numberOfSpaces + ', actual: ' + actual); + this.raiseError('verifyIndentationAtCurrentPosition failed - expected: ' + numberOfSpaces + ', actual: ' + actual); } } @@ -1342,7 +1524,7 @@ module FourSlash { var actual = this.getIndentation(fileName, position); if (actual !== numberOfSpaces) { - throw new Error('verifyIndentationAtPosition failed - expected: ' + numberOfSpaces + ', actual: ' + actual); + this.raiseError('verifyIndentationAtPosition failed - expected: ' + numberOfSpaces + ', actual: ' + actual); } } @@ -1385,14 +1567,14 @@ module FourSlash { var span = this.languageService.getNameOrDottedNameSpan(this.activeFile.fileName, this.currentCaretPosition, this.currentCaretPosition); if (span === null) { - throw new Error('verifyCurrentNameOrDottedNameSpanText\n' + + this.raiseError('verifyCurrentNameOrDottedNameSpanText\n' + '\tExpected: "' + text + '"\n' + '\t Actual: null'); } var actual = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getText(span.start(), span.end()); if (actual !== text) { - throw new Error('verifyCurrentNameOrDottedNameSpanText\n' + + this.raiseError('verifyCurrentNameOrDottedNameSpanText\n' + '\tExpected: "' + text + '"\n' + '\t Actual: "' + actual + '"'); } @@ -1412,7 +1594,7 @@ module FourSlash { Harness.Baseline.runBaseline( "Name OrDottedNameSpans for " + this.activeFile.fileName, - this.testData.globalOptions['BaselineFile'], + this.testData.globalOptions[testOptMetadataNames.baselineFile], () => { var fileLength = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getLength(); var resultString = ""; @@ -1428,30 +1610,82 @@ module FourSlash { Harness.IO.log(this.getNameOrDottedNameSpan(pos)); } + private verifyClassifications(expected: { classificationType: string; text: string; textSpan?: TextSpan }[], actual: ts.ClassifiedSpan[]) { + if (actual.length !== expected.length) { + this.raiseError('verifyClassifications failed - expected total classifications to be ' + expected.length + ', but was ' + actual.length); + } + + for (var i = 0; i < expected.length; i++) { + var expectedClassification = expected[i]; + var actualClassification = actual[i]; + + var expectedType: string = (ts.ClassificationTypeNames)[expectedClassification.classificationType]; + if (expectedType !== actualClassification.classificationType) { + this.raiseError('verifyClassifications failed - expected classifications type to be ' + + expectedType + ', but was ' + + actualClassification.classificationType); + } + + var expectedSpan = expectedClassification.textSpan; + var actualSpan = actualClassification.textSpan; + + if (expectedSpan) { + var expectedLength = expectedSpan.end - expectedSpan.start; + + if (expectedSpan.start !== actualSpan.start() || expectedLength !== actualSpan.length()) { + this.raiseError("verifyClassifications failed - expected span of text to be " + + "{start=" + expectedSpan.start + ", length=" + expectedLength + "}, but was " + + "{start=" + actualSpan.start() + ", length=" + actualSpan.length() + "}"); + } + } + + var actualText = this.activeFile.content.substr(actualSpan.start(), actualSpan.length()); + if (expectedClassification.text !== actualText) { + this.raiseError('verifyClassifications failed - expected classificatied text to be ' + + expectedClassification.text + ', but was ' + + actualText); + } + } + } + + public verifySemanticClassifications(expected: { classificationType: string; text: string }[]) { + var actual = this.languageService.getSemanticClassifications(this.activeFile.fileName, + new TypeScript.TextSpan(0, this.activeFile.content.length)); + + this.verifyClassifications(expected, actual); + } + + public verifySyntacticClassifications(expected: { classificationType: string; text: string }[]) { + var actual = this.languageService.getSyntacticClassifications(this.activeFile.fileName, + new TypeScript.TextSpan(0, this.activeFile.content.length)); + + this.verifyClassifications(expected, actual); + } + public verifyOutliningSpans(spans: TextSpan[]) { this.taoInvalidReason = 'verifyOutliningSpans NYI'; var actual = this.languageService.getOutliningSpans(this.activeFile.fileName); if (actual.length !== spans.length) { - throw new Error('verifyOutliningSpans failed - expected total spans to be ' + spans.length + ', but was ' + actual.length); + this.raiseError('verifyOutliningSpans failed - expected total spans to be ' + spans.length + ', but was ' + actual.length); } for (var i = 0; i < spans.length; i++) { var expectedSpan = spans[i]; var actualSpan = actual[i]; if (expectedSpan.start !== actualSpan.textSpan.start() || expectedSpan.end !== actualSpan.textSpan.end()) { - throw new Error('verifyOutliningSpans failed - span ' + (i + 1) + ' expected: (' + expectedSpan.start + ',' + expectedSpan.end + '), actual: (' + actualSpan.textSpan.start() + ',' + actualSpan.textSpan.end() + ')'); + this.raiseError('verifyOutliningSpans failed - span ' + (i + 1) + ' expected: (' + expectedSpan.start + ',' + expectedSpan.end + '), actual: (' + actualSpan.textSpan.start() + ',' + actualSpan.textSpan.end() + ')'); } } } public verifyTodoComments(descriptors: string[], spans: TextSpan[]) { var actual = this.languageService.getTodoComments(this.activeFile.fileName, - descriptors.map(d => new ts.TodoCommentDescriptor(d, 0))); + descriptors.map(d => { return { text: d, priority: 0 }; })); if (actual.length !== spans.length) { - throw new Error('verifyTodoComments failed - expected total spans to be ' + spans.length + ', but was ' + actual.length); + this.raiseError('verifyTodoComments failed - expected total spans to be ' + spans.length + ', but was ' + actual.length); } for (var i = 0; i < spans.length; i++) { @@ -1460,7 +1694,7 @@ module FourSlash { var actualCommentSpan = new TypeScript.TextSpan(actualComment.position, actualComment.message.length); if (expectedSpan.start !== actualCommentSpan.start() || expectedSpan.end !== actualCommentSpan.end()) { - throw new Error('verifyOutliningSpans failed - span ' + (i + 1) + ' expected: (' + expectedSpan.start + ',' + expectedSpan.end + '), actual: (' + actualCommentSpan.start() + ',' + actualCommentSpan.end() + ')'); + this.raiseError('verifyOutliningSpans failed - span ' + (i + 1) + ' expected: (' + expectedSpan.start + ',' + expectedSpan.end + '), actual: (' + actualCommentSpan.start() + ',' + actualCommentSpan.end() + ')'); } } } @@ -1471,20 +1705,20 @@ module FourSlash { var actual = this.languageService.getBraceMatchingAtPosition(this.activeFile.fileName, bracePosition); if (actual.length !== 2) { - throw new Error('verifyMatchingBracePosition failed - expected result to contain 2 spans, but it had ' + actual.length); + this.raiseError('verifyMatchingBracePosition failed - expected result to contain 2 spans, but it had ' + actual.length); } var actualMatchPosition = -1; - if (bracePosition >= actual[0].start() && bracePosition <= actual[0].end()) { + if (bracePosition === actual[0].start()) { actualMatchPosition = actual[1].start(); - } else if (bracePosition >= actual[1].start() && bracePosition <= actual[1].end()) { + } else if (bracePosition === actual[1].start()) { actualMatchPosition = actual[0].start(); } else { - throw new Error('verifyMatchingBracePosition failed - could not find the brace position: ' + bracePosition + ' in the returned list: (' + actual[0].start() + ',' + actual[0].end() + ') and (' + actual[1].start() + ',' + actual[1].end() + ')'); + this.raiseError('verifyMatchingBracePosition failed - could not find the brace position: ' + bracePosition + ' in the returned list: (' + actual[0].start() + ',' + actual[0].end() + ') and (' + actual[1].start() + ',' + actual[1].end() + ')'); } if (actualMatchPosition !== expectedMatchPosition) { - throw new Error('verifyMatchingBracePosition failed - expected: ' + actualMatchPosition + ', actual: ' + expectedMatchPosition); + this.raiseError('verifyMatchingBracePosition failed - expected: ' + actualMatchPosition + ', actual: ' + expectedMatchPosition); } } @@ -1494,7 +1728,7 @@ module FourSlash { var actual = this.languageService.getBraceMatchingAtPosition(this.activeFile.fileName, bracePosition); if (actual.length !== 0) { - throw new Error('verifyNoMatchingBracePosition failed - expected: 0 spans, actual: ' + actual.length); + this.raiseError('verifyNoMatchingBracePosition failed - expected: 0 spans, actual: ' + actual.length); } } @@ -1518,7 +1752,7 @@ module FourSlash { } for (i = 0; i < positions.length; i++) { - var nameOf = (type: ts.TypeInfo) => type ? type.fullSymbolName : '(none)'; + var nameOf = (type: ts.QuickInfo) => type ? ts.displayPartsToString(type.displayParts) : '(none)'; var pullName: string, refName: string; var anyFailed = false; @@ -1526,7 +1760,7 @@ module FourSlash { var errMsg = ''; try { - var pullType = this.languageService.getTypeAtPosition(this.activeFile.fileName, positions[i]); + var pullType = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, positions[i]); pullName = nameOf(pullType); } catch (err1) { errMsg = 'Failed to get pull type check. Exception: ' + err1 + '\r\n'; @@ -1536,7 +1770,7 @@ module FourSlash { } try { - var referenceType = referenceLanguageService.getTypeAtPosition(this.activeFile.fileName, positions[i]); + var referenceType = referenceLanguageService.getQuickInfoAtPosition(this.activeFile.fileName, positions[i]); refName = nameOf(referenceType); } catch (err2) { errMsg = 'Failed to get full type check. Exception: ' + err2 + '\r\n'; @@ -1581,7 +1815,7 @@ module FourSlash { } if (expected != actual) { - throw new Error('verifyNavigationItemsCount failed - found: ' + actual + ' navigation items, expected: ' + expected + '.'); + this.raiseError('verifyNavigationItemsCount failed - found: ' + actual + ' navigation items, expected: ' + expected + '.'); } } @@ -1601,7 +1835,7 @@ module FourSlash { var items = this.languageService.getNavigateToItems(searchValue); if (!items || items.length === 0) { - throw new Error('verifyNavigationItemsListContains failed - found 0 navigation items, expected at least one.'); + this.raiseError('verifyNavigationItemsListContains failed - found 0 navigation items, expected at least one.'); } for (var i = 0; i < items.length; i++) { @@ -1617,7 +1851,7 @@ module FourSlash { // if there was an explicit match kind specified, then it should be validated. if (matchKind !== undefined) { var missingItem = { name: name, kind: kind, searchValue: searchValue, matchKind: matchKind, fileName: fileName, parentName: parentName }; - throw new Error('verifyNavigationItemsListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')'); + this.raiseError('verifyNavigationItemsListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')'); } } @@ -1628,7 +1862,7 @@ module FourSlash { var actual = this.getNavigationBarItemsCount(items); if (expected != actual) { - throw new Error('verifyGetScriptLexicalStructureListCount failed - found: ' + actual + ' navigation items, expected: ' + expected + '.'); + this.raiseError('verifyGetScriptLexicalStructureListCount failed - found: ' + actual + ' navigation items, expected: ' + expected + '.'); } } @@ -1653,7 +1887,7 @@ module FourSlash { var items = this.languageService.getNavigationBarItems(this.activeFile.fileName); if (!items || items.length === 0) { - throw new Error('verifyGetScriptLexicalStructureListContains failed - found 0 navigation items, expected at least one.'); + this.raiseError('verifyGetScriptLexicalStructureListContains failed - found 0 navigation items, expected at least one.'); } if (this.navigationBarItemsContains(items, name, kind)) { @@ -1661,7 +1895,7 @@ module FourSlash { } var missingItem = { name: name, kind: kind }; - throw new Error('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')'); + this.raiseError('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')'); } private navigationBarItemsContains(items: ts.NavigationBarItem[], name: string, kind: string) { @@ -1715,21 +1949,21 @@ module FourSlash { var occurances = this.getOccurancesAtCurrentPosition(); if (!occurances || occurances.length === 0) { - throw new Error('verifyOccurancesAtPositionListContains failed - found 0 references, expected at least one.'); + this.raiseError('verifyOccurancesAtPositionListContains failed - found 0 references, expected at least one.'); } for (var i = 0; i < occurances.length; i++) { var occurance = occurances[i]; if (occurance && occurance.fileName === fileName && occurance.textSpan.start() === start && occurance.textSpan.end() === end) { if (typeof isWriteAccess !== "undefined" && occurance.isWriteAccess !== isWriteAccess) { - throw new Error('verifyOccurancesAtPositionListContains failed - item isWriteAccess value doe not match, actual: ' + occurance.isWriteAccess + ', expected: ' + isWriteAccess + '.'); + this.raiseError('verifyOccurancesAtPositionListContains failed - item isWriteAccess value doe not match, actual: ' + occurance.isWriteAccess + ', expected: ' + isWriteAccess + '.'); } return; } } var missingItem = { fileName: fileName, start: start, end: end, isWriteAccess: isWriteAccess }; - throw new Error('verifyOccurancesAtPositionListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(occurances) + ')'); + this.raiseError('verifyOccurancesAtPositionListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(occurances) + ')'); } public verifyOccurrencesAtPositionListCount(expectedCount: number) { @@ -1738,7 +1972,7 @@ module FourSlash { var occurances = this.getOccurancesAtCurrentPosition(); var actualCount = occurances ? occurances.length : 0; if (expectedCount !== actualCount) { - throw new Error('verifyOccurrencesAtPositionListCount failed - actual: ' + actualCount + ', expected:' + expectedCount); + this.raiseError('verifyOccurrencesAtPositionListCount failed - actual: ' + actualCount + ', expected:' + expectedCount); } } @@ -1788,33 +2022,30 @@ module FourSlash { return result; } - private assertItemInCompletionList(items: ts.CompletionEntry[], name: string, type?: string, docComment?: string, fullSymbolName?: string, kind?: string) { + private assertItemInCompletionList(items: ts.CompletionEntry[], name: string, text?: string, documentation?: string, kind?: string) { this.scenarioActions.push(''); this.scenarioActions.push(''); - if (type || docComment || fullSymbolName || kind) { + if (text || documentation || kind) { this.taoInvalidReason = 'assertItemInCompletionList only supports the "name" parameter'; } for (var i = 0; i < items.length; i++) { var item = items[i]; - if (item.name == name) { - if (docComment != undefined || type !== undefined || fullSymbolName !== undefined) { + if (item.name === name) { + if (documentation != undefined || text !== undefined) { var details = this.getCompletionEntryDetails(item.name); - if (docComment != undefined) { - assert.equal(details.docComment, docComment); + if (documentation !== undefined) { + assert.equal(ts.displayPartsToString(details.documentation), documentation, assertionMessage("completion item documentation")); } - if (type !== undefined) { - assert.equal(details.type, type); - } - if (fullSymbolName !== undefined) { - assert.equal(details.fullSymbolName, fullSymbolName); + if (text !== undefined) { + assert.equal(ts.displayPartsToString(details.displayParts), text, assertionMessage("completion item detail text")); } } if (kind !== undefined) { - assert.equal(item.kind, kind); + assert.equal(item.kind, kind, assertionMessage("completion item kind")); } return; @@ -1823,7 +2054,7 @@ module FourSlash { var itemsString = items.map((item) => JSON.stringify({ name: item.name, kind: item.kind })).join(",\n"); - throw new Error("Marker: " + currentTestState.lastKnownMarker + "\n" + 'Expected "' + JSON.stringify({ name: name, type: type, docComment: docComment, fullSymbolName: fullSymbolName, kind: kind }) + '" to be in list [' + itemsString + ']'); + this.raiseError('Expected "' + JSON.stringify({ name: name, text: text, documentation: documentation, kind: kind }) + '" to be in list [' + itemsString + ']'); } private findFile(indexOrName: any) { @@ -1910,9 +2141,6 @@ module FourSlash { xmlData.push(xml); } - // Cache these between executions so we don't have to re-parse them for every test - var fourslashSourceFile: ts.SourceFile = undefined; - export function runFourSlashTestContent(content: string, fileName: string): TestXmlData { // Parse out the files and their metadata var testData = parseTestData(content, fileName); @@ -1920,21 +2148,16 @@ module FourSlash { currentTestState = new TestState(testData); var result = ''; - var fourslashFilename = 'fourslash.ts'; - var tsFn = 'tests/cases/fourslash/' + fourslashFilename; - fourslashSourceFile = fourslashSourceFile || ts.createSourceFile(tsFn, Harness.IO.readFile(tsFn), ts.ScriptTarget.ES5, /*version*/ "0", /*isOpen*/ false); - - var files: { [filename: string]: ts.SourceFile; } = {}; - files[Harness.Compiler.getCanonicalFileName(fourslashFilename)] = fourslashSourceFile; - files[Harness.Compiler.getCanonicalFileName(fileName)] = ts.createSourceFile(fileName, content, ts.ScriptTarget.ES5, /*version*/ "0", /*isOpen*/ false); - files[Harness.Compiler.getCanonicalFileName(Harness.Compiler.defaultLibFileName)] = Harness.Compiler.defaultLibSourceFile; - - var host = Harness.Compiler.createCompilerHost(files, (fn, contents) => result = contents); - var program = ts.createProgram([fourslashFilename, fileName], { out: "fourslashTestOutput.js" }, host); + var host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFilename, content: undefined }, + { unitName: fileName, content: content }], + (fn, contents) => result = contents, + ts.ScriptTarget.ES5, + sys.useCaseSensitiveFileNames); + var program = ts.createProgram([Harness.Compiler.fourslashFilename, fileName], { out: "fourslashTestOutput.js" }, host); var checker = ts.createTypeChecker(program, /*fullTypeCheckMode*/ true); checker.checkProgram(); - var errs = checker.getDiagnostics(files[fileName]); + var errs = checker.getDiagnostics(program.getSourceFile(fileName)); if (errs.length > 0) { throw new Error('Error compiling ' + fileName + ': ' + errs.map(e => e.messageText).join('\r\n')); } @@ -2013,12 +2236,12 @@ module FourSlash { // Comment line, check for global/file @options and record them var match = optionRegex.exec(line.substr(2)); if (match) { - var globalNameIndex = globalMetadataNames.indexOf(match[1]); - var fileNameIndex = fileMetadataNames.indexOf(match[1]); - if (globalNameIndex === -1) { - if (fileNameIndex === -1) { + var globalMetadataNamesIndex = globalMetadataNames.indexOf(match[1]); + var fileMetadataNamesIndex = fileMetadataNames.indexOf(match[1]); + if (globalMetadataNamesIndex === -1) { + if (fileMetadataNamesIndex === -1) { throw new Error('Unrecognized metadata name "' + match[1] + '". Available global metadata names are: ' + globalMetadataNames.join(', ') + '; file metadata names are: ' + fileMetadataNames.join(', ')); - } else { + } else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(testOptMetadataNames.filename)) { // Found an @Filename directive, if this is not the first then create a new subfile if (currentFileContent) { var file = parseFileContent(currentFileContent, currentFileName, markerMap, markers, ranges); @@ -2035,8 +2258,15 @@ module FourSlash { currentFileName = 'tests/cases/fourslash/' + match[2]; currentFileOptions[match[1]] = match[2]; + } else { + // Add other fileMetadata flag + currentFileOptions[match[1]] = match[2]; } } else { + // Check if the match is already existed in the global options + if (opts[match[1]] !== undefined) { + throw new Error("Global Option : '" + match[1] + "' is already existed"); + } opts[match[1]] = match[2]; } } @@ -2146,7 +2376,7 @@ module FourSlash { /// A list of ranges we've collected so far */ var localRanges: Range[] = []; - /// The latest position of the start of an unflushed plaintext area + /// The latest position of the start of an unflushed plain text area var lastNormalCharPosition: number = 0; /// The total number of metacharacters removed from the file (so far) diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 72bfa348a69..15d1917b5cd 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -534,18 +534,47 @@ module Harness { export var defaultLibFileName = 'lib.d.ts'; export var defaultLibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.ES5, /*version:*/ "0"); + // Cache these between executions so we don't have to re-parse them for every test + export var fourslashFilename = 'fourslash.ts'; + export var fourslashSourceFile: ts.SourceFile; + export function getCanonicalFileName(fileName: string): string { return sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); } - export function createCompilerHost(filemap: { [filename: string]: ts.SourceFile; }, writeFile: (fn: string, contents: string, writeByteOrderMark:boolean) => void): ts.CompilerHost { + export function createCompilerHost(inputFiles: { unitName: string; content: string; }[], + writeFile: (fn: string, contents: string, writeByteOrderMark: boolean) => void, + scriptTarget: ts.ScriptTarget, + useCaseSensitiveFileNames: boolean): ts.CompilerHost { + + // Local get canonical file name function, that depends on passed in parameter for useCaseSensitiveFileNames + function getCanonicalFileName(fileName: string): string { + return useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + } + + var filemap: { [filename: string]: ts.SourceFile; } = {}; + // Register input files + function register(file: { unitName: string; content: string; }) { + if (file.content !== undefined) { + var filename = Path.switchToForwardSlashes(file.unitName); + filemap[getCanonicalFileName(filename)] = ts.createSourceFile(filename, file.content, scriptTarget, /*version:*/ "0"); + } + }; + inputFiles.forEach(register); + return { getCurrentDirectory: sys.getCurrentDirectory, getCancellationToken: (): any => undefined, getSourceFile: (fn, languageVersion) => { if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) { return filemap[getCanonicalFileName(fn)]; - } else { + } + else if (fn === fourslashFilename) { + var tsFn = 'tests/cases/fourslash/' + fourslashFilename; + fourslashSourceFile = fourslashSourceFile || ts.createSourceFile(tsFn, Harness.IO.readFile(tsFn), scriptTarget, /*version*/ "0", /*isOpen*/ false); + return fourslashSourceFile; + } + else { var lib = defaultLibFileName; if (fn === defaultLibFileName) { return defaultLibSourceFile; @@ -557,7 +586,7 @@ module Harness { getDefaultLibFilename: () => defaultLibFileName, writeFile: writeFile, getCanonicalFileName: getCanonicalFileName, - useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, + useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, getNewLine: ()=> sys.newLine }; } @@ -614,7 +643,7 @@ module Harness { } public compileFiles(inputFiles: { unitName: string; content: string }[], - otherFiles: { unitName: string; content?: string }[], + otherFiles: { unitName: string; content: string }[], onComplete: (result: CompilerResult, checker: ts.TypeChecker) => void, settingsCallback?: (settings: ts.CompilerOptions) => void, options?: ts.CompilerOptions) { @@ -628,9 +657,10 @@ module Harness { settingsCallback(null); } + var useCaseSensitiveFileNames = sys.useCaseSensitiveFileNames; this.settings.forEach(setting => { switch (setting.flag.toLowerCase()) { - // "filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outDir", "noimplicitany", "noresolve" + // "filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve" case "module": case "modulegentarget": if (typeof setting.value === 'string') { @@ -706,10 +736,13 @@ module Harness { options.removeComments = setting.value === 'false'; break; + case 'usecasesensitivefilenames': + useCaseSensitiveFileNames = setting.value === 'true'; + break; + case 'mapsourcefiles': case 'maproot': case 'generatedeclarationfiles': - case 'usecasesensitivefileresolution': case 'gatherDiagnostics': case 'codepage': case 'createFileLog': @@ -748,7 +781,10 @@ module Harness { var fileOutputs: GeneratedFile[] = []; var programFiles = inputFiles.map(file => file.unitName); - var program = ts.createProgram(programFiles, options, createCompilerHost(filemap, (fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }))); + var program = ts.createProgram(programFiles, options, createCompilerHost(inputFiles.concat(otherFiles), + (fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }), + options.target, + useCaseSensitiveFileNames)); var hadParseErrors = program.getDiagnostics().length > 0; @@ -818,7 +854,7 @@ module Harness { var sourceFileName: string; if (ts.isExternalModule(sourceFile) || !options.out) { if (options.outDir) { - var sourceFilePath = ts.getNormalizedPathFromPathCompoments(ts.getNormalizedPathComponents(sourceFile.filename, result.currentDirectoryForProgram)); + var sourceFilePath = ts.getNormalizedPathFromPathComponents(ts.getNormalizedPathComponents(sourceFile.filename, result.currentDirectoryForProgram)); sourceFilePath = sourceFilePath.replace(result.program.getCommonSourceDirectory(), ""); sourceFileName = ts.combinePaths(options.outDir, sourceFilePath); } @@ -831,7 +867,7 @@ module Harness { sourceFileName = options.out; } - return ts.getModuleNameFromFilename(sourceFileName) + ".d.ts"; + return ts.removeFileExtension(sourceFileName) + ".d.ts"; } }); @@ -873,9 +909,7 @@ module Harness { return errorOutput; } - export function getErrorBaseline(inputFiles: { unitName: string; content: string }[], - diagnostics: HarnessDiagnostic[] - ) { + export function getErrorBaseline(inputFiles: { unitName: string; content: string }[], diagnostics: HarnessDiagnostic[]) { var outputLines: string[] = []; // Count up all the errors we find so we don't miss any @@ -886,13 +920,13 @@ module Harness { .split('\n') .map(s => s.length > 0 && s.charAt(s.length - 1) === '\r' ? s.substr(0, s.length - 1) : s) .filter(s => s.length > 0) - .map(s => '!!! ' + s); + .map(s => '!!! ' + error.category + " TS" + error.code + ": " + s); errLines.forEach(e => outputLines.push(e)); totalErrorsReported++; } - // Report glovbal errors: + // Report global errors var globalErrors = diagnostics.filter(err => !err.filename); globalErrors.forEach(err => outputErrorText(err)); @@ -962,7 +996,8 @@ module Harness { // Verify we didn't miss any errors in total assert.equal(totalErrorsReported, diagnostics.length, 'total number of errors'); - return outputLines.join('\r\n'); + return minimalDiagnosticsToString(diagnostics) + + sys.newLine + sys.newLine + outputLines.join('\r\n'); } /* TODO: Delete? @@ -983,7 +1018,7 @@ module Harness { export function recreate(options?: { useMinimalDefaultLib: boolean; noImplicitAny: boolean; }) { } - /** The harness' compiler instance used when tests are actually run. Reseting or changing settings of this compiler instance must be done within a testcase (i.e., describe/it) */ + /** The harness' compiler instance used when tests are actually run. Reseting or changing settings of this compiler instance must be done within a test case (i.e., describe/it) */ var harnessCompiler: HarnessCompiler; /** Returns the singleton harness compiler instance for generating and running tests. @@ -1085,7 +1120,7 @@ module Harness { } export module TestCaseParser { - /** all the necesarry information to set the right compiler settings */ + /** all the necessary information to set the right compiler settings */ export interface CompilerSetting { flag: string; value: string; @@ -1104,7 +1139,7 @@ module Harness { var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines // List of allowed metadata names - var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outDir", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation"]; + var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames"]; function extractCompilerSettings(content: string): CompilerSetting[] { diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 1a02157d729..647d0729cbb 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -134,6 +134,7 @@ module Harness.LanguageService { private ls: ts.LanguageServiceShim = null; private fileNameToScript: ts.Map = {}; + private settings: ts.CompilationSettings = {}; constructor(private cancellationToken: ts.CancellationToken = CancellationToken.None) { } @@ -199,13 +200,21 @@ module Harness.LanguageService { /// Returns json for Tools.CompilationSettings public getCompilationSettings(): string { - return JSON.stringify({}); // i.e. default settings + return JSON.stringify(this.settings); } public getCancellationToken(): ts.CancellationToken { return this.cancellationToken; } + public getCurrentDirectory(): string { + return ""; + } + + public getDefaultLibFilename(): string { + return ""; + } + public getScriptFileNames(): string { var fileNames: string[] = []; ts.forEachKey(this.fileNameToScript, (fileName) => { fileNames.push(fileName); }); @@ -236,6 +245,14 @@ module Harness.LanguageService { return this.ls; } + public setCompilationSettings(settings: ts.CompilationSettings) { + for (var key in settings) { + if (settings.hasOwnProperty(key)) { + this.settings[key] = settings[key]; + } + } + } + /** Return a new instance of the classifier service shim */ public getClassifier(): ts.ClassifierShim { return new TypeScript.Services.TypeScriptServicesFactory().createClassifierShim(this); diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index b0f3e939d30..2886c43f091 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -4,7 +4,7 @@ // Test case is json of below type in tests/cases/project/ interface ProjectRunnerTestCase { scenario: string; - projectRoot: string; // project where it lives - this also is the current dictory when compiling + projectRoot: string; // project where it lives - this also is the current directory when compiling inputFiles: string[]; // list of input files to be given to program out?: string; // --out outDir?: string; // --outDir @@ -22,7 +22,7 @@ interface ProjectRunnerTestCase { interface ProjectRunnerTestCaseResolutionInfo extends ProjectRunnerTestCase { // Apart from actual test case the results of the resolution resolvedInputFiles: string[]; // List of files that were asked to read by compiler - emittedFiles: string[]; // List of files that wre emitted by the compiler + emittedFiles: string[]; // List of files that were emitted by the compiler } interface BatchCompileProjectTestCaseEmittedFile extends Harness.Compiler.GeneratedFile { @@ -69,7 +69,7 @@ class ProjectRunner extends RunnerBase { testCase = JSON.parse(testFileText); } catch (e) { - assert(false, "Testcase: " + testCaseFileName + " doesnt not contain valid json format: " + e.message); + assert(false, "Testcase: " + testCaseFileName + " does not contain valid json format: " + e.message); } var testCaseJustName = testCaseFileName.replace(/^.*[\\\/]/, '').replace(/\.json/, ""); @@ -87,7 +87,7 @@ class ProjectRunner extends RunnerBase { } // When test case output goes to tests/baselines/local/projectOutput/testCaseName/moduleKind/ - // We have these two separate locations because when compairing baselines the baseline verifier will delete the existing file + // We have these two separate locations because when comparing baselines the baseline verifier will delete the existing file // so even if it was created by compiler in that location, the file will be deleted by verified before we can read it // so lets keep these two locations separate function getProjectOutputFolder(filename: string, moduleKind: ts.ModuleKind) { @@ -226,9 +226,10 @@ class ProjectRunner extends RunnerBase { ? filename : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(filename); - var diskRelativeName = ts.getRelativePathToDirectoryOrUrl(testCase.projectRoot, diskFileName, getCurrentDirectory(), false); + var diskRelativeName = ts.getRelativePathToDirectoryOrUrl(testCase.projectRoot, diskFileName, + getCurrentDirectory(), Harness.Compiler.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); if (ts.isRootedDiskPath(diskRelativeName) || diskRelativeName.substr(0, 3) === "../") { - // If the generated output file recides in the parent folder or is rooted path, + // If the generated output file resides in the parent folder or is rooted path, // we need to instead create files that can live in the project reference folder // but make sure extension of these files matches with the filename the compiler asked to write diskRelativeName = "diskFile" + nonSubfolderDiskFiles++ + @@ -299,13 +300,11 @@ class ProjectRunner extends RunnerBase { return { unitName: sourceFile.filename, content: sourceFile.text }; }); var diagnostics = ts.map(compilerResult.errors, error => Harness.Compiler.getMinimalDiagnostic(error)); - var errors = Harness.Compiler.minimalDiagnosticsToString(diagnostics); - errors += sys.newLine + sys.newLine + Harness.Compiler.getErrorBaseline(inputFiles, diagnostics); - return errors; + return Harness.Compiler.getErrorBaseline(inputFiles, diagnostics); } - describe('Compiling project for ' + testCase.scenario +': testcase ' + testCaseFileName, () => { + describe('Compiling project for ' + testCase.scenario + ': testcase ' + testCaseFileName, () => { function verifyCompilerResults(compilerResult: BatchCompileProjectTestCaseResult) { function getCompilerResolutionInfo() { var resolutionInfo: ProjectRunnerTestCaseResolutionInfo = { diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 2166de0e956..a9d90409d4b 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -164,9 +164,7 @@ module RWC { return null; } - return Harness.Compiler.minimalDiagnosticsToString(compilerResult.errors) + - sys.newLine + sys.newLine + - Harness.Compiler.getErrorBaseline(inputFiles.concat(otherFiles), compilerResult.errors); + return Harness.Compiler.getErrorBaseline(inputFiles.concat(otherFiles), compilerResult.errors); }, false, baselineOpts); }); diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 8fac5e45dab..5dfc75b29a5 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -67,8 +67,8 @@ class TypeWriterWalker { case ts.SyntaxKind.ContinueStatement: case ts.SyntaxKind.BreakStatement: return (parent).label === identifier; - case ts.SyntaxKind.LabelledStatement: - return (parent).label === identifier; + case ts.SyntaxKind.LabeledStatement: + return (parent).label === identifier; } return false; } @@ -76,7 +76,7 @@ class TypeWriterWalker { private log(node: ts.Node, type: ts.Type): void { var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos); var lineAndCharacter = this.currentSourceFile.getLineAndCharacterFromPosition(actualPos); - var sourceText = ts.getSourceTextOfNodeFromSourceText(this.currentSourceFile.text, node); + var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node); // If we got an unknown type, we temporarily want to fall back to just pretending the name // (source text) of the node is the type. This is to align with the old typeWriter to make @@ -86,7 +86,7 @@ class TypeWriterWalker { column: lineAndCharacter.character, syntaxKind: ts.SyntaxKind[node.kind], sourceText: sourceText, - type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation) + type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.WriteOwnNameForAnyLike) }); } diff --git a/src/harness/unittestrunner.ts b/src/harness/unittestrunner.ts index c91b82a0d96..95c90415409 100644 --- a/src/harness/unittestrunner.ts +++ b/src/harness/unittestrunner.ts @@ -7,7 +7,7 @@ class UnitTestRunner extends RunnerBase { } public initializeTests() { - this.tests = this.enumerateFiles('tests/cases/unittests/services'); + this.tests = this.enumerateFiles('tests/cases/unittests/services', /\.ts/i); var outfile = new Harness.Compiler.WriterAggregator() var outerr = new Harness.Compiler.WriterAggregator(); diff --git a/src/lib/extensions.d.ts b/src/lib/extensions.d.ts index 87b78018c7e..82cc129ecbc 100644 --- a/src/lib/extensions.d.ts +++ b/src/lib/extensions.d.ts @@ -63,14 +63,14 @@ interface Int8Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int8Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -121,14 +121,14 @@ interface Uint8Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint8Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -179,14 +179,14 @@ interface Int16Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int16Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -237,14 +237,14 @@ interface Uint16Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint16Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -295,14 +295,14 @@ interface Int32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Int32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -353,14 +353,14 @@ interface Uint32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Uint32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -411,14 +411,14 @@ interface Float32Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Float32Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; @@ -469,14 +469,14 @@ interface Float64Array extends ArrayBufferView { /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: Float64Array, offset?: number): void; /** * Sets a value or an array of values. - * @param A typed or untyped array of values to set. + * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ set(array: number[], offset?: number): void; diff --git a/src/services/braceMatcher.ts b/src/services/braceMatcher.ts deleted file mode 100644 index 3615f677024..00000000000 --- a/src/services/braceMatcher.ts +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/// - -module TypeScript.Services { - export class BraceMatcher { - - // Given a script name and position in the script, return a pair of text range if the - // position corresponds to a "brace matchin" characters (e.g. "{" or "(", etc.) - // If the position is not on any range, return an empty set. - public static getMatchSpans(syntaxTree: TypeScript.SyntaxTree, position: number): TypeScript.TextSpan[] { - var result: TypeScript.TextSpan[] = []; - - var token = findToken(syntaxTree.sourceUnit(), position); - - if (start(token) === position) { - var matchKind = BraceMatcher.getMatchingTokenKind(token); - - if (matchKind !== null) { - var parentElement = token.parent; - - for (var i = 0, n = childCount(parentElement); i < n; i++) { - var current = childAt(parentElement, i); - - if (current !== null && fullWidth(current) > 0) { - if (current.kind() === matchKind) { - var range1 = new TypeScript.TextSpan(start(token), width(token)); - var range2 = new TypeScript.TextSpan(start(current), width(current)); - if (range1.start() < range2.start()) { - result.push(range1, range2); - } - else { - result.push(range2, range1); - } - break; - } - } - } - } - } - - return result; - } - - private static getMatchingTokenKind(token: TypeScript.ISyntaxToken): TypeScript.SyntaxKind { - switch (token.kind()) { - case TypeScript.SyntaxKind.OpenBraceToken: return TypeScript.SyntaxKind.CloseBraceToken - case TypeScript.SyntaxKind.OpenParenToken: return TypeScript.SyntaxKind.CloseParenToken; - case TypeScript.SyntaxKind.OpenBracketToken: return TypeScript.SyntaxKind.CloseBracketToken; - case TypeScript.SyntaxKind.LessThanToken: return TypeScript.SyntaxKind.GreaterThanToken; - case TypeScript.SyntaxKind.CloseBraceToken: return TypeScript.SyntaxKind.OpenBraceToken - case TypeScript.SyntaxKind.CloseParenToken: return TypeScript.SyntaxKind.OpenParenToken; - case TypeScript.SyntaxKind.CloseBracketToken: return TypeScript.SyntaxKind.OpenBracketToken; - case TypeScript.SyntaxKind.GreaterThanToken: return TypeScript.SyntaxKind.LessThanToken; - } - - return null; - } - } -} \ No newline at end of file diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 12de22d3bd0..923458c144d 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. -/// - module TypeScript.Services.Breakpoints { function createBreakpointSpanInfo(parentElement: TypeScript.ISyntaxElement, ...childElements: TypeScript.ISyntaxElement[]): TextSpan { if (!parentElement) { @@ -798,7 +796,6 @@ module TypeScript.Services.Breakpoints { var container = Syntax.containingNode(varDeclarationNode); var varDeclarationSyntax = varDeclarationNode; var varDeclarators = varDeclarationSyntax.variableDeclarators; - var varDeclaratorsCount = childCount(varDeclarators); // varDeclarators has to be non null because its checked in canHaveBreakpoint if (container && container.kind() == TypeScript.SyntaxKind.VariableStatement) { return this.breakpointSpanOfVariableStatement(container); diff --git a/src/services/compiler/astWalker.ts b/src/services/compiler/astWalker.ts index 53d22142cbb..9f6897c4e1e 100644 --- a/src/services/compiler/astWalker.ts +++ b/src/services/compiler/astWalker.ts @@ -42,6 +42,10 @@ module TypeScript { walker.walk(preAst.typeArguments); } + function walkTupleTypeChildren(preAst: TupleTypeSyntax, walker: AstWalker): void { + walker.walk(preAst.types); + } + function walkTypeOfExpressionChildren(preAst: TypeOfExpressionSyntax, walker: AstWalker): void { walker.walk(preAst.expression); } @@ -561,6 +565,7 @@ module TypeScript { childrenWalkers[SyntaxKind.TriviaList] = null; childrenWalkers[SyntaxKind.TrueKeyword] = null; childrenWalkers[SyntaxKind.TryStatement] = walkTryStatementChildren; + childrenWalkers[SyntaxKind.TupleType] = walkTupleTypeChildren; childrenWalkers[SyntaxKind.TypeAnnotation] = walkTypeAnnotationChildren; childrenWalkers[SyntaxKind.TypeArgumentList] = walkTypeArgumentListChildren; childrenWalkers[SyntaxKind.TypeOfExpression] = walkTypeOfExpressionChildren; diff --git a/src/services/compiler/references.ts b/src/services/compiler/references.ts index 07ec0fa6043..b2d605d595f 100644 --- a/src/services/compiler/references.ts +++ b/src/services/compiler/references.ts @@ -12,7 +12,6 @@ ///// ///// ///// -///// ///// ///// ///// diff --git a/src/services/compiler/types.ts b/src/services/compiler/types.ts deleted file mode 100644 index 28bef81629b..00000000000 --- a/src/services/compiler/types.ts +++ /dev/null @@ -1,102 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/// - -module TypeScript { - export class MemberName { - public prefix: string = ""; - public suffix: string = ""; - - public isString() { return false; } - public isArray() { return false; } - public isMarker() { return !this.isString() && !this.isArray(); } - - public toString(): string { - return MemberName.memberNameToString(this); - } - - static memberNameToString(memberName: MemberName, markerInfo?: number[], markerBaseLength: number = 0): string { - var result = memberName.prefix; - - if (memberName.isString()) { - result += (memberName).text; - } - else if (memberName.isArray()) { - var ar = memberName; - for (var index = 0; index < ar.entries.length; index++) { - if (ar.entries[index].isMarker()) { - if (markerInfo) { - markerInfo.push(markerBaseLength + result.length); - } - continue; - } - - result += MemberName.memberNameToString(ar.entries[index], markerInfo, markerBaseLength + result.length); - result += ar.delim; - } - } - - result += memberName.suffix; - return result; - } - - static create(text: string): MemberName; - static create(entry: MemberName, prefix: string, suffix: string): MemberName; - static create(arg1: any, arg2?: any, arg3?: any): MemberName { - if (typeof arg1 === "string") { - return new MemberNameString(arg1); - } - else { - var result = new MemberNameArray(); - if (arg2) - result.prefix = arg2; - if (arg3) - result.suffix = arg3; - result.entries.push(arg1); - return result; - } - } - } - - export class MemberNameString extends MemberName { - constructor(public text: string) { - super(); - } - - public isString() { return true; } - } - - export class MemberNameArray extends MemberName { - public delim: string = ""; - public entries: MemberName[] = []; - - public isArray() { return true; } - - public add(entry: MemberName) { - this.entries.push(entry); - } - - public addAll(entries: MemberName[]) { - for (var i = 0 ; i < entries.length; i++) { - this.entries.push(entries[i]); - } - } - - constructor() { - super(); - } - } -} \ No newline at end of file diff --git a/src/services/core/diagnosticCore.ts b/src/services/core/diagnosticCore.ts index b4d95a1c60b..369b8114eac 100644 --- a/src/services/core/diagnosticCore.ts +++ b/src/services/core/diagnosticCore.ts @@ -1,8 +1,6 @@ /// module TypeScript { - export var LocalizedDiagnosticMessages: ts.Map = null; - export class Location { private _fileName: string; private _lineMap: LineMap; diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index c334e1864ab..7570ef936c7 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -36,5 +36,4 @@ /// /// /// -/// /// \ No newline at end of file diff --git a/src/services/formatting/formattingManager.ts b/src/services/formatting/formattingManager.ts index 359f19c84ed..727c97cce30 100644 --- a/src/services/formatting/formattingManager.ts +++ b/src/services/formatting/formattingManager.ts @@ -112,9 +112,11 @@ module TypeScript.Services.Formatting { // // TODO: Change the ILanguageService interface to return TextEditInfo (with start, and length) instead of TextEdit (with minChar and limChar) - formattingEdits.forEach((item) => { - var edit = new ts.TextChange(new TextSpan(item.position, item.length), item.replaceWith); - result.push(edit); + formattingEdits.forEach(item => { + result.push({ + span: new TextSpan(item.position, item.length), + newText: item.replaceWith + }); }); return result; diff --git a/src/services/formatting/singleTokenIndenter.ts b/src/services/formatting/singleTokenIndenter.ts deleted file mode 100644 index 896c2e8ac01..00000000000 --- a/src/services/formatting/singleTokenIndenter.ts +++ /dev/null @@ -1,46 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/// - -module TypeScript.Services.Formatting { - export class SingleTokenIndenter extends IndentationTrackingWalker { - private indentationAmount: number = null; - private indentationPosition: number; - - constructor(indentationPosition: number, sourceUnit: SourceUnitSyntax, snapshot: ITextSnapshot, indentFirstToken: boolean, options: FormattingOptions) { - super(new TextSpan(indentationPosition, 1), sourceUnit, snapshot, indentFirstToken, options); - - this.indentationPosition = indentationPosition; - } - - public static getIndentationAmount(position: number, sourceUnit: SourceUnitSyntax, snapshot: ITextSnapshot, options: FormattingOptions): number { - var walker = new SingleTokenIndenter(position, sourceUnit, snapshot, true, options); - visitNodeOrToken(walker, sourceUnit); - return walker.indentationAmount; - } - - public indentToken(token: ISyntaxToken, indentationAmount: number, commentIndentationAmount: number): void { - // Compute an indentation string for this token - if (token.fullWidth() === 0 || (this.indentationPosition - this.position() < token.leadingTriviaWidth())) { - // The position is in the leading trivia, use comment indentation - this.indentationAmount = commentIndentationAmount; - } - else { - this.indentationAmount = indentationAmount; - } - } - } -} \ No newline at end of file diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts new file mode 100644 index 00000000000..79b238c893d --- /dev/null +++ b/src/services/formatting/smartIndenter.ts @@ -0,0 +1,396 @@ +/// + +module ts.formatting { + export module SmartIndenter { + export function getIndentation(position: number, sourceFile: SourceFile, options: TypeScript.FormattingOptions): number { + if (position > sourceFile.text.length) { + return 0; // past EOF + } + + var precedingToken = findPrecedingToken(position, sourceFile); + if (!precedingToken) { + return 0; + } + + // no indentation in string \regex literals + if ((precedingToken.kind === SyntaxKind.StringLiteral || precedingToken.kind === SyntaxKind.RegularExpressionLiteral) && + precedingToken.getStart(sourceFile) <= position && + precedingToken.end > position) { + return 0; + } + + var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; + + if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) { + // previous token is comma that separates items in list - find the previous item and try to derive indentation from it + var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + } + + // try to find node that can contribute to indentation and includes 'position' starting from 'precedingToken' + // if such node is found - compute initial indentation for 'position' inside this node + var previous: Node; + var current = precedingToken; + var currentStart: LineAndCharacter; + var indentationDelta: number; + + while (current) { + if (positionBelongsToNode(current, position, sourceFile) && nodeContentIsIndented(current, previous)) { + currentStart = getStartLineAndCharacterForNode(current, sourceFile); + + if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { + indentationDelta = 0; + } + else { + indentationDelta = lineAtPosition !== currentStart.line ? options.indentSpaces : 0; + } + + break; + } + + // check if current node is a list item - if yes, take indentation from it + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + + previous = current; + current = current.parent; + } + + if (!current) { + // no parent was found - return 0 to be indented on the level of SourceFile + return 0; + } + + + var parent: Node = current.parent; + var parentStart: LineAndCharacter; + + // walk upwards and collect indentations for pairs of parent-child nodes + // indentation is not added if parent and child nodes start on the same line or if parent is IfStatement and child starts on the same line with 'else clause' + while (parent) { + // check if current node is a list item - if yes, take indentation from it + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + + parentStart = sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + var parentAndChildShareLine = + parentStart.line === currentStart.line || + childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + + // try to fetch actual indentation for current node from source text + var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + + // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line + if (nodeContentIsIndented(parent, current) && !parentAndChildShareLine) { + indentationDelta += options.indentSpaces; + } + + current = parent; + currentStart = parentStart; + parent = current.parent; + } + + return indentationDelta; + } + + /* + * Function returns -1 if indentation cannot be determined + */ + function getActualIndentationForListItemBeforeComma(commaToken: Node, sourceFile: SourceFile, options: TypeScript.FormattingOptions): number { + // previous token is comma that separates items in list - find the previous item and try to derive indentation from it + var commaItemInfo = findListItemInfo(commaToken); + Debug.assert(commaItemInfo.listItemIndex > 0); + // The item we're interested in is right before the comma + return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); + } + + /* + * Function returns -1 if actual indentation for node should not be used (i.e because node is nested expression) + */ + function getActualIndentationForNode(current: Node, + parent: Node, + currentLineAndChar: LineAndCharacter, + parentAndChildShareLine: boolean, + sourceFile: SourceFile, + options: TypeScript.FormattingOptions): number { + + // actual indentation is used for statements\declarations if one of cases below is true: + // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually + // - parent and child are not on the same line + var useActualIndentation = + (isDeclaration(current) || isStatement(current)) && + (parent.kind === SyntaxKind.SourceFile || !parentAndChildShareLine); + + if (!useActualIndentation) { + return -1; + } + + return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); + } + + function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken: Node, current: Node, lineAtPosition: number, sourceFile: SourceFile): boolean { + var nextToken = findNextToken(precedingToken, current); + if (!nextToken) { + return false; + } + + if (nextToken.kind === SyntaxKind.OpenBraceToken) { + // open braces are always indented at the parent level + return true; + } + else if (nextToken.kind === SyntaxKind.CloseBraceToken) { + // close braces are indented at the parent level if they are located on the same line with cursor + // this means that if new line will be added at $ position, this case will be indented + // class A { + // $ + // } + /// and this one - not + // class A { + // $} + + var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; + return lineAtPosition === nextTokenStartLine; + } + + return false; + } + + function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { + return sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + } + + function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean { + return candidate.end > position || !isCompletedNode(candidate, sourceFile); + } + + function childStartsOnTheSameLineWithElseInIfStatement(parent: Node, child: Node, childStartLine: number, sourceFile: SourceFile): boolean { + if (parent.kind === SyntaxKind.IfStatement && (parent).elseStatement === child) { + var elseKeyword = findChildOfKind(parent, SyntaxKind.ElseKeyword, sourceFile); + Debug.assert(elseKeyword); + + var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + return elseKeywordStartLine === childStartLine; + } + } + + function getActualIndentationForListItem(node: Node, sourceFile: SourceFile, options: TypeScript.FormattingOptions): number { + if (node.parent) { + switch (node.parent.kind) { + case SyntaxKind.TypeReference: + if ((node.parent).typeArguments) { + return getActualIndentationFromList((node.parent).typeArguments); + } + break; + case SyntaxKind.ObjectLiteral: + return getActualIndentationFromList((node.parent).properties); + case SyntaxKind.TypeLiteral: + return getActualIndentationFromList((node.parent).members); + case SyntaxKind.ArrayLiteral: + return getActualIndentationFromList((node.parent).elements); + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.ArrowFunction: + case SyntaxKind.Method: + case SyntaxKind.CallSignature: + case SyntaxKind.ConstructSignature: + if ((node.parent).typeParameters && node.end < (node.parent).typeParameters.end) { + return getActualIndentationFromList((node.parent).typeParameters); + } + + return getActualIndentationFromList((node.parent).parameters); + case SyntaxKind.NewExpression: + case SyntaxKind.CallExpression: + if ((node.parent).typeArguments && node.end < (node.parent).typeArguments.end) { + return getActualIndentationFromList((node.parent).typeArguments); + } + + return getActualIndentationFromList((node.parent).arguments); + } + } + + return -1; + + function getActualIndentationFromList(list: Node[]): number { + var index = indexOf(list, node); + return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1; + } + } + + + function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: TypeScript.FormattingOptions): number { + Debug.assert(index >= 0 && index < list.length); + var node = list[index]; + + // walk toward the start of the list starting from current node and check if the line is the same for all items. + // if end line for item [i - 1] differs from the start line for item [i] - find column of the first non-whitespace character on the line of item [i] + var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); + for (var i = index - 1; i >= 0; --i) { + if (list[i].kind === SyntaxKind.CommaToken) { + continue; + } + // skip list items that ends on the same line with the current list element + var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line; + if (prevEndLine !== lineAndCharacter.line) { + return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); + } + + lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile); + } + return -1; + } + + function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: TypeScript.FormattingOptions): number { + var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1); + var column = 0; + for (var i = 0; i < lineAndCharacter.character; ++i) { + var charCode = sourceFile.text.charCodeAt(lineStart + i); + if (!isWhiteSpace(charCode)) { + return column; + } + + if (charCode === CharacterCodes.tab) { + column += options.spacesPerTab; + } + else { + column++; + } + } + + return column; + } + + function nodeContentIsIndented(parent: Node, child: Node): boolean { + switch (parent.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.EnumDeclaration: + return true; + case SyntaxKind.ModuleDeclaration: + // ModuleBlock should take care of indentation + return false; + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.Method: + case SyntaxKind.FunctionExpression: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.Constructor: + // FunctionBlock should take care of indentation + return false; + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.ForStatement: + return child && child.kind !== SyntaxKind.Block; + case SyntaxKind.IfStatement: + return child && child.kind !== SyntaxKind.Block; + case SyntaxKind.TryStatement: + // TryBlock\CatchBlock\FinallyBlock should take care of indentation + return false; + case SyntaxKind.ArrayLiteral: + case SyntaxKind.Block: + case SyntaxKind.FunctionBlock: + case SyntaxKind.TryBlock: + case SyntaxKind.CatchBlock: + case SyntaxKind.FinallyBlock: + case SyntaxKind.ModuleBlock: + case SyntaxKind.ObjectLiteral: + case SyntaxKind.TypeLiteral: + case SyntaxKind.SwitchStatement: + case SyntaxKind.DefaultClause: + case SyntaxKind.CaseClause: + case SyntaxKind.ParenExpression: + case SyntaxKind.CallExpression: + case SyntaxKind.NewExpression: + case SyntaxKind.VariableStatement: + case SyntaxKind.VariableDeclaration: + return true; + default: + return false; + } + } + + /* + * Checks if node ends with 'expectedLastToken'. + * If child at position 'length - 1' is 'SemicolonToken' it is skipped and 'expectedLastToken' is compared with child at position 'length - 2'. + */ + function nodeEndsWith(n: Node, expectedLastToken: SyntaxKind, sourceFile: SourceFile): boolean { + var children = n.getChildren(sourceFile); + if (children.length) { + var last = children[children.length - 1]; + if (last.kind === expectedLastToken) { + return true; + } + else if (last.kind === SyntaxKind.SemicolonToken && children.length !== 1) { + return children[children.length - 2].kind === expectedLastToken; + } + } + return false; + } + + /* + * This function is always called when position of the cursor is located after the node + */ + function isCompletedNode(n: Node, sourceFile: SourceFile): boolean { + switch (n.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ObjectLiteral: + case SyntaxKind.Block: + case SyntaxKind.CatchBlock: + case SyntaxKind.FinallyBlock: + case SyntaxKind.FunctionBlock: + case SyntaxKind.ModuleBlock: + case SyntaxKind.SwitchStatement: + return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile); + case SyntaxKind.ParenExpression: + case SyntaxKind.CallSignature: + case SyntaxKind.CallExpression: + case SyntaxKind.ConstructSignature: + return nodeEndsWith(n, SyntaxKind.CloseParenToken, sourceFile); + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.Method: + case SyntaxKind.ArrowFunction: + return !(n).body || isCompletedNode((n).body, sourceFile); + case SyntaxKind.ModuleDeclaration: + return (n).body && isCompletedNode((n).body, sourceFile); + case SyntaxKind.IfStatement: + if ((n).elseStatement) { + return isCompletedNode((n).elseStatement, sourceFile); + } + return isCompletedNode((n).thenStatement, sourceFile); + case SyntaxKind.ExpressionStatement: + return isCompletedNode((n).expression, sourceFile); + case SyntaxKind.ArrayLiteral: + return nodeEndsWith(n, SyntaxKind.CloseBracketToken, sourceFile); + case SyntaxKind.Missing: + return false; + case SyntaxKind.CaseClause: + case SyntaxKind.DefaultClause: + // there is no such thing as terminator token for CaseClause\DefaultClause so for simplicitly always consider them non-completed + return false; + case SyntaxKind.WhileStatement: + return isCompletedNode((n).statement, sourceFile); + case SyntaxKind.DoStatement: + // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; + var hasWhileKeyword = findChildOfKind(n, SyntaxKind.WhileKeyword, sourceFile); + if(hasWhileKeyword) { + return nodeEndsWith(n, SyntaxKind.CloseParenToken, sourceFile); + } + return isCompletedNode((n).statement, sourceFile); + default: + return true; + } + } + } +} \ No newline at end of file diff --git a/src/services/getScriptLexicalStructureWalker.ts b/src/services/getScriptLexicalStructureWalker.ts deleted file mode 100644 index bfce8e0067c..00000000000 --- a/src/services/getScriptLexicalStructureWalker.ts +++ /dev/null @@ -1,351 +0,0 @@ -/// - -module TypeScript.Services { - export class NavigationBarItemGetter { - private hasGlobalNode = false; - - private getIndent(node: ISyntaxNode): number { - var indent = this.hasGlobalNode ? 1 : 0; - - var current = node.parent; - while (current != null) { - if (current.kind() == SyntaxKind.ModuleDeclaration || current.kind() === SyntaxKind.FunctionDeclaration) { - indent++; - } - - current = current.parent; - } - - return indent; - } - - private getKindModifiers(modifiers: TypeScript.ISyntaxToken[]): string { - var result: string[] = []; - - for (var i = 0, n = modifiers.length; i < n; i++) { - result.push(modifiers[i].text()); - } - - return result.length > 0 ? result.join(',') : ts.ScriptElementKindModifier.none; - } - - public getItems(node: TypeScript.SourceUnitSyntax): ts.NavigationBarItem[] { - return this.getItemsWorker(() => this.getTopLevelNodes(node), n => this.createTopLevelItem(n)); - } - - private getChildNodes(nodes: IModuleElementSyntax[]): ISyntaxNode[] { - var childNodes: ISyntaxNode[] = []; - - for (var i = 0, n = nodes.length; i < n; i++) { - var node = nodes[i]; - - if (node.kind() === SyntaxKind.FunctionDeclaration) { - childNodes.push(node); - } - else if (node.kind() === SyntaxKind.VariableStatement) { - var variableDeclaration = (node).variableDeclaration; - childNodes.push.apply(childNodes, variableDeclaration.variableDeclarators); - } - } - - return childNodes; - } - - private getTopLevelNodes(node: SourceUnitSyntax): ISyntaxNode[] { - var topLevelNodes: ISyntaxNode[] = []; - topLevelNodes.push(node); - - this.addTopLevelNodes(node.moduleElements, topLevelNodes); - - return topLevelNodes; - } - - private addTopLevelNodes(nodes: IModuleElementSyntax[], topLevelNodes: ISyntaxNode[]): void { - for (var i = 0, n = nodes.length; i < n; i++) { - var node = nodes[i]; - switch (node.kind()) { - case SyntaxKind.ClassDeclaration: - case SyntaxKind.EnumDeclaration: - case SyntaxKind.InterfaceDeclaration: - topLevelNodes.push(node); - break; - - case SyntaxKind.ModuleDeclaration: - var moduleDeclaration = node; - topLevelNodes.push(node); - this.addTopLevelNodes(moduleDeclaration.moduleElements, topLevelNodes); - break; - - case SyntaxKind.FunctionDeclaration: - var functionDeclaration = node; - if (this.isTopLevelFunctionDeclaration(functionDeclaration)) { - topLevelNodes.push(node); - this.addTopLevelNodes(functionDeclaration.block.statements, topLevelNodes); - } - break; - } - } - } - - public isTopLevelFunctionDeclaration(functionDeclaration: FunctionDeclarationSyntax) { - // A function declaration is 'top level' if it contains any function declarations - // within it. - return functionDeclaration.block && ArrayUtilities.any(functionDeclaration.block.statements, s => s.kind() === SyntaxKind.FunctionDeclaration); - } - - private getItemsWorker(getNodes: () => ISyntaxNode[], createItem: (n: ISyntaxNode) => ts.NavigationBarItem): ts.NavigationBarItem[] { - var items: ts.NavigationBarItem[] = []; - - var keyToItem = createIntrinsicsObject(); - - var nodes = getNodes(); - for (var i = 0, n = nodes.length; i < n; i++) { - var child = nodes[i]; - var item = createItem(child); - if (item != null) { - if (item.text.length > 0) { - var key = item.text + "-" + item.kind; - - var itemWithSameName = keyToItem[key]; - if (itemWithSameName) { - // We had an item with the same name. Merge these items together. - this.merge(itemWithSameName, item); - } - else { - keyToItem[key] = item; - items.push(item); - } - } - } - } - - return items; - } - - private merge(target: ts.NavigationBarItem, source: ts.NavigationBarItem) { - // First, add any spans in the source to the target. - target.spans.push.apply(target.spans, source.spans); - - if (source.childItems) { - if (!target.childItems) { - target.childItems = []; - } - - // Next, recursively merge or add any children in the source as appropriate. - outer: - for (var i = 0, n = source.childItems.length; i < n; i++) { - var sourceChild = source.childItems[i]; - - for (var j = 0, m = target.childItems.length; j < m; j++) { - var targetChild = target.childItems[j]; - - if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { - // Found a match. merge them. - this.merge(targetChild, sourceChild); - continue outer; - } - } - - // Didn't find a match, just add this child to the list. - target.childItems.push(sourceChild); - } - } - } - - private createChildItem(node: ISyntaxNode): ts.NavigationBarItem { - switch (node.kind()) { - case SyntaxKind.Parameter: - var parameter = node; - if (parameter.modifiers.length === 0) { - return null; - } - return new ts.NavigationBarItem(parameter.identifier.text(), ts.ScriptElementKind.memberVariableElement, this.getKindModifiers(parameter.modifiers), [TextSpan.fromBounds(start(node), end(node))]); - - case SyntaxKind.MemberFunctionDeclaration: - var memberFunction = node; - return new ts.NavigationBarItem(memberFunction.propertyName.text(), ts.ScriptElementKind.memberFunctionElement, this.getKindModifiers(memberFunction.modifiers), [TextSpan.fromBounds(start(node), end(node))]); - - case SyntaxKind.GetAccessor: - var getAccessor = node; - return new ts.NavigationBarItem(getAccessor.propertyName.text(), ts.ScriptElementKind.memberGetAccessorElement, this.getKindModifiers(getAccessor.modifiers), [TextSpan.fromBounds(start(node), end(node))]); - - case SyntaxKind.SetAccessor: - var setAccessor = node; - return new ts.NavigationBarItem(setAccessor.propertyName.text(), ts.ScriptElementKind.memberSetAccessorElement, this.getKindModifiers(setAccessor.modifiers), [TextSpan.fromBounds(start(node), end(node))]); - - case SyntaxKind.IndexSignature: - var indexSignature = node; - return new ts.NavigationBarItem("[]", ts.ScriptElementKind.indexSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]); - - case SyntaxKind.EnumElement: - var enumElement = node; - return new ts.NavigationBarItem(enumElement.propertyName.text(), ts.ScriptElementKind.memberVariableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]); - - case SyntaxKind.CallSignature: - var callSignature = node; - return new ts.NavigationBarItem("()", ts.ScriptElementKind.callSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]); - - case SyntaxKind.ConstructSignature: - var constructSignature = node; - return new ts.NavigationBarItem("new()", ts.ScriptElementKind.constructSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]); - - case SyntaxKind.MethodSignature: - var methodSignature = node; - return new ts.NavigationBarItem(methodSignature.propertyName.text(), ts.ScriptElementKind.memberFunctionElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]); - - case SyntaxKind.PropertySignature: - var propertySignature = node; - return new ts.NavigationBarItem(propertySignature.propertyName.text(), ts.ScriptElementKind.memberVariableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]); - - case SyntaxKind.FunctionDeclaration: - var functionDeclaration = node; - if (!this.isTopLevelFunctionDeclaration(functionDeclaration)) { - return new ts.NavigationBarItem(functionDeclaration.identifier.text(), ts.ScriptElementKind.functionElement, this.getKindModifiers(functionDeclaration.modifiers), [TextSpan.fromBounds(start(node), end(node))]); - } - break; - - case SyntaxKind.MemberVariableDeclaration: - var memberVariableDeclaration = node; - return new ts.NavigationBarItem(memberVariableDeclaration.variableDeclarator.propertyName.text(), ts.ScriptElementKind.memberVariableElement, this.getKindModifiers(memberVariableDeclaration.modifiers), [TextSpan.fromBounds(start(memberVariableDeclaration.variableDeclarator), end(memberVariableDeclaration.variableDeclarator))]); - - case SyntaxKind.VariableDeclarator: - var variableDeclarator = node; - return new ts.NavigationBarItem(variableDeclarator.propertyName.text(), ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(variableDeclarator), end(variableDeclarator))]); - - case SyntaxKind.ConstructorDeclaration: - var constructorDeclaration = node; - return new ts.NavigationBarItem("constructor", ts.ScriptElementKind.constructorImplementationElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]); - } - - return null; - } - - private createTopLevelItem(node: ISyntaxNode): ts.NavigationBarItem { - switch (node.kind()) { - case SyntaxKind.SourceUnit: - return this.createSourceUnitItem(node); - - case SyntaxKind.ClassDeclaration: - return this.createClassItem(node); - - case SyntaxKind.EnumDeclaration: - return this.createEnumItem(node); - - case SyntaxKind.InterfaceDeclaration: - return this.createIterfaceItem(node); - - case SyntaxKind.ModuleDeclaration: - return this.createModuleItem(node); - - case SyntaxKind.FunctionDeclaration: - return this.createFunctionItem(node); - } - - return null; - } - - private getModuleNames(node: TypeScript.ModuleDeclarationSyntax): string[] { - var result: string[] = []; - - if (node.stringLiteral) { - result.push(node.stringLiteral.text()); - } - else { - this.getModuleNamesHelper(node.name, result); - } - - return result; - } - - private getModuleNamesHelper(name: TypeScript.INameSyntax, result: string[]): void { - if (name.kind() === TypeScript.SyntaxKind.QualifiedName) { - var qualifiedName = name; - this.getModuleNamesHelper(qualifiedName.left, result); - result.push(qualifiedName.right.text()); - } - else { - result.push((name).text()); - } - } - - private createModuleItem(node: ModuleDeclarationSyntax): ts.NavigationBarItem { - var moduleNames = this.getModuleNames(node); - - var childItems = this.getItemsWorker(() => this.getChildNodes(node.moduleElements), n => this.createChildItem(n)); - - return new ts.NavigationBarItem(moduleNames.join("."), - ts.ScriptElementKind.moduleElement, - this.getKindModifiers(node.modifiers), - [TextSpan.fromBounds(start(node), end(node))], - childItems, - this.getIndent(node)); - } - - private createFunctionItem(node: FunctionDeclarationSyntax) { - var childItems = this.getItemsWorker(() => node.block.statements, n => this.createChildItem(n)); - - return new ts.NavigationBarItem(node.identifier.text(), - ts.ScriptElementKind.functionElement, - this.getKindModifiers(node.modifiers), - [TextSpan.fromBounds(start(node), end(node))], - childItems, - this.getIndent(node)); - } - - private createSourceUnitItem(node: SourceUnitSyntax): ts.NavigationBarItem { - var childItems = this.getItemsWorker(() => this.getChildNodes(node.moduleElements), n => this.createChildItem(n)); - - if (childItems === null || childItems.length === 0) { - return null; - } - - this.hasGlobalNode = true; - return new ts.NavigationBarItem("", - ts.ScriptElementKind.moduleElement, - ts.ScriptElementKindModifier.none, - [TextSpan.fromBounds(start(node), end(node))], - childItems); - } - - private createClassItem(node: ClassDeclarationSyntax): ts.NavigationBarItem { - var constructor = ArrayUtilities.firstOrDefault( - node.classElements, n => n.kind() === SyntaxKind.ConstructorDeclaration); - - // Add the constructor parameters in as children of hte class (for property parameters). - var nodes: ISyntaxNode[] = constructor - ? (constructor.callSignature.parameterList.parameters).concat(node.classElements) - : node.classElements; - - var childItems = this.getItemsWorker(() => nodes, n => this.createChildItem(n)); - return new ts.NavigationBarItem( - node.identifier.text(), - ts.ScriptElementKind.classElement, - this.getKindModifiers(node.modifiers), - [TextSpan.fromBounds(start(node), end(node))], - childItems, - this.getIndent(node)); - } - - private createEnumItem(node: TypeScript.EnumDeclarationSyntax): ts.NavigationBarItem { - var childItems = this.getItemsWorker(() => node.enumElements, n => this.createChildItem(n)); - return new ts.NavigationBarItem( - node.identifier.text(), - ts.ScriptElementKind.enumElement, - this.getKindModifiers(node.modifiers), - [TextSpan.fromBounds(start(node), end(node))], - childItems, - this.getIndent(node)); - } - - private createIterfaceItem(node: TypeScript.InterfaceDeclarationSyntax): ts.NavigationBarItem { - var childItems = this.getItemsWorker(() => node.body.typeMembers, n => this.createChildItem(n)); - return new ts.NavigationBarItem( - node.identifier.text(), - ts.ScriptElementKind.interfaceElement, - this.getKindModifiers(node.modifiers), - [TextSpan.fromBounds(start(node), end(node))], - childItems, - this.getIndent(node)); - } - } -} \ No newline at end of file diff --git a/src/services/indentation.ts b/src/services/indentation.ts index b067e817d99..6616cdd3448 100644 --- a/src/services/indentation.ts +++ b/src/services/indentation.ts @@ -1,4 +1,3 @@ -/// module TypeScript.Indentation { export function columnForEndOfTokenAtPosition(syntaxTree: SyntaxTree, position: number, options: FormattingOptions): number { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts new file mode 100644 index 00000000000..9f16fa57741 --- /dev/null +++ b/src/services/navigationBar.ts @@ -0,0 +1,426 @@ +/// +/// + +module ts.NavigationBar { + export function getNavigationBarItems(sourceFile: SourceFile): ts.NavigationBarItem[] { + // If the source file has any child items, then it included in the tree + // and takes lexical ownership of all other top-level items. + var hasGlobalNode = false; + + return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem); + + function getIndent(node: Node): number { + // If we have a global node in the tree, + // then it adds an extra layer of depth to all subnodes. + var indent = hasGlobalNode ? 1 : 0; + + var current = node.parent; + while (current) { + switch (current.kind) { + case SyntaxKind.ModuleDeclaration: + // If we have a module declared as A.B.C, it is more "intuitive" + // to say it only has a single layer of depth + do { + current = current.parent; + } + while (current.kind === SyntaxKind.ModuleDeclaration); + + // fall through + case SyntaxKind.ClassDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.FunctionDeclaration: + indent++; + } + + current = current.parent; + } + + return indent; + } + + function getChildNodes(nodes: Node[]): Node[] { + var childNodes: Node[] = []; + + for (var i = 0, n = nodes.length; i < n; i++) { + var node = nodes[i]; + + if (node.kind === SyntaxKind.ClassDeclaration || + node.kind === SyntaxKind.EnumDeclaration || + node.kind === SyntaxKind.InterfaceDeclaration || + node.kind === SyntaxKind.ModuleDeclaration || + node.kind === SyntaxKind.FunctionDeclaration) { + + childNodes.push(node); + } + else if (node.kind === SyntaxKind.VariableStatement) { + childNodes.push.apply(childNodes, (node).declarations); + } + } + + return sortNodes(childNodes); + } + + function getTopLevelNodes(node: SourceFile): Node[] { + var topLevelNodes: Node[] = []; + topLevelNodes.push(node); + + addTopLevelNodes(node.statements, topLevelNodes); + + return topLevelNodes; + } + + function sortNodes(nodes: Node[]): Node[] { + return nodes.slice(0).sort((n1: Declaration, n2: Declaration) => { + if (n1.name && n2.name) { + return n1.name.text.localeCompare(n2.name.text); + } + else if (n1.name) { + return 1; + } + else if (n2.name) { + -1; + } + else { + return n1.kind - n2.kind; + } + }); + } + + function addTopLevelNodes(nodes: Node[], topLevelNodes: Node[]): void { + nodes = sortNodes(nodes); + + for (var i = 0, n = nodes.length; i < n; i++) { + var node = nodes[i]; + switch (node.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.InterfaceDeclaration: + topLevelNodes.push(node); + break; + + case SyntaxKind.ModuleDeclaration: + var moduleDeclaration = node; + topLevelNodes.push(node); + addTopLevelNodes((getInnermostModule(moduleDeclaration).body).statements, topLevelNodes); + break; + + case SyntaxKind.FunctionDeclaration: + var functionDeclaration = node; + if (isTopLevelFunctionDeclaration(functionDeclaration)) { + topLevelNodes.push(node); + addTopLevelNodes((functionDeclaration.body).statements, topLevelNodes); + } + break; + } + } + } + + function isTopLevelFunctionDeclaration(functionDeclaration: FunctionDeclaration) { + if (functionDeclaration.kind === SyntaxKind.FunctionDeclaration) { + // A function declaration is 'top level' if it contains any function declarations + // within it. + if (functionDeclaration.body && functionDeclaration.body.kind === SyntaxKind.FunctionBlock) { + if (forEach((functionDeclaration.body).statements, + s => s.kind === SyntaxKind.FunctionDeclaration && !isEmpty((s).name.text))) { + + return true; + } + + // Or if it is not parented by another function. i.e all functions + // at module scope are 'top level'. + if (functionDeclaration.parent.kind !== SyntaxKind.FunctionBlock) { + return true; + } + } + } + + return false; + } + + function getItemsWorker(nodes: Node[], createItem: (n: Node) => ts.NavigationBarItem): ts.NavigationBarItem[] { + var items: ts.NavigationBarItem[] = []; + + var keyToItem: Map = {}; + + for (var i = 0, n = nodes.length; i < n; i++) { + var child = nodes[i]; + var item = createItem(child); + if (item !== undefined) { + if (item.text.length > 0) { + var key = item.text + "-" + item.kind + "-" + item.indent; + + var itemWithSameName = keyToItem[key]; + if (itemWithSameName) { + // We had an item with the same name. Merge these items together. + merge(itemWithSameName, item); + } + else { + keyToItem[key] = item; + items.push(item); + } + } + } + } + + return items; + } + + function merge(target: ts.NavigationBarItem, source: ts.NavigationBarItem) { + // First, add any spans in the source to the target. + target.spans.push.apply(target.spans, source.spans); + + if (source.childItems) { + if (!target.childItems) { + target.childItems = []; + } + + // Next, recursively merge or add any children in the source as appropriate. + outer: + for (var i = 0, n = source.childItems.length; i < n; i++) { + var sourceChild = source.childItems[i]; + + for (var j = 0, m = target.childItems.length; j < m; j++) { + var targetChild = target.childItems[j]; + + if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { + // Found a match. merge them. + merge(targetChild, sourceChild); + continue outer; + } + } + + // Didn't find a match, just add this child to the list. + target.childItems.push(sourceChild); + } + } + } + + function createChildItem(node: Node): ts.NavigationBarItem { + switch (node.kind) { + case SyntaxKind.Parameter: + if ((node.flags & NodeFlags.Modifier) === 0) { + return undefined; + } + + return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberVariableElement); + + case SyntaxKind.Method: + return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberFunctionElement); + + case SyntaxKind.GetAccessor: + return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberGetAccessorElement); + + case SyntaxKind.SetAccessor: + return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberSetAccessorElement); + + case SyntaxKind.IndexSignature: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + + case SyntaxKind.EnumMember: + return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberVariableElement); + + case SyntaxKind.CallSignature: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + + case SyntaxKind.ConstructSignature: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); + + case SyntaxKind.Property: + return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberVariableElement); + + case SyntaxKind.FunctionDeclaration: + return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.functionElement); + + case SyntaxKind.VariableDeclaration: + return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.variableElement); + + case SyntaxKind.Constructor: + return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); + } + + return undefined; + + function createItem(node: Node, name: string, scriptElementKind: string): NavigationBarItem { + return getNavigationBarItem(name, scriptElementKind, getNodeModifiers(node), [getNodeSpan(node)]); + } + } + + function isEmpty(text: string) { + return !text || text.trim() === ""; + } + + function getNavigationBarItem(text: string, kind: string, kindModifiers: string, spans: TypeScript.TextSpan[], childItems: ts.NavigationBarItem[] = [], indent: number = 0): ts.NavigationBarItem { + if (isEmpty(text)) { + return undefined; + } + + return { + text: text, + kind: kind, + kindModifiers: kindModifiers, + spans: spans, + childItems: childItems, + indent: indent, + bolded: false, + grayed: false + }; + } + + function createTopLevelItem(node: Node): ts.NavigationBarItem { + switch (node.kind) { + case SyntaxKind.SourceFile: + return createSourceFileItem(node); + + case SyntaxKind.ClassDeclaration: + return createClassItem(node); + + case SyntaxKind.EnumDeclaration: + return createEnumItem(node); + + case SyntaxKind.InterfaceDeclaration: + return createIterfaceItem(node); + + case SyntaxKind.ModuleDeclaration: + return createModuleItem(node); + + case SyntaxKind.FunctionDeclaration: + return createFunctionItem(node); + } + + return undefined; + + function getModuleName(moduleDeclaration: ModuleDeclaration): string { + // We want to maintain quotation marks. + if (moduleDeclaration.name.kind === SyntaxKind.StringLiteral) { + return getTextOfNode(moduleDeclaration.name); + } + + // Otherwise, we need to aggregate each identifier to build up the qualified name. + var result: string[] = []; + + result.push(moduleDeclaration.name.text); + + while (moduleDeclaration.body && moduleDeclaration.body.kind === SyntaxKind.ModuleDeclaration) { + moduleDeclaration = moduleDeclaration.body; + + result.push(moduleDeclaration.name.text); + } + + return result.join("."); + } + + function createModuleItem(node: ModuleDeclaration): NavigationBarItem { + var moduleName = getModuleName(node); + + var childItems = getItemsWorker(getChildNodes((getInnermostModule(node).body).statements), createChildItem); + + return getNavigationBarItem(moduleName, + ts.ScriptElementKind.moduleElement, + getNodeModifiers(node), + [getNodeSpan(node)], + childItems, + getIndent(node)); + } + + function createFunctionItem(node: FunctionDeclaration) { + if (node.name && node.body && node.body.kind === SyntaxKind.FunctionBlock) { + var childItems = getItemsWorker(sortNodes((node.body).statements), createChildItem); + + return getNavigationBarItem(node.name.text, + ts.ScriptElementKind.functionElement, + getNodeModifiers(node), + [getNodeSpan(node)], + childItems, + getIndent(node)); + } + + return undefined; + } + + function createSourceFileItem(node: SourceFile): ts.NavigationBarItem { + var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); + + if (childItems === undefined || childItems.length === 0) { + return undefined; + } + + hasGlobalNode = true; + var rootName = isExternalModule(node) ? + "\"" + escapeString(getBaseFilename(removeFileExtension(normalizePath(node.filename)))) + "\"" : + "" + + return getNavigationBarItem(rootName, + ts.ScriptElementKind.moduleElement, + ts.ScriptElementKindModifier.none, + [getNodeSpan(node)], + childItems); + } + + function createClassItem(node: ClassDeclaration): ts.NavigationBarItem { + var childItems: NavigationBarItem[]; + + if (node.members) { + var constructor = forEach(node.members, member => { + return member.kind === SyntaxKind.Constructor && member; + }); + + // Add the constructor parameters in as children of the class (for property parameters). + var nodes: Node[] = constructor + ? constructor.parameters.concat(node.members) + : node.members; + + var childItems = getItemsWorker(sortNodes(nodes), createChildItem); + } + + return getNavigationBarItem( + node.name.text, + ts.ScriptElementKind.classElement, + getNodeModifiers(node), + [getNodeSpan(node)], + childItems, + getIndent(node)); + } + + function createEnumItem(node: EnumDeclaration): ts.NavigationBarItem { + var childItems = getItemsWorker(sortNodes(node.members), createChildItem); + return getNavigationBarItem( + node.name.text, + ts.ScriptElementKind.enumElement, + getNodeModifiers(node), + [getNodeSpan(node)], + childItems, + getIndent(node)); + } + + function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem { + var childItems = getItemsWorker(sortNodes(node.members), createChildItem); + return getNavigationBarItem( + node.name.text, + ts.ScriptElementKind.interfaceElement, + getNodeModifiers(node), + [getNodeSpan(node)], + childItems, + getIndent(node)); + } + } + + function getInnermostModule(node: ModuleDeclaration): ModuleDeclaration { + while (node.body.kind === SyntaxKind.ModuleDeclaration) { + node = node.body; + } + + return node; + } + + function getNodeSpan(node: Node) { + return node.kind === SyntaxKind.SourceFile + ? TypeScript.TextSpan.fromBounds(node.getFullStart(), node.getEnd()) + : TypeScript.TextSpan.fromBounds(node.getStart(), node.getEnd()); + } + + function getTextOfNode(node: Node): string { + return getTextOfNodeFromSourceText(sourceFile.text, node); + } + } +} \ No newline at end of file diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 92440bfe760..aaaedb735ea 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -13,8 +13,6 @@ // limitations under the License. // -/// - module ts { export interface OutliningSpan { @@ -35,19 +33,32 @@ module ts { export module OutliningElementsCollector { export function collectElements(sourceFile: SourceFile): OutliningSpan[] { var elements: OutliningSpan[] = []; + var collapseText = "..."; - function addOutlineRange(hintSpanNode: Node, startElement: Node, endElement: Node) { + function addOutliningSpan(hintSpanNode: Node, startElement: Node, endElement: Node, autoCollapse: boolean) { if (hintSpanNode && startElement && endElement) { var span: OutliningSpan = { textSpan: TypeScript.TextSpan.fromBounds(startElement.pos, endElement.end), hintSpan: TypeScript.TextSpan.fromBounds(hintSpanNode.getStart(), hintSpanNode.end), - bannerText: "...", - autoCollapse: false + bannerText: collapseText, + autoCollapse: autoCollapse }; elements.push(span); } } + function autoCollapse(node: Node) { + switch (node.kind) { + case SyntaxKind.ModuleBlock: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.EnumDeclaration: + return false; + } + + return true; + } + var depth = 0; var maxDepth = 20; function walk(n: Node): void { @@ -56,23 +67,58 @@ module ts { } switch (n.kind) { case SyntaxKind.Block: + var parent = n.parent; + var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); + var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); + + // Check if the block is standalone, or 'attached' to some parent statement. + // If the latter, we want to collaps the block, but consider its hint span + // to be the entire span of the parent. + if (parent.kind === SyntaxKind.DoStatement || + parent.kind === SyntaxKind.ForInStatement || + parent.kind === SyntaxKind.ForStatement || + parent.kind === SyntaxKind.IfStatement || + parent.kind === SyntaxKind.WhileStatement || + parent.kind === SyntaxKind.WithStatement) { + + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + } + else { + // Block was a standalone block. In this case we want to only collapse + // the span of the block, independent of any parent span. + var span = TypeScript.TextSpan.fromBounds(n.getStart(), n.end); + elements.push({ + textSpan: span, + hintSpan: span, + bannerText: collapseText, + autoCollapse: autoCollapse(n) + }); + } + break; + + case SyntaxKind.FunctionBlock: case SyntaxKind.ModuleBlock: case SyntaxKind.TryBlock: - case SyntaxKind.TryBlock: case SyntaxKind.CatchBlock: case SyntaxKind.FinallyBlock: - var openBrace = forEach(n.getChildren(), c => c.kind === SyntaxKind.OpenBraceToken && c); - var closeBrace = forEach(n.getChildren(), c => c.kind === SyntaxKind.CloseBraceToken && c); - addOutlineRange(n.parent, openBrace, closeBrace); + var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); + var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); + addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.ObjectLiteral: - var openBrace = forEach(n.getChildren(), c => c.kind === SyntaxKind.OpenBraceToken && c); - var closeBrace = forEach(n.getChildren(), c => c.kind === SyntaxKind.CloseBraceToken && c); - addOutlineRange(n, openBrace, closeBrace); + case SyntaxKind.SwitchStatement: + var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); + var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); + addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); + break; + case SyntaxKind.ArrayLiteral: + var openBracket = findChildOfKind(n, SyntaxKind.OpenBracketToken, sourceFile); + var closeBracket = findChildOfKind(n, SyntaxKind.CloseBracketToken, sourceFile); + addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); break; } depth++; diff --git a/src/services/references.ts b/src/services/references.ts deleted file mode 100644 index f1f4245c122..00000000000 --- a/src/services/references.ts +++ /dev/null @@ -1,26 +0,0 @@ -///// -///// - -//// document.ts depends on incrementalParser.ts being run first. -///// -///// - -///// -///// -///// -///// -///// -///// -///// -///// -///// -///// -///// -///// -///// -///// -///// -///// -///// -///// -///// \ No newline at end of file diff --git a/src/services/services.ts b/src/services/services.ts index d51eeee97c0..b07d12919cd 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -6,11 +6,13 @@ /// /// -/// -/// +/// /// /// +/// +/// /// +/// /// /// @@ -21,30 +23,30 @@ /// /// /// -/// /// module ts { export interface Node { getSourceFile(): SourceFile; - getChildCount(): number; - getChildAt(index: number): Node; - getChildren(): Node[]; - getStart(): number; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): Node[]; + getStart(sourceFile?: SourceFile): number; getFullStart(): number; getEnd(): number; - getWidth(): number; + getWidth(sourceFile?: SourceFile): number; getFullWidth(): number; - getLeadingTriviaWidth(): number; - getFullText(): string; - getFirstToken(): Node; - getLastToken(): Node; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node; + getLastToken(sourceFile?: SourceFile): Node; } export interface Symbol { getFlags(): SymbolFlags; getName(): string; getDeclarations(): Declaration[]; + getDocumentationComment(): SymbolDisplayPart[]; } export interface Type { @@ -64,18 +66,20 @@ module ts { getTypeParameters(): Type[]; getParameters(): Symbol[]; getReturnType(): Type; + getDocumentationComment(): SymbolDisplayPart[]; } export interface SourceFile { getSourceUnit(): TypeScript.SourceUnitSyntax; getSyntaxTree(): TypeScript.SyntaxTree; getScriptSnapshot(): TypeScript.IScriptSnapshot; + getNamedDeclarations(): Declaration[]; update(scriptSnapshot: TypeScript.IScriptSnapshot, version: string, isOpen: boolean, textChangeRange: TypeScript.TextChangeRange): SourceFile; } - var scanner: Scanner = createScanner(ScriptTarget.ES5); + var scanner: Scanner = createScanner(ScriptTarget.ES5, /*skipTrivia*/ true); - var emptyArray: any [] = []; + var emptyArray: any[] = []; function createNode(kind: SyntaxKind, pos: number, end: number, flags: NodeFlags, parent?: Node): NodeObject { var node = new (getNodeConstructor(kind))(); @@ -95,13 +99,11 @@ module ts { private _children: Node[]; public getSourceFile(): SourceFile { - var node: Node = this; - while (node.kind !== SyntaxKind.SourceFile) node = node.parent; - return node; + return getSourceFileOfNode(this); } - public getStart(): number { - return getTokenPosOfNode(this); + public getStart(sourceFile?: SourceFile): number { + return getTokenPosOfNode(this, sourceFile); } public getFullStart(): number { @@ -112,20 +114,20 @@ module ts { return this.end; } - public getWidth(): number { - return this.getEnd() - this.getStart(); + public getWidth(sourceFile?: SourceFile): number { + return this.getEnd() - this.getStart(sourceFile); } public getFullWidth(): number { return this.end - this.getFullStart(); } - public getLeadingTriviaWidth(): number { - return this.getStart() - this.pos; + public getLeadingTriviaWidth(sourceFile?: SourceFile): number { + return this.getStart(sourceFile) - this.pos; } - public getFullText(): string { - return this.getSourceFile().text.substring(this.pos, this.end); + public getFullText(sourceFile?: SourceFile): string { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); } private addSyntheticNodes(nodes: Node[], pos: number, end: number): number { @@ -157,9 +159,9 @@ module ts { return list; } - private createChildren() { + private createChildren(sourceFile?: SourceFile) { if (this.kind > SyntaxKind.Missing) { - scanner.setText(this.getSourceFile().text); + scanner.setText((sourceFile || this.getSourceFile()).text); var children: Node[] = []; var pos = this.pos; var processNode = (node: Node) => { @@ -185,36 +187,36 @@ module ts { this._children = children || emptyArray; } - public getChildCount(): number { - if (!this._children) this.createChildren(); + public getChildCount(sourceFile?: SourceFile): number { + if (!this._children) this.createChildren(sourceFile); return this._children.length; } - public getChildAt(index: number): Node { - if (!this._children) this.createChildren(); + public getChildAt(index: number, sourceFile?: SourceFile): Node { + if (!this._children) this.createChildren(sourceFile); return this._children[index]; } - public getChildren(): Node[] { - if (!this._children) this.createChildren(); + public getChildren(sourceFile?: SourceFile): Node[] { + if (!this._children) this.createChildren(sourceFile); return this._children; } - public getFirstToken(): Node { + public getFirstToken(sourceFile?: SourceFile): Node { var children = this.getChildren(); for (var i = 0; i < children.length; i++) { var child = children[i]; if (child.kind < SyntaxKind.Missing) return child; - if (child.kind > SyntaxKind.Missing) return child.getFirstToken(); + if (child.kind > SyntaxKind.Missing) return child.getFirstToken(sourceFile); } } - public getLastToken(): Node { - var children = this.getChildren(); + public getLastToken(sourceFile?: SourceFile): Node { + var children = this.getChildren(sourceFile); for (var i = children.length - 1; i >= 0; i--) { var child = children[i]; if (child.kind < SyntaxKind.Missing) return child; - if (child.kind > SyntaxKind.Missing) return child.getLastToken(); + if (child.kind > SyntaxKind.Missing) return child.getLastToken(sourceFile); } } } @@ -223,19 +225,332 @@ module ts { flags: SymbolFlags; name: string; declarations: Declaration[]; + + // Undefined is used to indicate the value has not been computed. If, after computing, the + // symbol has no doc comment, then the empty string will be returned. + documentationComment: SymbolDisplayPart[]; + constructor(flags: SymbolFlags, name: string) { this.flags = flags; this.name = name; } + getFlags(): SymbolFlags { return this.flags; } + getName(): string { return this.name; } + getDeclarations(): Declaration[] { return this.declarations; } + + getDocumentationComment(): SymbolDisplayPart[] { + if (this.documentationComment === undefined) { + this.documentationComment = getJsDocCommentsFromDeclarations(this.declarations, this.name, !(this.flags & SymbolFlags.Property)); + } + + return this.documentationComment; + } + } + + function getJsDocCommentsFromDeclarations(declarations: Declaration[], name: string, canUseParsedParamTagComments: boolean) { + var documentationComment = []; + var docComments = getJsDocCommentsSeparatedByNewLines(); + ts.forEach(docComments, docComment => { + if (documentationComment.length) { + documentationComment.push(lineBreakPart()); + } + documentationComment.push(docComment); + }); + + return documentationComment; + + function getJsDocCommentsSeparatedByNewLines() { + var paramTag = "@param"; + var jsDocCommentParts: SymbolDisplayPart[] = []; + + ts.forEach(declarations, declaration => { + var sourceFileOfDeclaration = getSourceFileOfNode(declaration); + // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments + if (canUseParsedParamTagComments && declaration.kind === SyntaxKind.Parameter) { + ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), jsDocCommentTextRange => { + var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (cleanedParamJsDocComment) { + jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment); + } + }); + } + + // If this is left side of dotted module declaration, there is no doc comments associated with this node + if (declaration.kind === SyntaxKind.ModuleDeclaration && (declaration).body.kind === SyntaxKind.ModuleDeclaration) { + return; + } + + // If this is dotted module name, get the doc comments from the parent + while (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.parent.kind === SyntaxKind.ModuleDeclaration) { + declaration = declaration.parent; + } + + // Get the cleaned js doc comment text from the declaration + ts.forEach(getJsDocCommentTextRange( + declaration.kind === SyntaxKind.VariableDeclaration ? declaration.parent : declaration, sourceFileOfDeclaration), jsDocCommentTextRange => { + var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (cleanedJsDocComment) { + jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); + } + }); + }); + + return jsDocCommentParts; + + function getJsDocCommentTextRange(node: Node, sourceFile: SourceFile): TextRange[] { + return ts.map(getJsDocComments(node, sourceFile), + jsDocComment => { + return { + pos: jsDocComment.pos + "/*".length, // Consume /* from the comment + end: jsDocComment.end - "*/".length // Trim off comment end indicator + }; + }); + } + + function consumeWhiteSpacesOnTheLine(pos: number, end: number, sourceFile: SourceFile, maxSpacesToRemove?: number) { + if (maxSpacesToRemove !== undefined) { + end = Math.min(end, pos + maxSpacesToRemove); + } + + for (; pos < end; pos++) { + var ch = sourceFile.text.charCodeAt(pos); + if (!isWhiteSpace(ch) || isLineBreak(ch)) { + // Either found lineBreak or non whiteSpace + return pos; + } + } + + return end; + } + + function consumeLineBreaks(pos: number, end: number, sourceFile: SourceFile) { + while (pos < end && isLineBreak(sourceFile.text.charCodeAt(pos))) { + pos++; + } + + return pos; + } + + function isName(pos: number, end: number, sourceFile: SourceFile, name: string) { + return pos + name.length < end && + sourceFile.text.substr(pos, name.length) === name && + isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)); + } + + function isParamTag(pos: number, end: number, sourceFile: SourceFile) { + // If it is @param tag + return isName(pos, end, sourceFile, paramTag); + } + + function getCleanedJsDocComment(pos: number, end: number, sourceFile: SourceFile) { + var spacesToRemoveAfterAsterisk: number; + var docComments: SymbolDisplayPart[] = []; + var isInParamTag = false; + + while (pos < end) { + var docCommentTextOfLine = ""; + // First consume leading white space + pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile); + + // If the comment starts with '*' consume the spaces on this line + if (pos < end && sourceFile.text.charCodeAt(pos) === CharacterCodes.asterisk) { + var lineStartPos = pos + 1; + pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, spacesToRemoveAfterAsterisk); + + // Set the spaces to remove after asterisk as margin if not already set + if (spacesToRemoveAfterAsterisk === undefined && pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) { + spacesToRemoveAfterAsterisk = pos - lineStartPos; + } + } + else if (spacesToRemoveAfterAsterisk === undefined) { + spacesToRemoveAfterAsterisk = 0; + } + + // Analyse text on this line + while (pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) { + var ch = sourceFile.text.charAt(pos); + if (ch === "@") { + // If it is @param tag + if (isParamTag(pos, end, sourceFile)) { + isInParamTag = true; + pos += paramTag.length; + continue; + } + else { + isInParamTag = false; + } + } + + // Add the ch to doc text if we arent in param tag + if (!isInParamTag) { + docCommentTextOfLine += ch; + } + + // Scan next character + pos++; + } + + // Continue with next line + pos = consumeLineBreaks(pos, end, sourceFile); + if (docCommentTextOfLine) { + docComments.push(textPart(docCommentTextOfLine)); + } + } + + return docComments; + } + + function getCleanedParamJsDocComment(pos: number, end: number, sourceFile: SourceFile) { + var paramHelpStringMargin: number; + var paramDocComments: SymbolDisplayPart[] = []; + while (pos < end) { + if (isParamTag(pos, end, sourceFile)) { + // Consume leading spaces + pos = consumeWhiteSpaces(pos + paramTag.length); + if (pos >= end) { + break; + } + + // Ignore type expression + if (sourceFile.text.charCodeAt(pos) === CharacterCodes.openBrace) { + pos++; + for (var curlies = 1; pos < end; pos++) { + var charCode = sourceFile.text.charCodeAt(pos); + + // { character means we need to find another } to match the found one + if (charCode === CharacterCodes.openBrace) { + curlies++; + continue; + } + + // } char + if (charCode === CharacterCodes.closeBrace) { + curlies--; + if (curlies === 0) { + // We do not have any more } to match the type expression is ignored completely + pos++; + break; + } + else { + // there are more { to be matched with } + continue; + } + } + + // Found start of another tag + if (charCode === CharacterCodes.at) { + break; + } + } + + // Consume white spaces + pos = consumeWhiteSpaces(pos); + if (pos >= end) { + break; + } + } + + // Parameter name + if (isName(pos, end, sourceFile, name)) { + // Found the parameter we are looking for consume white spaces + pos = consumeWhiteSpaces(pos + name.length); + if (pos >= end) { + break; + } + + var paramHelpString = ""; + var firstLineParamHelpStringPos = pos; + while (pos < end) { + var ch = sourceFile.text.charCodeAt(pos); + + // at line break, set this comment line text and go to next line + if (isLineBreak(ch)) { + if (paramHelpString) { + paramDocComments.push(textPart(paramHelpString)); + paramHelpString = ""; + } + + // Get the pos after cleaning start of the line + setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos); + continue; + } + + // Done scanning param help string - next tag found + if (ch === CharacterCodes.at) { + break; + } + + paramHelpString += sourceFile.text.charAt(pos); + + // Go to next character + pos++; + } + + // If there is param help text, add it top the doc comments + if (paramHelpString) { + paramDocComments.push(textPart(paramHelpString)); + } + paramHelpStringMargin = undefined; + } + + // If this is the start of another tag, continue with the loop in seach of param tag with symbol name + if (sourceFile.text.charCodeAt(pos) === CharacterCodes.at) { + continue; + } + } + + // Next character + pos++; + } + + return paramDocComments; + + function consumeWhiteSpaces(pos: number) { + while (pos < end && isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos++; + } + + return pos; + } + + function setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos: number) { + // Get the pos after consuming line breaks + pos = consumeLineBreaks(pos, end, sourceFile); + if (pos >= end) { + return; + } + + if (paramHelpStringMargin === undefined) { + paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1; + } + + // Now consume white spaces max + var startOfLinePos = pos; + pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); + if (pos >= end) { + return; + } + + var consumedSpaces = pos - startOfLinePos; + if (consumedSpaces < paramHelpStringMargin) { + var ch = sourceFile.text.charCodeAt(pos); + if (ch === CharacterCodes.asterisk) { + // Consume more spaces after asterisk + pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1); + } + } + } + } + } } class TypeObject implements Type { @@ -259,7 +574,7 @@ module ts { getProperty(propertyName: string): Symbol { return this.checker.getPropertyOfType(this, propertyName); } - getApparentProperties(): Symbol[]{ + getApparentProperties(): Symbol[] { return this.checker.getAugmentedPropertiesOfApparentType(this); } getCallSignatures(): Signature[] { @@ -285,6 +600,11 @@ module ts { minArgumentCount: number; hasRestParameter: boolean; hasStringLiterals: boolean; + + // Undefined is used to indicate the value has not been computed. If, after computing, the + // symbol has no doc comment, then the empty string will be returned. + documentationComment: SymbolDisplayPart[]; + constructor(checker: TypeChecker) { this.checker = checker; } @@ -300,9 +620,20 @@ module ts { getReturnType(): Type { return this.checker.getReturnTypeOfSignature(this); } + + getDocumentationComment(): SymbolDisplayPart[] { + if (this.documentationComment === undefined) { + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations( + [this.declaration], + this.declaration.name ? this.declaration.name.text : "", + /*canUseParsedParamTagComments*/ false) : []; + } + + return this.documentationComment; + } } - var incrementalParse: IncrementalParse = TypeScript.IncrementalParser.parse; + var incrementalParse: IncrementalParse = TypeScript.IncrementalParser.parse; class SourceFileObject extends NodeObject implements SourceFile { public filename: string; @@ -326,6 +657,7 @@ module ts { private syntaxTree: TypeScript.SyntaxTree; private scriptSnapshot: TypeScript.IScriptSnapshot; + private namedDeclarations: Declaration[]; public getSourceUnit(): TypeScript.SourceUnitSyntax { // If we don't have a script, create one from our parse tree. @@ -340,6 +672,77 @@ module ts { return this.getSyntaxTree().lineMap(); } + public getNamedDeclarations() { + if (!this.namedDeclarations) { + var sourceFile = this; + var namedDeclarations: Declaration[] = []; + + forEachChild(sourceFile, function visit(node: Node): void { + switch (node.kind) { + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.Method: + var functionDeclaration = node; + + if (functionDeclaration.name && functionDeclaration.name.kind !== SyntaxKind.Missing) { + var lastDeclaration = namedDeclarations.length > 0 ? + namedDeclarations[namedDeclarations.length - 1] : + undefined; + + // Check whether this declaration belongs to an "overload group". + if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { + // Overwrite the last declaration if it was an overload + // and this one is an implementation. + if (functionDeclaration.body && !(lastDeclaration).body) { + namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; + } + } + else { + namedDeclarations.push(node); + } + + forEachChild(node, visit); + } + break; + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.ImportDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.TypeLiteral: + if ((node).name) { + namedDeclarations.push(node); + } + // fall through + case SyntaxKind.Constructor: + case SyntaxKind.VariableStatement: + case SyntaxKind.ModuleBlock: + case SyntaxKind.FunctionBlock: + forEachChild(node, visit); + break; + + case SyntaxKind.Parameter: + // Only consider properties defined as constructor parameters + if (!(node.flags & NodeFlags.AccessibilityModifier)) { + break; + } + // fall through + case SyntaxKind.VariableDeclaration: + case SyntaxKind.EnumMember: + case SyntaxKind.Property: + namedDeclarations.push(node); + break; + } + }); + + this.namedDeclarations = namedDeclarations; + } + + return this.namedDeclarations; + } + public getSyntaxTree(): TypeScript.SyntaxTree { if (!this.syntaxTree) { var start = new Date().getTime(); @@ -362,7 +765,7 @@ module ts { public update(scriptSnapshot: TypeScript.IScriptSnapshot, version: string, isOpen: boolean, textChangeRange: TypeScript.TextChangeRange): SourceFile { // See if we are currently holding onto a syntax tree. We may not be because we're // either a closed file, or we've just been lazy and haven't had to create the syntax - // tree yet. Access the field instead of the method so we don't accidently realize + // tree yet. Access the field instead of the method so we don't accidentally realize // the old syntax tree. var oldSyntaxTree = this.syntaxTree; @@ -417,6 +820,8 @@ module ts { getScriptSnapshot(fileName: string): TypeScript.IScriptSnapshot; getLocalizedDiagnosticMessages(): any; getCancellationToken(): CancellationToken; + getCurrentDirectory(): string; + getDefaultLibFilename(): string; } // @@ -430,19 +835,26 @@ module ts { getSemanticDiagnostics(fileName: string): Diagnostic[]; getCompilerOptionsDiagnostics(): Diagnostic[]; + getSyntacticClassifications(fileName: string, span: TypeScript.TextSpan): ClassifiedSpan[]; + getSemanticClassifications(fileName: string, span: TypeScript.TextSpan): ClassifiedSpan[]; + getCompletionsAtPosition(fileName: string, position: number, isMemberCompletion: boolean): CompletionInfo; getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; - getTypeAtPosition(fileName: string, position: number): TypeInfo; + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TypeScript.TextSpan; getBreakpointStatementAtPosition(fileName: string, position: number): TypeScript.TextSpan; getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; - getSignatureHelpCurrentArgumentState(fileName: string, position: number, applicableSpanStart: number): SignatureHelpState; + + // Obsolete. Use getSignatureHelpItems instead. + getSignatureAtPosition(fileName: string, position: number): SignatureInfo; getRenameInfo(fileName: string, position: number): RenameInfo; + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; @@ -467,68 +879,93 @@ module ts { dispose(): void; } - export class NavigationBarItem { - constructor(public text: string, - public kind: string, - public kindModifiers: string, - public spans: TypeScript.TextSpan[], - public childItems: NavigationBarItem[] = null, - public indent = 0, - public bolded = false, - public grayed = false) { - } + export interface SignatureInfo { + actual: ActualSignatureInfo; + formal: FormalSignatureItemInfo[]; // Formal signatures + activeFormal: number; // Index of the "best match" formal signature } - export class TodoCommentDescriptor { - constructor(public text: string, - public priority: number) { - } + export interface FormalSignatureItemInfo { + signatureInfo: string; + typeParameters: FormalTypeParameterInfo[]; + parameters: FormalParameterInfo[]; // Array of parameters + docComment: string; // Help for the signature } - export class TodoComment { - constructor(public descriptor: TodoCommentDescriptor, - public message: string, - public position: number) { - } + export interface FormalTypeParameterInfo { + name: string; // Type parameter name + docComment: string; // Comments that contain help for the parameter + minChar: number; // minChar for parameter info in the formal signature info string + limChar: number; // lim char for parameter info in the formal signature info string + } + + export interface FormalParameterInfo { + name: string; // Parameter name + isVariable: boolean; // true if parameter is var args + docComment: string; // Comments that contain help for the parameter + minChar: number; // minChar for parameter info in the formal signature info string + limChar: number; // lim char for parameter info in the formal signature info string + } + + export interface ActualSignatureInfo { + parameterMinChar: number; + parameterLimChar: number; + currentParameterIsTypeParameter: boolean; // current parameter is a type argument or a normal argument + currentParameter: number; // Index of active parameter in "parameters" or "typeParamters" array + } + + export interface ClassifiedSpan { + textSpan: TypeScript.TextSpan; + classificationType: string; // ClassificationTypeNames + } + + export interface NavigationBarItem { + text: string; + kind: string; + kindModifiers: string; + spans: TypeScript.TextSpan[]; + childItems: NavigationBarItem[]; + indent: number; + bolded: boolean; + grayed: boolean; + } + + export interface TodoCommentDescriptor { + text: string; + priority: number; + } + + export interface TodoComment { + descriptor: TodoCommentDescriptor; + message: string; + position: number; } export class TextChange { - constructor(public span: TypeScript.TextSpan, public newText: string) { - } - - static createInsert(pos: number, newText: string): TextChange { - return new TextChange(new TypeScript.TextSpan(pos, 0), newText); - } - static createDelete(start: number, end: number): TextChange { - return new TextChange(TypeScript.TextSpan.fromBounds(start, end), ""); - } - static createReplace(start: number, end: number, newText: string): TextChange { - return new TextChange(TypeScript.TextSpan.fromBounds(start, end), newText); - } + span: TypeScript.TextSpan; + newText: string; } - export class ReferenceEntry { - public fileName: string = ""; - public textSpan: TypeScript.TextSpan; - public isWriteAccess: boolean = false; - - constructor(fileName: string, textSpan: TypeScript.TextSpan, isWriteAccess: boolean) { - this.fileName = fileName; - this.textSpan = textSpan; - this.isWriteAccess = isWriteAccess; - } + export interface RenameLocation { + textSpan: TypeScript.TextSpan; + fileName: string; } - export class NavigateToItem { - constructor(public name: string, - public kind: string, - public kindModifiers: string, - public matchKind: string, - public fileName: string, - public textSpan: TypeScript.TextSpan, - public containerName: string, - public containerKind: string) { - } + export interface ReferenceEntry { + textSpan: TypeScript.TextSpan; + fileName: string; + isWriteAccess: boolean; + } + + export interface NavigateToItem { + name: string; + kind: string; + kindModifiers: string; + matchKind: string; + fileName: string; + textSpan: TypeScript.TextSpan; + containerName: string; + containerKind: string; } export interface EditorOptions { @@ -549,63 +986,43 @@ module ts { PlaceOpenBraceOnNewLineForControlBlocks: boolean; } - export class DefinitionInfo { - constructor(public fileName: string, - public textSpan: TypeScript.TextSpan, - public kind: string, - public name: string, - public containerKind: string, - public containerName: string) { - } + export interface DefinitionInfo { + fileName: string; + textSpan: TypeScript.TextSpan; + kind: string; + name: string; + containerKind: string; + containerName: string; } - - export interface MemberName { - prefix: string; - suffix: string; + + export interface SymbolDisplayPart { text: string; + kind: string; } - export class TypeInfo { - constructor( - public memberName: TypeScript.MemberName, - public docComment: string, - public fullSymbolName: string, - public kind: string, - public textSpan: TypeScript.TextSpan) { - } + export interface QuickInfo { + kind: string; + kindModifiers: string; + textSpan: TypeScript.TextSpan; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; } - export class RenameInfo { - constructor(public canRename: boolean, - public localizedErrorMessage: string, - public displayName: string, - public fullDisplayName: string, - public kind: string, - public kindModifiers: string, - public triggerSpan: TypeScript.TextSpan) { - } - - public static CreateError(localizedErrorMessage: string) { - return new RenameInfo(/*canRename:*/ false, localizedErrorMessage, - /*displayName:*/ null, /*fullDisplayName:*/ null, - /*kind:*/ null, /*kindModifiers:*/ null, /*triggerSpan:*/ null); - } - - public static Create(displayName: string, - fullDisplayName: string, - kind: string, - kindModifiers: string, - triggerSpan: TypeScript.TextSpan) { - return new RenameInfo(/*canRename:*/ true, /*localizedErrorMessage:*/ null, displayName, fullDisplayName, kind, kindModifiers, triggerSpan); - } + export interface RenameInfo { + canRename: boolean; + localizedErrorMessage: string; + displayName: string; + fullDisplayName: string; + kind: string; + kindModifiers: string; + triggerSpan: TypeScript.TextSpan; } - export class SignatureHelpParameter { - constructor(public name: string, - public documentation: string, - public display: string, - public isOptional: boolean) { - } + export interface SignatureHelpParameter { + name: string; + documentation: SymbolDisplayPart[]; + displayParts: SymbolDisplayPart[]; + isOptional: boolean; } /** @@ -615,30 +1032,24 @@ module ts { * an edit has happened, while signature help is still active, the host can ask important * questions like 'what parameter is the user currently contained within?'. */ - export class SignatureHelpItem { - constructor(public isVariadic: boolean, - public prefix: string, - public suffix: string, - public separator: string, - public parameters: SignatureHelpParameter[], - public documentation: string) { - } + export interface SignatureHelpItem { + isVariadic: boolean; + prefixDisplayParts: SymbolDisplayPart[]; + suffixDisplayParts: SymbolDisplayPart[]; + separatorDisplayParts: SymbolDisplayPart[]; + parameters: SignatureHelpParameter[]; + documentation: SymbolDisplayPart[]; } /** * Represents a set of signature help items, and the preferred item that should be selected. */ - export class SignatureHelpItems { - constructor(public items: SignatureHelpItem[], - public applicableSpan: TypeScript.TextSpan, - public selectedItemIndex: number) { - } - } - - export class SignatureHelpState { - constructor(public argumentIndex: number, - public argumentCount: number) { - } + export interface SignatureHelpItems { + items: SignatureHelpItem[]; + applicableSpan: TypeScript.TextSpan; + selectedItemIndex: number; + argumentIndex: number; + argumentCount: number; } export interface CompletionInfo { @@ -656,21 +1067,13 @@ module ts { name: string; kind: string; // see ScriptElementKind kindModifiers: string; // see ScriptElementKindModifier, comma separated - type: string; - fullSymbolName: string; - docComment: string; - } - - export enum EmitOutputResult { - Succeeded, - FailedBecauseOfSyntaxErrors, - FailedBecauseOfCompilerOptionsErrors, - FailedToGenerateDeclarationsBecauseOfSemanticErrors + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; } export interface EmitOutput { outputFiles: OutputFile[]; - emitOutputResult: EmitOutputResult; + emitOutputStatus: EmitReturnStatus; } export enum OutputFileType { @@ -683,8 +1086,6 @@ module ts { name: string; writeByteOrderMark: boolean; text: string; - fileType: OutputFileType; - sourceMapOutput: any; } export enum EndOfLineState { @@ -692,7 +1093,6 @@ module ts { InMultiLineCommentTrivia, InSingleQuoteStringLiteral, InDoubleQuoteStringLiteral, - EndingWithDotToken, } export enum TokenClass { @@ -809,22 +1209,44 @@ module ts { static primitiveType = "primitive type"; static label = "label"; + + static alias = "alias" } export class ScriptElementKindModifier { static none = ""; static publicMemberModifier = "public"; static privateMemberModifier = "private"; + static protectedMemberModifier = "protected"; static exportedModifier = "export"; static ambientModifier = "declare"; static staticModifier = "static"; } - export class MatchKind { - static none: string = null; - static exact = "exact"; - static subString = "substring"; - static prefix = "prefix"; + export class ClassificationTypeNames { + public static comment = "comment"; + public static identifier = "identifier"; + public static keyword = "keyword"; + public static numericLiteral = "number"; + public static operator = "operator"; + public static stringLiteral = "string"; + public static whiteSpace = "whitespace"; + public static text = "text"; + + public static punctuation = "punctuation"; + + public static className = "class name"; + public static enumName = "enum name"; + public static interfaceName = "interface name"; + public static moduleName = "module name"; + public static typeParameterName = "type parameter name"; + } + + enum MatchKind { + none = 0, + exact = 1, + substring = 2, + prefix = 3 } interface IncrementalParse { @@ -837,9 +1259,9 @@ module ts { filename: string; // the file where the completion was requested position: number; // position in the file where the completion was requested entries: CompletionEntry[]; // entries for this completion - symbols: Map; // symbols by entry name map - location: Node; // the node where the completion was requested - typeChecker: TypeChecker;// the typeChecker used to generate this completion + symbols: Map; // symbols by entry name map + location: Node; // the node where the completion was requested + typeChecker: TypeChecker; // the typeChecker used to generate this completion } interface FormattingOptions { @@ -863,6 +1285,176 @@ module ts { owners: string[]; } + export function displayPartsToString(displayParts: SymbolDisplayPart[]) { + if (displayParts) { + return map(displayParts, displayPart => displayPart.text).join(""); + } + + return ""; + } + + interface DisplayPartsSymbolWriter extends SymbolWriter { + displayParts(): SymbolDisplayPart[]; + } + + var displayPartWriter = getDisplayPartWriter(); + function getDisplayPartWriter(): DisplayPartsSymbolWriter { + var displayParts: SymbolDisplayPart[]; + var lineStart: boolean; + var indent: number; + + resetWriter(); + return { + displayParts: () => displayParts, + writeKind: writeKind, + writeSymbol: writeSymbol, + writeLine: writeLine, + increaseIndent: () => { indent++; }, + decreaseIndent: () => { indent--; }, + clear: resetWriter, + trackSymbol: () => { } + }; + + function writeIndent() { + if (lineStart) { + displayParts.push(displayPart(getIndentString(indent), SymbolDisplayPartKind.space)); + lineStart = false; + } + } + + function writeKind(text: string, kind: SymbolDisplayPartKind) { + writeIndent(); + displayParts.push(displayPart(text, kind)); + } + + function writeSymbol(text: string, symbol: Symbol) { + writeIndent(); + displayParts.push(symbolPart(text, symbol)); + } + + function writeLine() { + displayParts.push(lineBreakPart()); + lineStart = true; + } + + function resetWriter() { + displayParts = [] + lineStart = true; + indent = 0; + } + } + + function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart { + return { + text: text, + kind: SymbolDisplayPartKind[kind] + }; + } + + export function spacePart() { + return displayPart(" ", SymbolDisplayPartKind.space); + } + + export function keywordPart(kind: SyntaxKind) { + return displayPart(tokenToString(kind), SymbolDisplayPartKind.keyword); + } + + export function punctuationPart(kind: SyntaxKind) { + return displayPart(tokenToString(kind), SymbolDisplayPartKind.punctuation); + } + + export function operatorPart(kind: SyntaxKind) { + return displayPart(tokenToString(kind), SymbolDisplayPartKind.operator); + } + + export function textPart(text: string) { + return displayPart(text, SymbolDisplayPartKind.text); + } + + export function lineBreakPart() { + return displayPart("\n", SymbolDisplayPartKind.lineBreak); + } + + function isFirstDeclarationOfSymbolParameter(symbol: Symbol) { + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === SyntaxKind.Parameter; + } + + function isLocalVariableOrFunction(symbol: Symbol) { + if (symbol.parent) { + return false; // This is exported symbol + } + + return ts.forEach(symbol.declarations, declaration => { + // Function expressions are local + if (declaration.kind === SyntaxKind.FunctionExpression) { + return true; + } + + if (declaration.kind !== SyntaxKind.VariableDeclaration && declaration.kind !== SyntaxKind.FunctionDeclaration) { + return false; + } + + // If the parent is not sourceFile or module block it is local variable + for (var parent = declaration.parent; parent.kind !== SyntaxKind.FunctionBlock; parent = parent.parent) { + // Reached source file or module block + if (parent.kind === SyntaxKind.SourceFile || parent.kind === SyntaxKind.ModuleBlock) { + return false; + } + } + + // parent is in function block + return true; + }); + } + + export function symbolPart(text: string, symbol: Symbol) { + return displayPart(text, displayPartKind(symbol), symbol); + + function displayPartKind(symbol: Symbol): SymbolDisplayPartKind { + var flags = symbol.flags; + + if (flags & SymbolFlags.Variable) { + return isFirstDeclarationOfSymbolParameter(symbol) ? SymbolDisplayPartKind.parameterName : SymbolDisplayPartKind.localName; + } + else if (flags & SymbolFlags.Property) { return SymbolDisplayPartKind.propertyName; } + else if (flags & SymbolFlags.EnumMember) { return SymbolDisplayPartKind.enumMemberName; } + else if (flags & SymbolFlags.Function) { return SymbolDisplayPartKind.functionName; } + else if (flags & SymbolFlags.Class) { return SymbolDisplayPartKind.className; } + else if (flags & SymbolFlags.Interface) { return SymbolDisplayPartKind.interfaceName; } + else if (flags & SymbolFlags.Enum) { return SymbolDisplayPartKind.enumName; } + else if (flags & SymbolFlags.Module) { return SymbolDisplayPartKind.moduleName; } + else if (flags & SymbolFlags.Method) { return SymbolDisplayPartKind.methodName; } + else if (flags & SymbolFlags.TypeParameter) { return SymbolDisplayPartKind.typeParameterName; } + + return SymbolDisplayPartKind.text; + } + } + + function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[] { + writeDisplayParts(displayPartWriter); + var result = displayPartWriter.displayParts(); + displayPartWriter.clear(); + return result; + } + + export function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[] { + return mapToDisplayParts(writer => { + typechecker.writeType(type, writer, enclosingDeclaration, flags); + }); + } + + export function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[] { + return mapToDisplayParts(writer => { + typeChecker.writeSymbol(symbol, writer, enclosingDeclaration, meaning, flags); + }); + } + + function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]{ + return mapToDisplayParts(writer => { + typechecker.writeSignature(signature, writer, enclosingDeclaration, flags); + }); + } + export function getDefaultCompilerOptions(): CompilerOptions { // Set "ES5" target by default for language service return { @@ -887,7 +1479,7 @@ module ts { export class OperationCanceledException { } - class CancellationTokenObject { + export class CancellationTokenObject { public static None: CancellationTokenObject = new CancellationTokenObject(null) @@ -1274,10 +1866,24 @@ module ts { } /// Helpers + export function getNodeModifiers(node: Node): string { + var flags = node.flags; + var result: string[] = []; + + if (flags & NodeFlags.Private) result.push(ScriptElementKindModifier.privateMemberModifier); + if (flags & NodeFlags.Protected) result.push(ScriptElementKindModifier.protectedMemberModifier); + if (flags & NodeFlags.Public) result.push(ScriptElementKindModifier.publicMemberModifier); + if (flags & NodeFlags.Static) result.push(ScriptElementKindModifier.staticModifier); + if (flags & NodeFlags.Export) result.push(ScriptElementKindModifier.exportedModifier); + if (isInAmbientContext(node)) result.push(ScriptElementKindModifier.ambientModifier); + + return result.length > 0 ? result.join(',') : ScriptElementKindModifier.none; + } + function getTargetLabel(referenceNode: Node, labelName: string): Identifier { while (referenceNode) { - if (referenceNode.kind === SyntaxKind.LabelledStatement && (referenceNode).label.text === labelName) { - return (referenceNode).label; + if (referenceNode.kind === SyntaxKind.LabeledStatement && (referenceNode).label.text === labelName) { + return (referenceNode).label; } referenceNode = referenceNode.parent; } @@ -1292,8 +1898,22 @@ module ts { function isLabelOfLabeledStatement(node: Node): boolean { return node.kind === SyntaxKind.Identifier && - node.parent.kind === SyntaxKind.LabelledStatement && - (node.parent).label === node; + node.parent.kind === SyntaxKind.LabeledStatement && + (node.parent).label === node; + } + + /** + * Whether or not a 'node' is preceded by a label of the given string. + * Note: 'node' cannot be a SourceFile. + */ + function isLabeledBy(node: Node, labelName: string) { + for (var owner = node.parent; owner.kind === SyntaxKind.LabeledStatement; owner = owner.parent) { + if ((owner).label.text === labelName) { + return true; + } + } + + return false; } function isLabelName(node: Node): boolean { @@ -1317,7 +1937,7 @@ module ts { isAnyFunction(node.parent) && (node.parent).name === node; } - /// Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } + /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ function isNameOfPropertyAssignment(node: Node): boolean { return (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NumericLiteral) && node.parent.kind === SyntaxKind.PropertyAssignment && (node.parent).name === node; @@ -1348,10 +1968,19 @@ module ts { (node.parent.kind === SyntaxKind.ImportDeclaration && (node.parent).externalModuleName === node)); } - enum SearchMeaning { + enum SemanticMeaning { + None = 0x0, Value = 0x1, Type = 0x2, - Namespace = 0x4 + Namespace = 0x4, + All = Value | Type | Namespace + } + + enum BreakContinueSearchType { + None = 0x0, + Unlabeled = 0x1, + Labeled = 0x2, + All = Unlabeled | Labeled } // A cache of completion entries for keywords, these do not change between sessions @@ -1369,20 +1998,24 @@ module ts { var formattingRulesProvider: TypeScript.Services.Formatting.RulesProvider; var hostCache: HostCache; // A cache of all the information about the files on the host side. var program: Program; + // this checker is used to answer all LS questions except errors var typeInfoResolver: TypeChecker; - // the sole purpose of this checkes is to reutrn semantic diagnostics + + // the sole purpose of this checker is to return semantic diagnostics // creation is deferred - use getFullTypeCheckChecker to get instance var fullTypeCheckChecker_doNotAccessDirectly: TypeChecker; + var useCaseSensitivefilenames = false; var sourceFilesByName: Map = {}; var documentRegistry = documentRegistry; var cancellationToken = new CancellationTokenObject(host.getCancellationToken()); var activeCompletionSession: CompletionSession; // The current active completion session, used to get the completion entry details + var writer: (filename: string, data: string, writeByteOrderMark: boolean) => void = undefined; // Check if the localized messages json is set, otherwise query the host for it - if (!TypeScript.LocalizedDiagnosticMessages) { - TypeScript.LocalizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); + if (!localizedDiagnosticMessages) { + localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); } function getSourceFile(filename: string): SourceFile { @@ -1403,15 +2036,14 @@ module ts { getCanonicalFileName: (filename) => useCaseSensitivefilenames ? filename : filename.toLowerCase(), useCaseSensitiveFileNames: () => useCaseSensitivefilenames, getNewLine: () => "\r\n", - // Need something that doesn't depend on sys.ts here getDefaultLibFilename: (): string => { - throw Error("TOD:: getDefaultLibfilename"); + return host.getDefaultLibFilename(); }, writeFile: (filename, data, writeByteOrderMark) => { - throw Error("TODO: write file"); + writer(filename, data, writeByteOrderMark); }, getCurrentDirectory: (): string => { - throw Error("TODO: getCurrentDirectory"); + return host.getCurrentDirectory(); } }; } @@ -1499,9 +2131,9 @@ module ts { } // Only perform incremental parsing on open files that are being edited. If a file was - // open, but is now closed, we want to reparse entirely so we don't have any tokens that + // open, but is now closed, we want to re-parse entirely so we don't have any tokens that // are holding onto expensive script snapshot instances on the host. Similarly, if a - // file was closed, then we always want to reparse. This is so our tree doesn't keep + // file was closed, then we always want to re-parse. This is so our tree doesn't keep // the old buffer alive that represented the file on disk (as the host has moved to a // new text buffer). var textChangeRange: TypeScript.TextChangeRange = null; @@ -1515,7 +2147,7 @@ module ts { sourceFile = documentRegistry.acquireDocument(filename, compilationSettings, scriptSnapshot, version, isOpen); } - // Remeber the new sourceFile + // Remember the new sourceFile sourceFilesByName[filename] = sourceFile; } @@ -1525,9 +2157,11 @@ module ts { fullTypeCheckChecker_doNotAccessDirectly = undefined; } - /// Clean up any semantic caches that are not needed. - /// The host can call this method if it wants to jettison unused memory. - /// We will just dump the typeChecker and recreate a new one. this should have the effect of destroying all the semantic caches. + /** + * Clean up any semantic caches that are not needed. + * The host can call this method if it wants to jettison unused memory. + * We will just dump the typeChecker and recreate a new one. this should have the effect of destroying all the semantic caches. + */ function cleanupSemanticCache(): void { if (program) { typeInfoResolver = program.getTypeChecker(/*fullTypeCheckMode*/ false); @@ -1551,12 +2185,31 @@ module ts { return program.getDiagnostics(getSourceFile(filename).getSourceFile()); } + /** + * getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors + * If '-d' enabled, report both semantic and emitter errors + */ function getSemanticDiagnostics(filename: string) { synchronizeHostData(); filename = TypeScript.switchToForwardSlashes(filename) + var compilerOptions = program.getCompilerOptions(); + var checker = getFullTypeCheckChecker(); + var targetSourceFile = getSourceFile(filename); - return getFullTypeCheckChecker().getDiagnostics(getSourceFile(filename)); + // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. + // Therefore only get diagnostics for given file. + + var allDiagnostics = checker.getDiagnostics(targetSourceFile); + if (compilerOptions.declaration) { + // If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface + // Get emitter-diagnostics requires calling TypeChecker.emitFiles so we have to define CompilerHost.writer which does nothing because emitFiles function has side effects defined by CompilerHost.writer + var savedWriter = writer; + writer = (filename: string, data: string, writeByteOrderMark: boolean) => { }; + allDiagnostics = allDiagnostics.concat(checker.emitFiles(targetSourceFile).errors); + writer = savedWriter; + } + return allDiagnostics } function getCompilerOptionsDiagnostics() { @@ -1565,16 +2218,31 @@ module ts { } /// Completion - function getValidCompletionEntryDisplayName(displayName: string, target: ScriptTarget): string { + function getValidCompletionEntryDisplayName(symbol: Symbol, target: ScriptTarget): string { + var displayName = symbol.getName(); if (displayName && displayName.length > 0) { - var firstChar = displayName.charCodeAt(0); - if (firstChar === TypeScript.CharacterCodes.singleQuote || firstChar === TypeScript.CharacterCodes.doubleQuote) { - // If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an - // invalid identifer name. We need to check if whatever was inside the quotes is actually a valid identifier name. - displayName = TypeScript.stripStartAndEndQuotes(displayName); + var firstCharCode = displayName.charCodeAt(0); + // First check of the displayName is not external module; if it is an external module, it is not valid entry + if ((symbol.flags & SymbolFlags.Namespace) && (firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) { + // If the symbol is external module, don't show it in the completion list + // (i.e declare module "http" { var x; } | // <= request completion here, "http" should not be there) + return undefined; } - if (TypeScript.Scanner.isValidIdentifier(TypeScript.SimpleText.fromString(displayName), target)) { + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && + (firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) { + // If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an + // invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name. + displayName = displayName.substring(1, displayName.length - 1); + } + + var isValid = isIdentifierStart(displayName.charCodeAt(0), target); + for (var i = 1, n = displayName.length; isValid && i < n; i++) { + isValid = isIdentifierPart(displayName.charCodeAt(i), target); + } + + + if (isValid) { return displayName; } } @@ -1582,29 +2250,31 @@ module ts { return undefined; } - function createCompletionEntry(symbol: Symbol): CompletionEntry { + function createCompletionEntry(symbol: Symbol, typeChecker: TypeChecker): CompletionEntry { // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) - var displayName = getValidCompletionEntryDisplayName(symbol.getName(), program.getCompilerOptions().target); + var displayName = getValidCompletionEntryDisplayName(symbol, program.getCompilerOptions().target); if (!displayName) { return undefined; } - var declarations = symbol.getDeclarations(); - var firstDeclaration = [0]; + // TODO(drosen): Right now we just permit *all* semantic meanings when calling 'getSymbolKind' + // which is permissible given that it is backwards compatible; but really we should consider + // passing the meaning for the node so that we don't report that a suggestion for a value is an interface. + // We COULD also just do what 'getSymbolModifiers' does, which is to use the first declaration. return { name: displayName, - kind: getSymbolKind(symbol), - kindModifiers: declarations ? getNodeModifiers(declarations[0]) : ScriptElementKindModifier.none + kind: getSymbolKind(symbol, typeChecker), + kindModifiers: getSymbolModifiers(symbol) }; } function getCompletionsAtPosition(filename: string, position: number, isMemberCompletion: boolean) { function getCompletionEntriesFromSymbols(symbols: Symbol[], session: CompletionSession): void { - forEach(symbols, (symbol) => { - var entry = createCompletionEntry(symbol); - if (entry) { + forEach(symbols, symbol => { + var entry = createCompletionEntry(symbol, session.typeChecker); + if (entry && !lookUp(session.symbols, entry.name)) { session.entries.push(entry); session.symbols[entry.name] = symbol; } @@ -1612,9 +2282,9 @@ module ts { } function isCompletionListBlocker(sourceUnit: TypeScript.SourceUnitSyntax, position: number): boolean { - // We shouldn't be getting a possition that is outside the file because + // We shouldn't be getting a position that is outside the file because // isEntirelyInsideComment can't handle when the position is out of bounds, - // callers should be fixed, however we should be resiliant to bad inputs + // callers should be fixed, however we should be resilient to bad inputs // so we return true (this position is a blocker for getting completions) if (position < 0 || position > TypeScript.fullWidth(sourceUnit)) { return true; @@ -1704,12 +2374,12 @@ module ts { var positionedToken = TypeScript.Syntax.findCompleteTokenOnLeft(sourceUnit, position, /*includeSkippedTokens*/true); if (positionedToken && position === TypeScript.end(positionedToken) && positionedToken.kind() == TypeScript.SyntaxKind.EndOfFileToken) { - // EndOfFile token is not intresting, get the one before it + // EndOfFile token is not interesting, get the one before it positionedToken = TypeScript. previousToken(positionedToken, /*includeSkippedTokens*/true); } if (positionedToken && position === TypeScript.end(positionedToken) && positionedToken.kind() === TypeScript.SyntaxKind.IdentifierName) { - // The caret is at the end of an identifier, the decession to provide completion depends on the previous token + // The caret is at the end of an identifier, the decision to provide completion depends on the previous token positionedToken = TypeScript.previousToken(positionedToken, /*includeSkippedTokens*/true); } @@ -1734,6 +2404,40 @@ module ts { return false; } + function isPunctuation(kind: SyntaxKind) { + return (SyntaxKind.FirstPunctuation <= kind && kind <= SyntaxKind.LastPunctuation); + } + + function filterContextualMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] { + if (!existingMembers || existingMembers.length === 0) { + return contextualMemberSymbols; + } + + var existingMemberNames: Map = {}; + forEach(existingMembers, m => { + if (m.kind !== SyntaxKind.PropertyAssignment) { + // Ignore omitted expressions for missing members in the object literal + return; + } + + if (m.getStart() <= position && position <= m.getEnd()) { + // If this is the current item we are editing right now, do not filter it out + return; + } + + existingMemberNames[m.name.text] = true; + }); + + var filteredMembers: Symbol[] = []; + forEach(contextualMemberSymbols, s => { + if (!existingMemberNames[s.name]) { + filteredMembers.push(s); + } + }); + + return filteredMembers; + } + synchronizeHostData(); filename = TypeScript.switchToForwardSlashes(filename); @@ -1787,7 +2491,17 @@ module ts { } // TODO: this is a hack for now, we need a proper walking mechanism to verify that we have the correct node - var mappedNode = getNodeAtPosition(sourceFile, TypeScript.end(node) - 1); + var precedingToken = findTokenOnLeftOfPosition(sourceFile, TypeScript.end(node)); + var mappedNode: Node; + if (!precedingToken) { + mappedNode = sourceFile; + } + else if (isPunctuation(precedingToken.kind)) { + mappedNode = precedingToken.parent; + } + else { + mappedNode = precedingToken; + } Debug.assert(mappedNode, "Could not map a Fidelity node to an AST node"); @@ -1803,13 +2517,38 @@ module ts { // Right of dot member completion list if (isRightOfDot) { - var type: ApparentType = typeInfoResolver.getApparentType(typeInfoResolver.getTypeOfNode(mappedNode)); - if (!type) { - return undefined; + var symbols: Symbol[] = []; + isMemberCompletion = true; + + if (mappedNode.kind === SyntaxKind.Identifier || mappedNode.kind === SyntaxKind.QualifiedName || mappedNode.kind === SyntaxKind.PropertyAccess) { + var symbol = typeInfoResolver.getSymbolInfo(mappedNode); + + // This is an alias, follow what it aliases + if (symbol && symbol.flags & SymbolFlags.Import) { + symbol = typeInfoResolver.getAliasedSymbol(symbol); + } + + if (symbol && symbol.flags & SymbolFlags.HasExports) { + // Extract module or enum members + forEachValue(symbol.exports, symbol => { + if (typeInfoResolver.isValidPropertyAccess((mappedNode.parent), symbol.name)) { + symbols.push(symbol); + } + }); + } + } + + var type = typeInfoResolver.getTypeOfNode(mappedNode); + var apparentType = type && typeInfoResolver.getApparentType(type); + if (apparentType) { + // Filter private properties + forEach(apparentType.getApparentProperties(), symbol => { + if (typeInfoResolver.isValidPropertyAccess((mappedNode.parent), symbol.name)) { + symbols.push(symbol); + } + }); } - var symbols = type.getApparentProperties(); - isMemberCompletion = true; getCompletionEntriesFromSymbols(symbols, activeCompletionSession); } else { @@ -1817,40 +2556,29 @@ module ts { // Object literal expression, look up possible property names from contextual type if (containingObjectLiteral) { - var searchPosition = Math.min(position, TypeScript.end(containingObjectLiteral)); - var path = TypeScript.ASTHelpers.getAstAtPosition(sourceUnit, searchPosition); - // Get the object literal node + var objectLiteral = (mappedNode.kind === SyntaxKind.ObjectLiteral ? mappedNode : getAncestor(mappedNode, SyntaxKind.ObjectLiteral)); - while (node && node.kind() !== TypeScript.SyntaxKind.ObjectLiteralExpression) { - node = node.parent; - } - - if (!node || node.kind() !== TypeScript.SyntaxKind.ObjectLiteralExpression) { - // AST Path look up did not result in the same node as Fidelity Syntax Tree look up. - // Once we remove AST this will no longer be a problem. - return null; - } + Debug.assert(objectLiteral); isMemberCompletion = true; - //// Try to get the object members form contextual typing - //var contextualMembers = compiler.getContextualMembersFromAST(node, document); - //if (contextualMembers && contextualMembers.symbols && contextualMembers.symbols.length > 0) { - // // get existing members - // var existingMembers = compiler.getVisibleMemberSymbolsFromAST(node, document); + var contextualType = typeInfoResolver.getContextualType(objectLiteral); + if (!contextualType) { + return undefined; + } - // // Add filtterd items to the completion list - // getCompletionEntriesFromSymbols({ - // symbols: filterContextualMembersList(contextualMembers.symbols, existingMembers, filename, position), - // enclosingScopeSymbol: contextualMembers.enclosingScopeSymbol - // }, entries); - //} + var contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType); + if (contextualTypeMembers && contextualTypeMembers.length > 0) { + // Add filtered items to the completion list + var filteredMembers = filterContextualMembersList(contextualTypeMembers, objectLiteral.properties); + getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); + } } - // Get scope memebers + // Get scope members else { isMemberCompletion = false; /// TODO filter meaning based on the current context - var symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace; + var symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Import; var symbols = typeInfoResolver.getSymbolsInScope(mappedNode, symbolMeanings); getCompletionEntriesFromSymbols(symbols, activeCompletionSession); @@ -1868,9 +2596,9 @@ module ts { }; } - function getCompletionEntryDetails(filename: string, position: number, entryName: string) { + function getCompletionEntryDetails(filename: string, position: number, entryName: string): CompletionEntryDetails { // Note: No need to call synchronizeHostData, as we have captured all the data we need - // in the getCompletionsAtPosition erlier + // in the getCompletionsAtPosition earlier filename = TypeScript.switchToForwardSlashes(filename); var session = activeCompletionSession; @@ -1884,14 +2612,18 @@ module ts { if (symbol) { var type = session.typeChecker.getTypeOfSymbol(symbol); Debug.assert(type, "Could not find type for symbol"); - var completionEntry = createCompletionEntry(symbol); + var completionEntry = createCompletionEntry(symbol, session.typeChecker); + // TODO(drosen): Right now we just permit *all* semantic meanings when calling 'getSymbolKind' + // which is permissible given that it is backwards compatible; but really we should consider + // passing the meaning for the node so that we don't report that a suggestion for a value is an interface. + // We COULD also just do what 'getSymbolModifiers' does, which is to use the first declaration. + var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getSourceFile(filename), session.location, session.typeChecker, session.location, SemanticMeaning.All); return { name: entryName, - kind: completionEntry.kind, + kind: displayPartsDocumentationsAndSymbolKind.symbolKind, kindModifiers: completionEntry.kindModifiers, - type: session.typeChecker.typeToString(type, session.location), - fullSymbolName: typeInfoResolver.symbolToString(symbol, session.location), - docComment: "" + displayParts: displayPartsDocumentationsAndSymbolKind.displayParts, + documentation: displayPartsDocumentationsAndSymbolKind.documentation }; } else { @@ -1900,31 +2632,12 @@ module ts { name: entryName, kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none, - type: undefined, - fullSymbolName: entryName, - docComment: undefined + displayParts: [displayPart(entryName, SymbolDisplayPartKind.keyword)], + documentation: undefined }; } } - function getNodeAtPosition(sourceFile: SourceFile, position: number) { - var current: Node = sourceFile; - outer: while (true) { - // find the child that has this - for (var i = 0, n = current.getChildCount(); i < n; i++) { - var child = current.getChildAt(i); - if (child.getStart() <= position && position < child.getEnd()) { - current = child; - continue outer; - } - if (child.end > position) { - break; - } - } - return current; - } - } - function getContainerNode(node: Node): Node { while (true) { node = node.parent; @@ -1947,29 +2660,48 @@ module ts { } } - function getSymbolKind(symbol: Symbol): string { - var flags = symbol.getFlags(); + // TODO(drosen): use contextual SemanticMeaning. + function getSymbolKind(symbol: Symbol, typeResolver: TypeChecker): string { + var flags = typeInfoResolver.getRootSymbols(symbol)[0].getFlags(); - if (flags & SymbolFlags.Module) return ScriptElementKind.moduleElement; if (flags & SymbolFlags.Class) return ScriptElementKind.classElement; - if (flags & SymbolFlags.Interface) return ScriptElementKind.interfaceElement; if (flags & SymbolFlags.Enum) return ScriptElementKind.enumElement; - if (flags & SymbolFlags.Variable) return ScriptElementKind.variableElement; - if (flags & SymbolFlags.Function) return ScriptElementKind.functionElement; + if (flags & SymbolFlags.Interface) return ScriptElementKind.interfaceElement; + if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement; + + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver); + if (result === ScriptElementKind.unknown) { + if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement; + if (flags & SymbolFlags.EnumMember) return ScriptElementKind.variableElement; + if (flags & SymbolFlags.Import) return ScriptElementKind.alias; + } + + return result; + } + + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol: Symbol, flags: SymbolFlags, typeResolver: TypeChecker) { + if (typeResolver.isUndefinedSymbol(symbol)) { + return ScriptElementKind.variableElement; + } + if (typeResolver.isArgumentsSymbol(symbol)) { + return ScriptElementKind.localVariableElement; + } + if (flags & SymbolFlags.Variable) { + if (isFirstDeclarationOfSymbolParameter(symbol)) { + return ScriptElementKind.parameterElement; + } + return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localVariableElement : ScriptElementKind.variableElement; + } + if (flags & SymbolFlags.Function) return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localFunctionElement : ScriptElementKind.functionElement; if (flags & SymbolFlags.GetAccessor) return ScriptElementKind.memberGetAccessorElement; if (flags & SymbolFlags.SetAccessor) return ScriptElementKind.memberSetAccessorElement; if (flags & SymbolFlags.Method) return ScriptElementKind.memberFunctionElement; if (flags & SymbolFlags.Property) return ScriptElementKind.memberVariableElement; - if (flags & SymbolFlags.IndexSignature) return ScriptElementKind.indexSignatureElement; - if (flags & SymbolFlags.ConstructSignature) return ScriptElementKind.constructSignatureElement; - if (flags & SymbolFlags.CallSignature) return ScriptElementKind.callSignatureElement; if (flags & SymbolFlags.Constructor) return ScriptElementKind.constructorImplementationElement; - if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement; - if (flags & SymbolFlags.EnumMember) return ScriptElementKind.variableElement; return ScriptElementKind.unknown; } - + function getTypeKind(type: Type): string { var flags = type.getFlags(); @@ -1983,52 +2715,386 @@ module ts { return ScriptElementKind.unknown; } - function getNodeModifiers(node: Node): string { - var flags = node.flags; - var result: string[] = []; - - if (flags & NodeFlags.Private) result.push(ScriptElementKindModifier.privateMemberModifier); - if (flags & NodeFlags.Public) result.push(ScriptElementKindModifier.publicMemberModifier); - if (flags & NodeFlags.Static) result.push(ScriptElementKindModifier.staticModifier); - if (flags & NodeFlags.Export) result.push(ScriptElementKindModifier.exportedModifier); - if (isInAmbientContext(node)) result.push(ScriptElementKindModifier.ambientModifier); - - return result.length > 0 ? result.join(',') : ScriptElementKindModifier.none; + function getNodeKind(node: Node): string { + switch (node.kind) { + case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement; + case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement; + case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; + case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; + case SyntaxKind.VariableDeclaration: return ScriptElementKind.variableElement; + case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement; + case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement; + case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement; + case SyntaxKind.Method: return ScriptElementKind.memberFunctionElement; + case SyntaxKind.Property: return ScriptElementKind.memberVariableElement; + case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement; + case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement; + case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement; + case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; + case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; + case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; + case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + return ScriptElementKind.unknown; + } } - /// QuickInfo - function getTypeAtPosition(fileName: string, position: number): TypeInfo { + function getSymbolModifiers(symbol: Symbol): string { + return symbol && symbol.declarations && symbol.declarations.length > 0 + ? getNodeModifiers(symbol.declarations[0]) + : ScriptElementKindModifier.none; + } + + function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol: Symbol, sourceFile: SourceFile, enclosingDeclaration: Node, + typeResolver: TypeChecker, location: Node, + // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location + semanticMeaning = getMeaningFromLocation(location)) { + var displayParts: SymbolDisplayPart[] = []; + var documentation: SymbolDisplayPart[]; + var symbolFlags = typeResolver.getRootSymbols(symbol)[0].flags; + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver); + var hasAddedSymbolInfo: boolean; + // Class at constructor site need to be shown as constructor apart from property,method, vars + if (symbolKind !== ScriptElementKind.unknown || symbolFlags & SymbolFlags.Class || symbolFlags & SymbolFlags.Import) { + // If it is accessor they are allowed only if location is at name of the accessor + if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { + symbolKind = ScriptElementKind.memberVariableElement; + } + + var type = typeResolver.getTypeOfSymbol(symbol); + if (type) { + if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { + // try get the call/construct signature from the type if it matches + var callExpression: CallExpression; + if (location.parent.kind === SyntaxKind.PropertyAccess && (location.parent).right === location) { + location = location.parent; + } + callExpression = location.parent; + + var candidateSignatures: Signature[] = []; + signature = typeResolver.getResolvedSignature(callExpression, candidateSignatures); + if (!signature && candidateSignatures.length) { + // Use the first candidate: + signature = candidateSignatures[0]; + } + + var useConstructSignatures = callExpression.kind === SyntaxKind.NewExpression || callExpression.func.kind === SyntaxKind.SuperKeyword; + var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); + + if (!contains(allSignatures, signature.target || signature)) { + // Get the first signature if there + signature = allSignatures.length ? allSignatures[0] : undefined; + } + + if (signature) { + if (useConstructSignatures && (symbolFlags & SymbolFlags.Class)) { + // Constructor + symbolKind = ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else if (symbolFlags & SymbolFlags.Import) { + symbolKind = ScriptElementKind.alias; + displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + displayParts.push(textPart(symbolKind)); + displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + displayParts.push(spacePart()); + if (useConstructSignatures) { + displayParts.push(keywordPart(SyntaxKind.NewKeyword)); + displayParts.push(spacePart()); + } + addFullSymbolName(symbol); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + + switch (symbolKind) { + case ScriptElementKind.memberVariableElement: + case ScriptElementKind.variableElement: + case ScriptElementKind.parameterElement: + case ScriptElementKind.localVariableElement: + // If it is call or construct signature of lambda's write type name + displayParts.push(punctuationPart(SyntaxKind.ColonToken)); + displayParts.push(spacePart()); + if (useConstructSignatures) { + displayParts.push(keywordPart(SyntaxKind.NewKeyword)); + displayParts.push(spacePart()); + } + if (!(type.flags & TypeFlags.Anonymous)) { + displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments)); + } + addSignatureDisplayParts(signature, allSignatures, TypeFormatFlags.WriteArrowStyleSignature); + break; + + default: + // Just signature + addSignatureDisplayParts(signature, allSignatures); + } + hasAddedSymbolInfo = true; + } + } + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & SymbolFlags.Accessor)) || // name of function declaration + (location.kind === SyntaxKind.ConstructorKeyword && location.parent.kind === SyntaxKind.Constructor)) { // At constructor keyword of constructor declaration + // get the signature from the declaration and write it + var signature: Signature; + var functionDeclaration = location.parent; + var allSignatures = functionDeclaration.kind === SyntaxKind.Constructor ? type.getConstructSignatures() : type.getCallSignatures(); + if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { + signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); + } + else { + signature = allSignatures[0]; + } + + if (functionDeclaration.kind === SyntaxKind.Constructor) { + // show (constructor) Type(...) signature + addPrefixForAnyFunctionOrVar(type.symbol, ScriptElementKind.constructorImplementationElement); + } + else { + // (function/method) symbol(..signature) + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === SyntaxKind.CallSignature && + !(type.symbol.flags & SymbolFlags.TypeLiteral || type.symbol.flags & SymbolFlags.ObjectLiteral) ? type.symbol : symbol, symbolKind); + } + + addSignatureDisplayParts(signature, allSignatures); + hasAddedSymbolInfo = true; + } + } + } + if (symbolFlags & SymbolFlags.Class && !hasAddedSymbolInfo) { + displayParts.push(keywordPart(SyntaxKind.ClassKeyword)); + displayParts.push(spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if ((symbolFlags & SymbolFlags.Interface) && (semanticMeaning & SemanticMeaning.Type)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(keywordPart(SyntaxKind.InterfaceKeyword)); + displayParts.push(spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if (symbolFlags & SymbolFlags.Enum) { + addNewLineIfDisplayPartsExist(); + displayParts.push(keywordPart(SyntaxKind.EnumKeyword)); + displayParts.push(spacePart()); + addFullSymbolName(symbol); + } + if (symbolFlags & SymbolFlags.Module) { + addNewLineIfDisplayPartsExist(); + displayParts.push(keywordPart(SyntaxKind.ModuleKeyword)); + displayParts.push(spacePart()); + addFullSymbolName(symbol); + } + if ((symbolFlags & SymbolFlags.TypeParameter) && (semanticMeaning & SemanticMeaning.Type)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + displayParts.push(textPart("type parameter")); + displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + displayParts.push(spacePart()); + addFullSymbolName(symbol); + displayParts.push(spacePart()); + displayParts.push(keywordPart(SyntaxKind.InKeyword)); + displayParts.push(spacePart()); + if (symbol.parent) { + // Class/Interface type parameter + addFullSymbolName(symbol.parent, enclosingDeclaration); + writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); + } + else { + // Method/function type parameter + var signatureDeclaration = getDeclarationOfKind(symbol, SyntaxKind.TypeParameter).parent; + var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); + if (signatureDeclaration.kind === SyntaxKind.ConstructSignature) { + displayParts.push(keywordPart(SyntaxKind.NewKeyword)); + displayParts.push(spacePart()); + } + else if (signatureDeclaration.kind !== SyntaxKind.CallSignature && signatureDeclaration.name) { + addFullSymbolName(signatureDeclaration.symbol); + } + displayParts.push.apply(displayParts, signatureToDisplayParts(typeResolver, signature, sourceFile, TypeFormatFlags.WriteTypeArgumentsOfSignature)); + } + } + if (symbolFlags & SymbolFlags.EnumMember) { + addPrefixForAnyFunctionOrVar(symbol, "enum member"); + var declaration = symbol.declarations[0]; + if (declaration.kind === SyntaxKind.EnumMember) { + var constantValue = typeResolver.getEnumMemberValue(declaration); + if (constantValue !== undefined) { + displayParts.push(spacePart()); + displayParts.push(operatorPart(SyntaxKind.EqualsToken)); + displayParts.push(spacePart()); + displayParts.push(displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); + } + } + } + if (symbolFlags & SymbolFlags.Import) { + addNewLineIfDisplayPartsExist(); + displayParts.push(keywordPart(SyntaxKind.ImportKeyword)); + displayParts.push(spacePart()); + addFullSymbolName(symbol); + displayParts.push(spacePart()); + displayParts.push(punctuationPart(SyntaxKind.EqualsToken)); + displayParts.push(spacePart()); + ts.forEach(symbol.declarations, declaration => { + if (declaration.kind === SyntaxKind.ImportDeclaration) { + var importDeclaration = declaration; + if (importDeclaration.externalModuleName) { + displayParts.push(keywordPart(SyntaxKind.RequireKeyword)); + displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + displayParts.push(displayPart(getTextOfNode(importDeclaration.externalModuleName), SymbolDisplayPartKind.stringLiteral)); + displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + } + else { + var internalAliasSymbol = typeResolver.getSymbolInfo(importDeclaration.entityName); + addFullSymbolName(internalAliasSymbol, enclosingDeclaration); + } + return true; + } + }); + } + if (!hasAddedSymbolInfo) { + if (symbolKind !== ScriptElementKind.unknown) { + if (type) { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + // For properties, variables and local vars: show the type + if (symbolKind === ScriptElementKind.memberVariableElement || + symbolFlags & SymbolFlags.Variable || + symbolKind === ScriptElementKind.localVariableElement) { + displayParts.push(punctuationPart(SyntaxKind.ColonToken)); + displayParts.push(spacePart()); + // If the type is type parameter, format it specially + if (type.symbol && type.symbol.flags & SymbolFlags.TypeParameter) { + var typeParameterParts = mapToDisplayParts(writer => { + typeResolver.writeTypeParameter(type, writer, enclosingDeclaration); + }); + displayParts.push.apply(displayParts, typeParameterParts); + } + else { + displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, type, enclosingDeclaration)); + } + } + else if (symbolFlags & SymbolFlags.Function || + symbolFlags & SymbolFlags.Method || + symbolFlags & SymbolFlags.Constructor || + symbolFlags & SymbolFlags.Signature || + symbolFlags & SymbolFlags.Accessor) { + var allSignatures = type.getCallSignatures(); + addSignatureDisplayParts(allSignatures[0], allSignatures); + } + } + } + else { + symbolKind = getSymbolKind(symbol, typeResolver); + } + } + + if (!documentation) { + documentation = symbol.getDocumentationComment(); + } + + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + + function addNewLineIfDisplayPartsExist() { + if (displayParts.length) { + displayParts.push(lineBreakPart()); + } + } + + function addFullSymbolName(symbol: Symbol, enclosingDeclaration?: Node) { + var fullSymbolDisplayParts = symbolToDisplayParts(typeResolver, symbol, enclosingDeclaration || sourceFile, /*meaning*/ undefined, + SymbolFormatFlags.WriteTypeParametersOrArguments | SymbolFormatFlags.UseOnlyExternalAliasing); + displayParts.push.apply(displayParts, fullSymbolDisplayParts); + } + + function addPrefixForAnyFunctionOrVar(symbol: Symbol, symbolKind: string) { + addNewLineIfDisplayPartsExist(); + if (symbolKind) { + displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + displayParts.push(textPart(symbolKind)); + displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + displayParts.push(spacePart()); + addFullSymbolName(symbol); + } + } + + function addSignatureDisplayParts(signature: Signature, allSignatures: Signature[], flags?: TypeFormatFlags) { + displayParts.push.apply(displayParts, signatureToDisplayParts(typeResolver, signature, enclosingDeclaration, flags | TypeFormatFlags.WriteTypeArgumentsOfSignature)); + if (allSignatures.length > 1) { + displayParts.push(spacePart()); + displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + displayParts.push(operatorPart(SyntaxKind.PlusToken)); + displayParts.push(displayPart((allSignatures.length - 1).toString(), SymbolDisplayPartKind.numericLiteral)); + displayParts.push(spacePart()); + displayParts.push(textPart(allSignatures.length === 2 ? "overload" : "overloads")); + displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + } + documentation = signature.getDocumentationComment(); + } + + function writeTypeParametersOfSymbol(symbol: Symbol, enclosingDeclaration: Node) { + var typeParameterParts = mapToDisplayParts(writer => { + typeResolver.writeTypeParametersOfSymbol(symbol, writer, enclosingDeclaration); + }); + displayParts.push.apply(displayParts, typeParameterParts); + } + } + + function getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { synchronizeHostData(); fileName = TypeScript.switchToForwardSlashes(fileName); var sourceFile = getSourceFile(fileName); - var node = getNodeAtPosition(sourceFile, position); + var node = getTouchingPropertyName(sourceFile, position); if (!node) { return undefined; } var symbol = typeInfoResolver.getSymbolInfo(node); - var type = symbol && typeInfoResolver.getTypeOfSymbol(symbol); - if (type) { - return new TypeInfo( - new TypeScript.MemberNameString(typeInfoResolver.typeToString(type)), - "", typeInfoResolver.symbolToString(symbol, getContainerNode(node)), - getSymbolKind(symbol), TypeScript.TextSpan.fromBounds(node.pos, node.end)); + if (!symbol) { + // Try getting just type at this position and show + switch (node.kind) { + case SyntaxKind.Identifier: + case SyntaxKind.PropertyAccess: + case SyntaxKind.QualifiedName: + case SyntaxKind.ThisKeyword: + case SyntaxKind.SuperKeyword: + // For the identifiers/this/super etc get the type at position + var type = typeInfoResolver.getTypeOfNode(node); + if (type) { + return { + kind: ScriptElementKind.unknown, + kindModifiers: ScriptElementKindModifier.none, + textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()), + displayParts: typeToDisplayParts(typeInfoResolver, type, getContainerNode(node)), + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + }; + } + } + + return undefined; } - return undefined; + var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, getContainerNode(node), typeInfoResolver, node); + return { + kind: displayPartsDocumentationsAndKind.symbolKind, + kindModifiers: getSymbolModifiers(symbol), + textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()), + displayParts: displayPartsDocumentationsAndKind.displayParts, + documentation: displayPartsDocumentationsAndKind.documentation + }; } /// Goto definition - function getDefinitionAtPosition(filename: string, position: number): DefinitionInfo[]{ + function getDefinitionAtPosition(filename: string, position: number): DefinitionInfo[] { function getDefinitionInfo(node: Node, symbolKind: string, symbolName: string, containerName: string): DefinitionInfo { - return new DefinitionInfo( - node.getSourceFile().filename, - TypeScript.TextSpan.fromBounds(node.getStart(), node.getEnd()), - symbolKind, - symbolName, - undefined, - containerName); + return { + fileName: node.getSourceFile().filename, + textSpan: TypeScript.TextSpan.fromBounds(node.getStart(), node.getEnd()), + kind: symbolKind, + name: symbolName, + containerKind: undefined, + containerName: containerName + }; } function tryAddSignature(signatureDeclarations: Declaration[], selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) { @@ -2081,7 +3147,7 @@ module ts { filename = TypeScript.switchToForwardSlashes(filename); var sourceFile = getSourceFile(filename); - var node = getNodeAtPosition(sourceFile, position); + var node = getTouchingPropertyName(sourceFile, position); if (!node) { return undefined; } @@ -2096,12 +3162,17 @@ module ts { /// Triple slash reference comments var comment = forEach(sourceFile.referencedFiles, r => (r.pos <= position && position < r.end) ? r : undefined); if (comment) { - var targetFilename = normalizePath(combinePaths(getDirectoryPath(filename), comment.filename)); + var targetFilename = isRootedDiskPath(comment.filename) ? comment.filename : combinePaths(getDirectoryPath(filename), comment.filename); + targetFilename = normalizePath(targetFilename); if (program.getSourceFile(targetFilename)) { - return [new DefinitionInfo( - targetFilename, TypeScript.TextSpan.fromBounds(0, 0), - ScriptElementKind.scriptElement, - comment.filename, undefined, undefined)]; + return [{ + fileName: targetFilename, + textSpan: TypeScript.TextSpan.fromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: comment.filename, + containerName: undefined, + containerKind: undefined + }]; } return undefined; } @@ -2110,18 +3181,17 @@ module ts { // Could not find a symbol e.g. node is string or number keyword, // or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol - if (!symbol || !(symbol.getDeclarations())) { + if (!symbol) { return undefined; } var result: DefinitionInfo[] = []; var declarations = symbol.getDeclarations(); - var symbolName = typeInfoResolver.symbolToString(symbol, node); - var symbolKind = getSymbolKind(symbol); + var symbolName = typeInfoResolver.symbolToString(symbol); // Do not get scoped name, just the name of the symbol + var symbolKind = getSymbolKind(symbol, typeInfoResolver); var containerSymbol = symbol.parent; var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; - var containerKind = containerSymbol ? getSymbolKind(symbol) : ""; if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { @@ -2134,20 +3204,21 @@ module ts { return result; } + /// References and Occurrences function getOccurrencesAtPosition(filename: string, position: number): ReferenceEntry[] { synchronizeHostData(); filename = TypeScript.switchToForwardSlashes(filename); var sourceFile = getSourceFile(filename); - var node = getNodeAtPosition(sourceFile, position); + var node = getTouchingWord(sourceFile, position); if (!node) { return undefined; } if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.ThisKeyword || node.kind === SyntaxKind.SuperKeyword || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { - return getReferencesForNode(node, [sourceFile]); + return getReferencesForNode(node, [sourceFile], /*findInStrings:*/ false, /*findInComments:*/ false); } switch (node.kind) { @@ -2162,6 +3233,11 @@ module ts { return getReturnOccurrences(node.parent); } break; + case SyntaxKind.ThrowKeyword: + if (hasKind(node.parent, SyntaxKind.ThrowStatement)) { + return getThrowOccurrences(node.parent); + } + break; case SyntaxKind.TryKeyword: case SyntaxKind.CatchKeyword: case SyntaxKind.FinallyKeyword: @@ -2181,8 +3257,20 @@ module ts { } break; case SyntaxKind.BreakKeyword: - if (hasKind(node.parent, SyntaxKind.BreakStatement)) { - return getBreakStatementOccurences(node.parent); + case SyntaxKind.ContinueKeyword: + if (hasKind(node.parent, SyntaxKind.BreakStatement) || hasKind(node.parent, SyntaxKind.ContinueStatement)) { + return getBreakOrContinueStatementOccurences(node.parent); + } + break; + case SyntaxKind.ForKeyword: + if (hasKind(node.parent, SyntaxKind.ForStatement) || hasKind(node.parent, SyntaxKind.ForInStatement)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case SyntaxKind.WhileKeyword: + case SyntaxKind.DoKeyword: + if (hasKind(node.parent, SyntaxKind.WhileStatement) || hasKind(node.parent, SyntaxKind.DoStatement)) { + return getLoopBreakContinueOccurrences(node.parent); } break; case SyntaxKind.ConstructorKeyword: @@ -2190,6 +3278,11 @@ module ts { return getConstructorOccurrences(node.parent); } break; + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + if (hasKind(node.parent, SyntaxKind.GetAccessor) || hasKind(node.parent, SyntaxKind.SetAccessor)) { + return getGetAndSetOccurrences(node.parent); + } } return undefined; @@ -2239,9 +3332,13 @@ module ts { break; } } - + if (shouldHighlightNextKeyword) { - result.push(new ReferenceEntry(filename, TypeScript.TextSpan.fromBounds(elseKeyword.getStart(), ifKeyword.end), /* isWriteAccess */ false)); + result.push({ + fileName: filename, + textSpan: TypeScript.TextSpan.fromBounds(elseKeyword.getStart(), ifKeyword.end), + isWriteAccess: false + }); i++; // skip the next keyword continue; } @@ -2263,12 +3360,108 @@ module ts { } var keywords: Node[] = [] - forEachReturnStatement((func).body, returnStatement => { + forEachReturnStatement(func.body, returnStatement => { pushKeywordIf(keywords, returnStatement.getFirstToken(), SyntaxKind.ReturnKeyword); }); + // Include 'throw' statements that do not occur within a try block. + forEach(aggregateOwnedThrowStatements(func.body), throwStatement => { + pushKeywordIf(keywords, throwStatement.getFirstToken(), SyntaxKind.ThrowKeyword); + }); + return map(keywords, getReferenceEntryFromNode); } + + function getThrowOccurrences(throwStatement: ThrowStatement) { + var owner = getThrowStatementOwner(throwStatement); + + if (!owner) { + return undefined; + } + + var keywords: Node[] = []; + + forEach(aggregateOwnedThrowStatements(owner), throwStatement => { + pushKeywordIf(keywords, throwStatement.getFirstToken(), SyntaxKind.ThrowKeyword); + }); + + // If the "owner" is a function, then we equate 'return' and 'throw' statements in their + // ability to "jump out" of the function, and include occurrences for both. + if (owner.kind === SyntaxKind.FunctionBlock) { + forEachReturnStatement(owner, returnStatement => { + pushKeywordIf(keywords, returnStatement.getFirstToken(), SyntaxKind.ReturnKeyword); + }); + } + + return map(keywords, getReferenceEntryFromNode); + } + + /** + * Aggregates all throw-statements within this node *without* crossing + * into function boundaries and try-blocks with catch-clauses. + */ + function aggregateOwnedThrowStatements(node: Node): ThrowStatement[] { + var statementAccumulator: ThrowStatement[] = [] + aggregate(node); + return statementAccumulator; + + function aggregate(node: Node): void { + if (node.kind === SyntaxKind.ThrowStatement) { + statementAccumulator.push(node); + } + else if (node.kind === SyntaxKind.TryStatement) { + var tryStatement = node; + + if (tryStatement.catchBlock) { + aggregate(tryStatement.catchBlock); + } + else { + // Exceptions thrown within a try block lacking a catch clause + // are "owned" in the current context. + aggregate(tryStatement.tryBlock); + } + + if (tryStatement.finallyBlock) { + aggregate(tryStatement.finallyBlock); + } + } + // Do not cross function boundaries. + else if (!isAnyFunction(node)) { + forEachChild(node, aggregate); + } + }; + } + + /** + * For lack of a better name, this function takes a throw statement and returns the + * nearest ancestor that is a try-block (whose try statement has a catch clause), + * function-block, or source file. + */ + function getThrowStatementOwner(throwStatement: ThrowStatement): Node { + var child: Node = throwStatement; + + while (child.parent) { + var parent = child.parent; + + if (parent.kind === SyntaxKind.FunctionBlock || parent.kind === SyntaxKind.SourceFile) { + return parent; + } + + // A throw-statement is only owned by a try-statement if the try-statement has + // a catch clause, and if the throw-statement occurs within the try block. + if (parent.kind === SyntaxKind.TryStatement) { + var tryStatement = parent; + + if (tryStatement.tryBlock === child && tryStatement.catchBlock) { + return child; + } + } + + child = parent; + } + + return undefined; + } function getTryCatchFinallyOccurrences(tryStatement: TryStatement): ReferenceEntry[] { var keywords: Node[] = []; @@ -2286,35 +3479,50 @@ module ts { return map(keywords, getReferenceEntryFromNode); } + function getLoopBreakContinueOccurrences(loopNode: IterationStatement): ReferenceEntry[] { + var keywords: Node[] = []; + + if (pushKeywordIf(keywords, loopNode.getFirstToken(), SyntaxKind.ForKeyword, SyntaxKind.WhileKeyword, SyntaxKind.DoKeyword)) { + // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. + if (loopNode.kind === SyntaxKind.DoStatement) { + var loopTokens = loopNode.getChildren(); + + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], SyntaxKind.WhileKeyword)) { + break; + } + } + } + } + + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + + forEach(breaksAndContinues, statement => { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), SyntaxKind.BreakKeyword, SyntaxKind.ContinueKeyword); + } + }); + + return map(keywords, getReferenceEntryFromNode); + } + function getSwitchCaseDefaultOccurrences(switchStatement: SwitchStatement) { var keywords: Node[] = []; pushKeywordIf(keywords, switchStatement.getFirstToken(), SyntaxKind.SwitchKeyword); - // Go through each clause in the switch statement, collecting the clause keywords. + // Types of break statements we can grab on to. + var breakSearchType = BreakContinueSearchType.All; + + // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. forEach(switchStatement.clauses, clause => { pushKeywordIf(keywords, clause.getFirstToken(), SyntaxKind.CaseKeyword, SyntaxKind.DefaultKeyword); - // For each clause, also recursively traverse the statements where we can find analogous breaks. - forEachChild(clause, function aggregateBreakKeywords(node: Node): void { - switch (node.kind) { - case SyntaxKind.BreakStatement: - // If the break statement has a label, it cannot be part of a switch block. - if (!(node).label) { - pushKeywordIf(keywords, node.getFirstToken(), SyntaxKind.BreakKeyword); - } - // Fall through - case SyntaxKind.ForStatement: - case SyntaxKind.ForInStatement: - case SyntaxKind.DoStatement: - case SyntaxKind.WhileStatement: - case SyntaxKind.SwitchStatement: - return; - } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); - // Do not cross function boundaries. - if (!isAnyFunction(node)) { - forEachChild(node, aggregateBreakKeywords); + forEach(breaksAndContinues, statement => { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), SyntaxKind.BreakKeyword); } }); }); @@ -2322,28 +3530,69 @@ module ts { return map(keywords, getReferenceEntryFromNode); } - function getBreakStatementOccurences(breakStatement: BreakOrContinueStatement): ReferenceEntry[] { - // TODO (drosen): Deal with labeled statements. - if (breakStatement.label) { - return undefined; - } - - for (var owner = node.parent; owner; owner = owner.parent) { + function getBreakOrContinueStatementOccurences(breakOrContinueStatement: BreakOrContinueStatement): ReferenceEntry[]{ + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + + if (owner) { switch (owner.kind) { case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: - // TODO (drosen): Handle loops! - return undefined; - + return getLoopBreakContinueOccurrences(owner) case SyntaxKind.SwitchStatement: return getSwitchCaseDefaultOccurrences(owner); + } + } + + return undefined; + } + + function aggregateAllBreakAndContinueStatements(node: Node): BreakOrContinueStatement[] { + var statementAccumulator: BreakOrContinueStatement[] = [] + aggregate(node); + return statementAccumulator; + + function aggregate(node: Node): void { + if (node.kind === SyntaxKind.BreakStatement || node.kind === SyntaxKind.ContinueStatement) { + statementAccumulator.push(node); + } + // Do not cross function boundaries. + else if (!isAnyFunction(node)) { + forEachChild(node, aggregate); + } + }; + } + + function ownsBreakOrContinueStatement(owner: Node, statement: BreakOrContinueStatement): boolean { + var actualOwner = getBreakOrContinueOwner(statement); + + return actualOwner && actualOwner === owner; + } + + function getBreakOrContinueOwner(statement: BreakOrContinueStatement): Node { + for (var node = statement.parent; node; node = node.parent) { + switch (node.kind) { + case SyntaxKind.SwitchStatement: + if (statement.kind === SyntaxKind.ContinueStatement) { + continue; + } + // Fall through. + case SyntaxKind.ForStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.WhileStatement: + case SyntaxKind.DoStatement: + if (!statement.label || isLabeledBy(node, statement.label.text)) { + return node; + } + break; default: - if (isAnyFunction(owner)) { + // Don't cross function boundaries. + if (isAnyFunction(node)) { return undefined; } + break; } } @@ -2364,9 +3613,26 @@ module ts { return map(keywords, getReferenceEntryFromNode); } + function getGetAndSetOccurrences(accessorDeclaration: AccessorDeclaration): ReferenceEntry[] { + var keywords: Node[] = []; + + tryPushAccessorKeyword(accessorDeclaration.symbol, SyntaxKind.GetAccessor); + tryPushAccessorKeyword(accessorDeclaration.symbol, SyntaxKind.SetAccessor); + + return map(keywords, getReferenceEntryFromNode); + + function tryPushAccessorKeyword(accessorSymbol: Symbol, accessorKind: SyntaxKind): void { + var accessor = getDeclarationOfKind(accessorSymbol, accessorKind); + + if (accessor) { + forEach(accessor.getChildren(), child => pushKeywordIf(keywords, child, SyntaxKind.GetKeyword, SyntaxKind.SetKeyword)); + } + } + } + // returns true if 'node' is defined and has a matching 'kind'. function hasKind(node: Node, kind: SyntaxKind) { - return !!(node && node.kind === kind); + return node !== undefined && node.kind === kind; } // Null-propagating 'parent' function. @@ -2384,13 +3650,21 @@ module ts { } } - function getReferencesAtPosition(filename: string, position: number): ReferenceEntry[] { + function findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] { + return findReferences(fileName, position, findInStrings, findInComments); + } + + function getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] { + return findReferences(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false); + } + + function findReferences(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): ReferenceEntry[] { synchronizeHostData(); - filename = TypeScript.switchToForwardSlashes(filename); - var sourceFile = getSourceFile(filename); + fileName = TypeScript.switchToForwardSlashes(fileName); + var sourceFile = getSourceFile(fileName); - var node = getNodeAtPosition(sourceFile, position); + var node = getTouchingPropertyName(sourceFile, position); if (!node) { return undefined; } @@ -2404,10 +3678,11 @@ module ts { return undefined; } - return getReferencesForNode(node, program.getSourceFiles()); + Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.NumericLiteral || node.kind === SyntaxKind.StringLiteral); + return getReferencesForNode(node, program.getSourceFiles(), findInStrings, findInComments); } - function getReferencesForNode(node: Node, sourceFiles : SourceFile[]): ReferenceEntry[] { + function getReferencesForNode(node: Node, sourceFiles: SourceFile[], findInStrings: boolean, findInComments: boolean): ReferenceEntry[] { // Labels if (isLabelName(node)) { if (isJumpStatementTarget(node)) { @@ -2434,29 +3709,32 @@ module ts { // Could not find a symbol e.g. unknown identifier if (!symbol) { - // Even if we did not find a symbol, we have an identifer, so there is at least + // Even if we did not find a symbol, we have an identifier, so there is at least // one reference that we know of. return that instead of undefined. return [getReferenceEntryFromNode(node)]; } - // the symbol was an internal symbol and does not have a declaration e.g.undefined symbol - if (!symbol.getDeclarations()) { + var declarations = symbol.declarations; + + // The symbol was an internal symbol and does not have a declaration e.g.undefined symbol + if (!declarations || !declarations.length) { return undefined; } var result: ReferenceEntry[]; // Compute the meaning from the location and the symbol it references - var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), symbol.getDeclarations()); + var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations); // Get the text to search for, we need to normalize it as external module names will have quote - var symbolName = getNormalizedSymbolName(symbol); + var symbolName = getNormalizedSymbolName(symbol.name, declarations); + // Get syntactic diagnostics var scope = getSymbolScope(symbol); if (scope) { result = []; - getReferencesInNode(scope, symbol, symbolName, node, searchMeaning, result); + getReferencesInNode(scope, symbol, symbolName, node, searchMeaning, findInStrings, findInComments, result); } else { forEach(sourceFiles, sourceFile => { @@ -2464,24 +3742,24 @@ module ts { if (lookUp(sourceFile.identifiers, symbolName)) { result = result || []; - getReferencesInNode(sourceFile, symbol, symbolName, node, searchMeaning, result); + getReferencesInNode(sourceFile, symbol, symbolName, node, searchMeaning, findInStrings, findInComments, result); } }); } return result; - function getNormalizedSymbolName(symbol: Symbol): string { + function getNormalizedSymbolName(symbolName: string, declarations: Declaration[]): string { // Special case for function expressions, whose names are solely local to their bodies. - var functionExpression = getDeclarationOfKind(symbol, SyntaxKind.FunctionExpression); + var functionExpression = forEach(declarations, d => d.kind === SyntaxKind.FunctionExpression ? d : undefined); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } else { - var name = symbol.name; + var name = symbolName; } - + var length = name.length; if (length >= 2 && name.charCodeAt(0) === CharacterCodes.doubleQuote && name.charCodeAt(length - 1) === CharacterCodes.doubleQuote) { return name.substring(1, length - 1); @@ -2506,22 +3784,24 @@ module ts { var scope: Node = undefined; var declarations = symbol.getDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var container = getContainerNode(declarations[i]); + if (declarations) { + for (var i = 0, n = declarations.length; i < n; i++) { + var container = getContainerNode(declarations[i]); - if (scope && scope !== container) { - // Different declarations have different containers, bail out - return undefined; + if (scope && scope !== container) { + // Different declarations have different containers, bail out + return undefined; + } + + if (container.kind === SyntaxKind.SourceFile && !isExternalModule(container)) { + // This is a global variable and not an external module, any declaration defined + // within this scope is visible outside the file + return undefined; + } + + // The search scope is the container node + scope = container; } - - if (container.kind === SyntaxKind.SourceFile && !isExternalModule(container)) { - // This is a global variable and not an external module, any declaration defined - // within this scope is visible outside the file - return undefined; - } - - // The search scope is the container node - scope = container; } return scope; @@ -2572,7 +3852,7 @@ module ts { forEach(possiblePositions, position => { cancellationToken.throwIfCancellationRequested(); - var node = getNodeAtPosition(sourceFile, position); + var node = getTouchingWord(sourceFile, position); if (!node || node.getWidth() !== labelName.length) { return; } @@ -2612,11 +3892,20 @@ module ts { return false; } - /// Search within node "container" for references for a search value, where the search value is defined as a - /// tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). - /// searchLocation: a node where the search value - function getReferencesInNode(container: Node, searchSymbol: Symbol, searchText: string, searchLocation: Node, searchMeaning: SearchMeaning, result: ReferenceEntry[]): void { + /** Search within node "container" for references for a search value, where the search value is defined as a + * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). + * searchLocation: a node where the search value + */ + function getReferencesInNode(container: Node, + searchSymbol: Symbol, + searchText: string, + searchLocation: Node, + searchMeaning: SemanticMeaning, + findInStrings: boolean, + findInComments: boolean, + result: ReferenceEntry[]): void { var sourceFile = container.getSourceFile(); + var tripleSlashDirectivePrefixRegex = /^\/\/\/\s* { cancellationToken.throwIfCancellationRequested(); - var referenceLocation = getNodeAtPosition(sourceFile, position); + var referenceLocation = getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { + // This wasn't the start of a token. Check to see if it might be a + // match in a comment or string if that's what the caller is asking + // for. + if ((findInStrings && isInString(position)) || + (findInComments && isInComment(position))) { + result.push({ + fileName: sourceFile.filename, + textSpan: new TypeScript.TextSpan(position, searchText.length), + isWriteAccess: false + }); + } return; } @@ -2637,18 +3937,37 @@ module ts { } var referenceSymbol = typeInfoResolver.getSymbolInfo(referenceLocation); - - // Could not find a symbol e.g. node is string or number keyword, - // or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol - if (!referenceSymbol || !(referenceSymbol.getDeclarations())) { - return; - } - - if (isRelatableToSearchSet(searchSymbols, referenceSymbol, referenceLocation)) { + if (referenceSymbol && isRelatableToSearchSet(searchSymbols, referenceSymbol, referenceLocation)) { result.push(getReferenceEntryFromNode(referenceLocation)); } }); } + + function isInString(position: number) { + var token = getTokenAtPosition(sourceFile, position); + return token && token.kind === SyntaxKind.StringLiteral && position > token.getStart(); + } + + function isInComment(position: number) { + var token = getTokenAtPosition(sourceFile, position); + if (token && position < token.getStart()) { + // First, we have to see if this position actually landed in a comment. + var commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos); + + // Then we want to make sure that it wasn't in a "///<" directive comment + // We don't want to unintentionally update a file name. + return forEach(commentRanges, c => { + if (c.pos < position && position < c.end) { + var commentText = sourceFile.text.substring(c.pos, c.end); + if (!tripleSlashDirectivePrefixRegex.test(commentText)) { + return true; + } + } + }); + } + + return false; + } } function getReferencesForSuperKeyword(superKeyword: Node): ReferenceEntry[]{ @@ -2679,7 +3998,7 @@ module ts { forEach(possiblePositions, position => { cancellationToken.throwIfCancellationRequested(); - var node = getNodeAtPosition(sourceFile, position); + var node = getTouchingWord(sourceFile, position); if (!node || node.kind !== SyntaxKind.SuperKeyword) { return; @@ -2717,7 +4036,7 @@ module ts { if (isExternalModule(searchSpaceNode)) { return undefined; } - // Fall through + // Fall through case SyntaxKind.FunctionDeclaration: case SyntaxKind.FunctionExpression: break; @@ -2745,7 +4064,7 @@ module ts { forEach(possiblePositions, position => { cancellationToken.throwIfCancellationRequested(); - var node = getNodeAtPosition(sourceFile, position); + var node = getTouchingWord(sourceFile, position); if (!node || node.kind !== SyntaxKind.ThisKeyword) { return; } @@ -2780,30 +4099,33 @@ module ts { // The search set contains at least the current symbol var result = [symbol]; - // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list - var rootSymbol = typeInfoResolver.getRootSymbol(symbol); - if (rootSymbol && rootSymbol !== symbol) { - result.push(rootSymbol); - } - // If the location is in a context sensitive location (i.e. in an object literal) try // to get a contextual type for it, and add the property symbol from the contextual // type to the search set if (isNameOfPropertyAssignment(location)) { - var symbolFromContextualType = getPropertySymbolFromContextualType(location); - if (symbolFromContextualType) result.push(typeInfoResolver.getRootSymbol(symbolFromContextualType)); + forEach(getPropertySymbolsFromContextualType(location), contextualSymbol => { + result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol)); + }); } - // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions - if (symbol.parent && symbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { - getPropertySymbolsFromBaseTypes(symbol.parent, symbol.getName(), result); - } + // If this is a union property, add all the symbols from all its source symbols in all unioned types. + // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list + forEach(typeInfoResolver.getRootSymbols(symbol), rootSymbol => { + if (rootSymbol !== symbol) { + result.push(rootSymbol); + } + + // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions + if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + } + }); return result; } function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[]): void { - if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { + if (symbol && symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { forEach(symbol.getDeclarations(), declaration => { if (declaration.kind === SyntaxKind.ClassDeclaration) { getPropertySymbolFromTypeReference((declaration).baseType); @@ -2818,25 +4140,22 @@ module ts { function getPropertySymbolFromTypeReference(typeReference: TypeReferenceNode) { if (typeReference) { - // TODO: move to getTypeOfNode instead - var typeReferenceSymbol = typeInfoResolver.getSymbolInfo(typeReference.typeName); - if (typeReferenceSymbol) { - var propertySymbol = typeReferenceSymbol.members[propertyName]; - if (propertySymbol) result.push(typeReferenceSymbol.members[propertyName]); + var type = typeInfoResolver.getTypeOfNode(typeReference); + if (type) { + var propertySymbol = typeInfoResolver.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push(propertySymbol); + } - // Visit the typeReference as well to see if it directelly or indirectelly use that property - getPropertySymbolsFromBaseTypes(typeReferenceSymbol, propertyName, result); + // Visit the typeReference as well to see if it directly or indirectly use that property + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result); } } } } function isRelatableToSearchSet(searchSymbols: Symbol[], referenceSymbol: Symbol, referenceLocation: Node): boolean { - // Unwrap symbols to get to the root (e.g. triansient symbols as a result of widenning) - var referenceSymbolTarget = typeInfoResolver.getRootSymbol(referenceSymbol); - - // if it is in the list, then we are done - if (searchSymbols.indexOf(referenceSymbolTarget) >= 0) { + if (searchSymbols.indexOf(referenceSymbol) >= 0) { return true; } @@ -2844,149 +4163,74 @@ module ts { // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol if (isNameOfPropertyAssignment(referenceLocation)) { - var symbolFromContextualType = getPropertySymbolFromContextualType(referenceLocation); - if (symbolFromContextualType && searchSymbols.indexOf(typeInfoResolver.getRootSymbol(symbolFromContextualType)) >= 0) { + return forEach(getPropertySymbolsFromContextualType(referenceLocation), contextualSymbol => { + return forEach(typeInfoResolver.getRootSymbols(contextualSymbol), s => searchSymbols.indexOf(s) >= 0); + }); + } + + // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) + // Or a union property, use its underlying unioned symbols + return forEach(typeInfoResolver.getRootSymbols(referenceSymbol), rootSymbol => { + // if it is in the list, then we are done + if (searchSymbols.indexOf(rootSymbol) >= 0) { return true; } - } - // Finally, try all properties with the same name in any type the containing type extened or implemented, and - // see if any is in the list - if (referenceSymbol.parent && referenceSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { - var result: Symbol[] = []; - getPropertySymbolsFromBaseTypes(referenceSymbol.parent, referenceSymbol.getName(), result); - return forEach(result, s => searchSymbols.indexOf(s) >= 0); - } + // Finally, try all properties with the same name in any type the containing type extended or implemented, and + // see if any is in the list + if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { + var result: Symbol[] = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + return forEach(result, s => searchSymbols.indexOf(s) >= 0); + } - return false; + return false; + }); } - function getPropertySymbolFromContextualType(node: Node): Symbol { + function getPropertySymbolsFromContextualType(node: Node): Symbol[] { if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeInfoResolver.getContextualType(objectLiteral); + var name = (node).text; if (contextualType) { - return typeInfoResolver.getPropertyOfType(contextualType, (node).text); + if (contextualType.flags & TypeFlags.Union) { + // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) + // if not, search the constituent types for the property + var unionProperty = contextualType.getProperty(name) + if (unionProperty) { + return [unionProperty]; + } + else { + var result: Symbol[] = []; + forEach((contextualType).types, t => { + var symbol = t.getProperty(name); + if (symbol) { + result.push(symbol); + } + }); + return result; + } + } + else { + var symbol = contextualType.getProperty(name); + if (symbol) { + return [symbol]; + } + } } } return undefined; } - function getMeaningFromDeclaration(node: Declaration): SearchMeaning { - switch (node.kind) { - case SyntaxKind.Parameter: - case SyntaxKind.VariableDeclaration: - case SyntaxKind.Property: - case SyntaxKind.PropertyAssignment: - case SyntaxKind.EnumMember: - case SyntaxKind.Method: - case SyntaxKind.Constructor: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.ArrowFunction: - case SyntaxKind.CatchBlock: - return SearchMeaning.Value; - - case SyntaxKind.TypeParameter: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.TypeLiteral: - return SearchMeaning.Type; - - case SyntaxKind.ClassDeclaration: - case SyntaxKind.EnumDeclaration: - return SearchMeaning.Value | SearchMeaning.Type; - - case SyntaxKind.ModuleDeclaration: - if ((node).name.kind === SyntaxKind.StringLiteral) { - return SearchMeaning.Namespace | SearchMeaning.Value; - } - else if (isInstantiated(node)) { - return SearchMeaning.Namespace | SearchMeaning.Value; - } - else { - return SearchMeaning.Namespace; - } - break; - - case SyntaxKind.ImportDeclaration: - return SearchMeaning.Value | SearchMeaning.Type | SearchMeaning.Namespace; - } - Debug.fail("Unkown declaration type"); - } - - function isTypeReference(node: Node): boolean { - if (node.parent.kind === SyntaxKind.QualifiedName && (node.parent).right === node) - node = node.parent; - - return node.parent.kind === SyntaxKind.TypeReference; - } - - function isNamespaceReference(node: Node): boolean { - var root = node; - var isLastClause = true; - if (root.parent.kind === SyntaxKind.QualifiedName) { - while (root.parent && root.parent.kind === SyntaxKind.QualifiedName) - root = root.parent; - - isLastClause = (root).right === node; - } - - return root.parent.kind === SyntaxKind.TypeReference && !isLastClause; - } - - function isInRightSideOfImport(node: EntityName) { - while (node.parent.kind === SyntaxKind.QualifiedName) { - node = node.parent; - } - - return node.parent.kind === SyntaxKind.ImportDeclaration && (node.parent).entityName === node; - } - - function getMeaningFromRightHandSideOfImport(node: Node) { - Debug.assert(node.kind === SyntaxKind.Identifier); - - // import a = |b|; // Namespace - // import a = |b.c|; // Value, type, namespace - // import a = |b.c|.d; // Namespace - - if (node.parent.kind === SyntaxKind.QualifiedName && - (node.parent).right === node && - node.parent.parent.kind === SyntaxKind.ImportDeclaration) { - return SearchMeaning.Value | SearchMeaning.Type | SearchMeaning.Namespace; - } - return SearchMeaning.Namespace; - } - - function getMeaningFromLocation(node: Node): SearchMeaning { - if (node.parent.kind === SyntaxKind.ExportAssignment) { - return SearchMeaning.Value | SearchMeaning.Type | SearchMeaning.Namespace; - } - else if (isInRightSideOfImport(node)) { - return getMeaningFromRightHandSideOfImport(node); - } - else if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { - return getMeaningFromDeclaration(node.parent); - } - else if (isTypeReference(node)) { - return SearchMeaning.Type; - } - else if (isNamespaceReference(node)) { - return SearchMeaning.Namespace; - } - else { - return SearchMeaning.Value; - } - } - - /// Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations - /// of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class - /// then we need to widen the search to include type positions as well. - /// On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated - /// module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) - /// do not intersect in any of the three spaces. - function getIntersectingMeaningFromDeclarations(meaning: SearchMeaning, declarations: Declaration[]): SearchMeaning { + /** Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations + * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class + * then we need to widen the search to include type positions as well. + * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated + * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) + * do not intersect in any of the three spaces. + */ + function getIntersectingMeaningFromDeclarations(meaning: SemanticMeaning, declarations: Declaration[]): SemanticMeaning { if (declarations) { do { // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] @@ -2994,7 +4238,7 @@ module ts { // intersects with the class in the value space. // To achieve that we will keep iterating until the result stabilizes. - // Remeber the last meaning + // Remember the last meaning var lastIterationMeaning = meaning; for (var i = 0, n = declarations.length; i < n; i++) { @@ -3019,10 +4263,14 @@ module ts { end -= 1; } - return new ReferenceEntry(node.getSourceFile().filename, TypeScript.TextSpan.fromBounds(start, end), isWriteAccess(node)); + return { + fileName: node.getSourceFile().filename, + textSpan: TypeScript.TextSpan.fromBounds(start, end), + isWriteAccess: isWriteAccess(node) + }; } - /// A node is considedered a writeAccess iff it is a name of a declaration or a target of an assignment + /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ function isWriteAccess(node: Node): boolean { if (node.kind === SyntaxKind.Identifier && isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { return true; @@ -3042,6 +4290,339 @@ module ts { return false; } + /// NavigateTo + function getNavigateToItems(searchValue: string): NavigateToItem[] { + synchronizeHostData(); + + // Split search value in terms array + var terms = searchValue.split(" "); + + // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version + var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); + + var items: NavigateToItem[] = []; + + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] + forEach(program.getSourceFiles(), sourceFile => { + cancellationToken.throwIfCancellationRequested(); + + var filename = sourceFile.filename; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + var name = declaration.name.text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== MatchKind.none) { + var container = getContainerNode(declaration); + items.push({ + name: name, + kind: getNodeKind(declaration), + kindModifiers: getNodeModifiers(declaration), + matchKind: MatchKind[matchKind], + fileName: filename, + textSpan: TypeScript.TextSpan.fromBounds(declaration.getStart(), declaration.getEnd()), + containerName: container.name ? container.name.text : "", + containerKind: container.name ? getNodeKind(container) : "" + }); + } + } + }); + + return items; + + function hasAnyUpperCaseCharacter(s: string): boolean { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) || + (c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + + return false; + } + + function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind { + var matchKind = MatchKind.none; + + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + // in case of case-insensitive search searchTerm.term will already be lower-cased + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + // Didn't match. + return MatchKind.none; + } + + var termKind = MatchKind.substring; + if (index === 0) { + // here we know that match occur at the beginning of the string. + // if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match + termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix; + } + + // Update our match kind if we don't have one, or if this match is better. + if (matchKind === MatchKind.none || termKind < matchKind) { + matchKind = termKind; + } + } + } + + return matchKind; + } + } + + function containErrors(diagnostics: Diagnostic[]): boolean { + return forEach(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error); + } + + function getEmitOutput(filename: string): EmitOutput { + synchronizeHostData(); + filename = TypeScript.switchToForwardSlashes(filename); + var compilerOptions = program.getCompilerOptions(); + var targetSourceFile = program.getSourceFile(filename); // Current selected file to be output + // If --out flag is not specified, shouldEmitToOwnFile is true. Otherwise shouldEmitToOwnFile is false. + var shouldEmitToOwnFile = ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions); + var emitDeclaration = compilerOptions.declaration; + var emitOutput: EmitOutput = { + outputFiles: [], + emitOutputStatus: undefined, + }; + + function getEmitOutputWriter(filename: string, data: string, writeByteOrderMark: boolean) { + emitOutput.outputFiles.push({ + name: filename, + writeByteOrderMark: writeByteOrderMark, + text: data + }); + } + + // Initialize writer for CompilerHost.writeFile + writer = getEmitOutputWriter; + + var syntacticDiagnostics: Diagnostic[] = []; + var containSyntacticErrors = false; + + if (shouldEmitToOwnFile) { + // Check only the file we want to emit + containSyntacticErrors = containErrors(program.getDiagnostics(targetSourceFile)); + } else { + // Check the syntactic of only sourceFiles that will get emitted into single output + // Terminate the process immediately if we encounter a syntax error from one of the sourceFiles + containSyntacticErrors = forEach(program.getSourceFiles(), sourceFile => { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + // If emit to a single file then we will check all files that do not have external module + return containErrors(program.getDiagnostics(sourceFile)); + } + return false; + }); + } + + if (containSyntacticErrors) { + // If there is a syntax error, terminate the process and report outputStatus + emitOutput.emitOutputStatus = EmitReturnStatus.AllOutputGenerationSkipped; + // Reset writer back to undefined to make sure that we produce an error message + // if CompilerHost.writeFile is called when we are not in getEmitOutput + writer = undefined; + return emitOutput; + } + + // Perform semantic and force a type check before emit to ensure that all symbols are updated + // EmitFiles will report if there is an error from TypeChecker and Emitter + // Depend whether we will have to emit into a single file or not either emit only selected file in the project, emit all files into a single file + var emitFilesResult = getFullTypeCheckChecker().emitFiles(targetSourceFile); + emitOutput.emitOutputStatus = emitFilesResult.emitResultStatus; + + // Reset writer back to undefined to make sure that we produce an error message if CompilerHost.writeFile method is called when we are not in getEmitOutput + writer = undefined; + return emitOutput; + } + + function getMeaningFromDeclaration(node: Declaration): SemanticMeaning { + switch (node.kind) { + case SyntaxKind.Parameter: + case SyntaxKind.VariableDeclaration: + case SyntaxKind.Property: + case SyntaxKind.PropertyAssignment: + case SyntaxKind.EnumMember: + case SyntaxKind.Method: + case SyntaxKind.Constructor: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.ArrowFunction: + case SyntaxKind.CatchBlock: + return SemanticMeaning.Value; + + case SyntaxKind.TypeParameter: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeLiteral: + return SemanticMeaning.Type; + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.EnumDeclaration: + return SemanticMeaning.Value | SemanticMeaning.Type; + + case SyntaxKind.ModuleDeclaration: + if ((node).name.kind === SyntaxKind.StringLiteral) { + return SemanticMeaning.Namespace | SemanticMeaning.Value; + } + else if (isInstantiated(node)) { + return SemanticMeaning.Namespace | SemanticMeaning.Value; + } + else { + return SemanticMeaning.Namespace; + } + break; + + case SyntaxKind.ImportDeclaration: + return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; + } + Debug.fail("Unknown declaration type"); + } + + function isTypeReference(node: Node): boolean { + if (node.parent.kind === SyntaxKind.QualifiedName && (node.parent).right === node) + node = node.parent; + + return node.parent.kind === SyntaxKind.TypeReference; + } + + function isNamespaceReference(node: Node): boolean { + var root = node; + var isLastClause = true; + if (root.parent.kind === SyntaxKind.QualifiedName) { + while (root.parent && root.parent.kind === SyntaxKind.QualifiedName) + root = root.parent; + + isLastClause = (root).right === node; + } + + return root.parent.kind === SyntaxKind.TypeReference && !isLastClause; + } + + function isInRightSideOfImport(node: EntityName) { + while (node.parent.kind === SyntaxKind.QualifiedName) { + node = node.parent; + } + + return node.parent.kind === SyntaxKind.ImportDeclaration && (node.parent).entityName === node; + } + + function getMeaningFromRightHandSideOfImport(node: Node) { + Debug.assert(node.kind === SyntaxKind.Identifier); + + // import a = |b|; // Namespace + // import a = |b.c|; // Value, type, namespace + // import a = |b.c|.d; // Namespace + + if (node.parent.kind === SyntaxKind.QualifiedName && + (node.parent).right === node && + node.parent.parent.kind === SyntaxKind.ImportDeclaration) { + return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; + } + return SemanticMeaning.Namespace; + } + + function getMeaningFromLocation(node: Node): SemanticMeaning { + if (node.parent.kind === SyntaxKind.ExportAssignment) { + return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; + } + else if (isInRightSideOfImport(node)) { + return getMeaningFromRightHandSideOfImport(node); + } + else if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return getMeaningFromDeclaration(node.parent); + } + else if (isTypeReference(node)) { + return SemanticMeaning.Type; + } + else if (isNamespaceReference(node)) { + return SemanticMeaning.Namespace; + } + else { + return SemanticMeaning.Value; + } + } + + // Signature help + /** + * This is a semantic operation. + */ + function getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems { + synchronizeHostData(); + + fileName = TypeScript.switchToForwardSlashes(fileName); + var sourceFile = getSourceFile(fileName); + + return SignatureHelp.getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken); + } + + function getSignatureAtPosition(filename: string, position: number): SignatureInfo { + var signatureHelpItems = getSignatureHelpItems(filename, position); + + if (!signatureHelpItems) { + return undefined; + } + + var currentArgumentState = { argumentIndex: signatureHelpItems.argumentIndex, argumentCount: signatureHelpItems.argumentCount }; + + var formalSignatures: FormalSignatureItemInfo[] = []; + forEach(signatureHelpItems.items, signature => { + var signatureInfoString = displayPartsToString(signature.prefixDisplayParts); + + var parameters: FormalParameterInfo[] = []; + if (signature.parameters) { + for (var i = 0, n = signature.parameters.length; i < n; i++) { + var parameter = signature.parameters[i]; + + // add the parameter to the string + if (i) { + signatureInfoString += displayPartsToString(signature.separatorDisplayParts); + } + + var start = signatureInfoString.length; + signatureInfoString += displayPartsToString(parameter.displayParts); + var end = signatureInfoString.length - 1; + + // add the parameter to the list + parameters.push({ + name: parameter.name, + isVariable: i === n - 1 && signature.isVariadic, + docComment: displayPartsToString(parameter.documentation), + minChar: start, + limChar: end + }); + } + } + + signatureInfoString += displayPartsToString(signature.suffixDisplayParts); + + formalSignatures.push({ + signatureInfo: signatureInfoString, + docComment: displayPartsToString(signature.documentation), + parameters: parameters, + typeParameters: [], + }); + }); + + var actualSignature: ActualSignatureInfo = { + parameterMinChar: signatureHelpItems.applicableSpan.start(), + parameterLimChar: signatureHelpItems.applicableSpan.end(), + currentParameterIsTypeParameter: false, + currentParameter: currentArgumentState.argumentIndex + }; + + return { + actual: actualSignature, + formal: formalSignatures, + activeFormal: 0 + }; + } + /// Syntactic features function getSyntaxTree(filename: string): TypeScript.SyntaxTree { filename = TypeScript.switchToForwardSlashes(filename); @@ -3118,10 +4699,224 @@ module ts { return TypeScript.Services.Breakpoints.getBreakpointLocation(syntaxtree, position); } - function getNavigationBarItems(filename: string) { + function getNavigationBarItems(filename: string): NavigationBarItem[] { filename = TypeScript.switchToForwardSlashes(filename); - var syntaxTree = getSyntaxTree(filename); - return new TypeScript.Services.NavigationBarItemGetter().getItems(syntaxTree.sourceUnit()); + + return NavigationBar.getNavigationBarItems(getCurrentSourceFile(filename)); + } + + function getSemanticClassifications(fileName: string, span: TypeScript.TextSpan): ClassifiedSpan[] { + synchronizeHostData(); + fileName = TypeScript.switchToForwardSlashes(fileName); + + var sourceFile = getSourceFile(fileName); + + var result: ClassifiedSpan[] = []; + processNode(sourceFile); + + return result; + + function classifySymbol(symbol: Symbol, meaningAtPosition: SemanticMeaning) { + var flags = symbol.getFlags(); + + if (flags & SymbolFlags.Class) { + return ClassificationTypeNames.className; + } + else if (flags & SymbolFlags.Enum) { + return ClassificationTypeNames.enumName; + } + else if (meaningAtPosition & SemanticMeaning.Type) { + if (flags & SymbolFlags.Interface) { + return ClassificationTypeNames.interfaceName; + } + else if (flags & SymbolFlags.TypeParameter) { + return ClassificationTypeNames.typeParameterName; + } + } + else if (flags & SymbolFlags.Module) { + // Only classify a module as such if + // - It appears in a namespace context. + // - There exists a module declaration which actually impacts the value side. + if (meaningAtPosition & SemanticMeaning.Namespace || + (meaningAtPosition & SemanticMeaning.Value && hasValueSideModule(symbol))) { + return ClassificationTypeNames.moduleName; + } + } + + return undefined; + + /** + * Returns true if there exists a module that introduces entities on the value side. + */ + function hasValueSideModule(symbol: Symbol): boolean { + return forEach(symbol.declarations, declaration => { + return declaration.kind === SyntaxKind.ModuleDeclaration && isInstantiated(declaration); + }); + } + } + + function processNode(node: Node) { + // Only walk into nodes that intersect the requested span. + if (node && span.intersectsWith(node.getStart(), node.getWidth())) { + if (node.kind === SyntaxKind.Identifier && node.getWidth() > 0) { + var symbol = typeInfoResolver.getSymbolInfo(node); + if (symbol) { + var type = classifySymbol(symbol, getMeaningFromLocation(node)); + if (type) { + result.push({ + textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()), + classificationType: type + }); + } + } + } + + forEachChild(node, processNode); + } + } + } + + function getSyntacticClassifications(fileName: string, span: TypeScript.TextSpan): ClassifiedSpan[] { + // doesn't use compiler - no need to synchronize with host + fileName = TypeScript.switchToForwardSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + + var result: ClassifiedSpan[] = []; + processElement(sourceFile.getSourceUnit()); + + return result; + + function classifyTrivia(trivia: TypeScript.ISyntaxTrivia) { + if (trivia.isComment() && span.intersectsWith(trivia.fullStart(), trivia.fullWidth())) { + result.push({ + textSpan: new TypeScript.TextSpan(trivia.fullStart(), trivia.fullWidth()), + classificationType: ClassificationTypeNames.comment + }); + } + } + + function classifyTriviaList(trivia: TypeScript.ISyntaxTriviaList) { + for (var i = 0, n = trivia.count(); i < n; i++) { + classifyTrivia(trivia.syntaxTriviaAt(i)); + } + } + + function classifyToken(token: TypeScript.ISyntaxToken) { + if (token.hasLeadingComment()) { + classifyTriviaList(token.leadingTrivia()); + } + + if (TypeScript.width(token) > 0) { + var type = classifyTokenType(token); + if (type) { + result.push({ + textSpan: new TypeScript.TextSpan(TypeScript.start(token), TypeScript.width(token)), + classificationType: type + }); + } + } + + if (token.hasTrailingComment()) { + classifyTriviaList(token.trailingTrivia()); + } + } + + function classifyTokenType(token: TypeScript.ISyntaxToken): string { + var tokenKind = token.kind(); + if (TypeScript.SyntaxFacts.isAnyKeyword(token.kind())) { + return ClassificationTypeNames.keyword; + } + + // Special case < and > If they appear in a generic context they are punctation, + // not operators. + if (tokenKind === TypeScript.SyntaxKind.LessThanToken || tokenKind === TypeScript.SyntaxKind.GreaterThanToken) { + var tokenParentKind = token.parent.kind(); + if (tokenParentKind === TypeScript.SyntaxKind.TypeArgumentList || + tokenParentKind === TypeScript.SyntaxKind.TypeParameterList) { + + return ClassificationTypeNames.punctuation; + } + } + + if (TypeScript.SyntaxFacts.isBinaryExpressionOperatorToken(tokenKind) || + TypeScript.SyntaxFacts.isPrefixUnaryExpressionOperatorToken(tokenKind)) { + return ClassificationTypeNames.operator; + } + else if (TypeScript.SyntaxFacts.isAnyPunctuation(tokenKind)) { + return ClassificationTypeNames.punctuation; + } + else if (tokenKind === TypeScript.SyntaxKind.NumericLiteral) { + return ClassificationTypeNames.numericLiteral; + } + else if (tokenKind === TypeScript.SyntaxKind.StringLiteral) { + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === TypeScript.SyntaxKind.RegularExpressionLiteral) { + // TODO: we shoudl get another classification type for these literals. + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === TypeScript.SyntaxKind.IdentifierName) { + var current: TypeScript.ISyntaxNodeOrToken = token; + var parent = token.parent; + while (parent.kind() === TypeScript.SyntaxKind.QualifiedName) { + current = parent; + parent = parent.parent; + } + + switch (parent.kind()) { + case TypeScript.SyntaxKind.SimplePropertyAssignment: + if ((parent).propertyName === token) { + return ClassificationTypeNames.identifier; + } + return; + case TypeScript.SyntaxKind.ClassDeclaration: + if ((parent).identifier === token) { + return ClassificationTypeNames.className; + } + return; + case TypeScript.SyntaxKind.TypeParameter: + if ((parent).identifier === token) { + return ClassificationTypeNames.typeParameterName; + } + return; + case TypeScript.SyntaxKind.InterfaceDeclaration: + if ((parent).identifier === token) { + return ClassificationTypeNames.interfaceName; + } + return; + case TypeScript.SyntaxKind.EnumDeclaration: + if ((parent).identifier === token) { + return ClassificationTypeNames.enumName; + } + return; + case TypeScript.SyntaxKind.ModuleDeclaration: + if ((parent).name === current) { + return ClassificationTypeNames.moduleName; + } + return; + default: + return ClassificationTypeNames.text; + } + } + } + + function processElement(element: TypeScript.ISyntaxElement) { + // Ignore nodes that don't intersect the original span to classify. + if (!TypeScript.isShared(element) && span.intersectsWith(TypeScript.fullStart(element), TypeScript.fullWidth(element))) { + for (var i = 0, n = TypeScript.childCount(element); i < n; i++) { + var child = TypeScript.childAt(element, i); + if (child) { + if (TypeScript.isToken(child)) { + classifyToken(child); + } + else { + // Recurse into our child nodes. + processElement(child); + } + } + } + } + } } function getOutliningSpans(filename: string): OutliningSpan[] { @@ -3132,22 +4927,65 @@ module ts { } function getBraceMatchingAtPosition(filename: string, position: number) { - filename = TypeScript.switchToForwardSlashes(filename); - var syntaxTree = getSyntaxTree(filename); - return TypeScript.Services.BraceMatcher.getMatchSpans(syntaxTree, position); + var sourceFile = getCurrentSourceFile(filename); + var result: TypeScript.TextSpan[] = []; + + var token = getTouchingToken(sourceFile, position); + + if (token.getStart(sourceFile) === position) { + var matchKind = getMatchingTokenKind(token); + + // Ensure that there is a corresponding token to match ours. + if (matchKind) { + var parentElement = token.parent; + + var childNodes = parentElement.getChildren(sourceFile); + for (var i = 0, n = childNodes.length; i < n; i++) { + var current = childNodes[i]; + + if (current.kind === matchKind) { + var range1 = new TypeScript.TextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); + var range2 = new TypeScript.TextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); + + // We want to order the braces when we return the result. + if (range1.start() < range2.start()) { + result.push(range1, range2); + } + else { + result.push(range2, range1); + } + + break; + } + } + } + } + + return result; + + function getMatchingTokenKind(token: Node): ts.SyntaxKind { + switch (token.kind) { + case ts.SyntaxKind.OpenBraceToken: return ts.SyntaxKind.CloseBraceToken + case ts.SyntaxKind.OpenParenToken: return ts.SyntaxKind.CloseParenToken; + case ts.SyntaxKind.OpenBracketToken: return ts.SyntaxKind.CloseBracketToken; + case ts.SyntaxKind.LessThanToken: return ts.SyntaxKind.GreaterThanToken; + case ts.SyntaxKind.CloseBraceToken: return ts.SyntaxKind.OpenBraceToken + case ts.SyntaxKind.CloseParenToken: return ts.SyntaxKind.OpenParenToken; + case ts.SyntaxKind.CloseBracketToken: return ts.SyntaxKind.OpenBracketToken; + case ts.SyntaxKind.GreaterThanToken: return ts.SyntaxKind.LessThanToken; + } + + return undefined; + } } function getIndentationAtPosition(filename: string, position: number, editorOptions: EditorOptions) { filename = TypeScript.switchToForwardSlashes(filename); - var syntaxTree = getSyntaxTree(filename); - - var scriptSnapshot = syntaxTreeCache.getCurrentScriptSnapshot(filename); - var scriptText = TypeScript.SimpleText.fromScriptSnapshot(scriptSnapshot); - var textSnapshot = new TypeScript.Services.Formatting.TextSnapshot(scriptText); + var sourceFile = getCurrentSourceFile(filename); var options = new TypeScript.FormattingOptions(!editorOptions.ConvertTabsToSpaces, editorOptions.TabSize, editorOptions.IndentSize, editorOptions.NewLineCharacter) - return TypeScript.Services.Formatting.SingleTokenIndenter.getIndentationAmount(position, syntaxTree.sourceUnit(), textSnapshot, options); + return formatting.SmartIndenter.getIndentation(position, sourceFile, options); } function getFormattingManager(filename: string, options: FormatCodeOptions) { @@ -3203,83 +5041,21 @@ module ts { return []; } - function escapeRegExp(str: string): string { - return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); - } + function getTodoComments(filename: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { + filename = TypeScript.switchToForwardSlashes(filename); - function getTodoCommentsRegExp(descriptors: TodoCommentDescriptor[]): RegExp { - // NOTE: ?: means 'non-capture group'. It allows us to have groups without having to - // filter them out later in the final result array. + var sourceFile = getCurrentSourceFile(filename); - // TODO comments can appear in one of the following forms: - // - // 1) // TODO or /////////// TODO - // - // 2) /* TODO or /********** TODO - // - // 3) /* - // * TODO - // */ - // - // The following three regexps are used to match the start of the text up to the TODO - // comment portion. - var singleLineCommentStart = /(?:\/\/+\s*)/.source; - var multiLineCommentStart = /(?:\/\*+\s*)/.source; - var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; - - // Match any of the above three TODO comment start regexps. - // Note that the outermost group *is* a capture group. We want to capture the preamble - // so that we can determine the starting position of the TODO comment match. - var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; - - // Takes the descriptors and forms a regexp that matches them as if they were literals. - // For example, if the descriptors are "TODO(jason)" and "HACK", then this will be: - // - // (?:(TODO\(jason\))|(HACK)) - // - // Note that the outermost group is *not* a capture group, but the innermost groups - // *are* capture groups. By capturing the inner literals we can determine after - // matching which descriptor we are dealing with. - var literals = "(?:" + descriptors.map(d => "(" + escapeRegExp(d.text) + ")").join("|") + ")"; - - // After matching a descriptor literal, the following regexp matches the rest of the - // text up to the end of the line (or */). - var endOfLineOrEndOfComment = /(?:$|\*\/)/.source - var messageRemainder = /(?:.*?)/.source - - // This is the portion of the match we'll return as part of the TODO comment result. We - // match the literal portion up to the end of the line or end of comment. - var messagePortion = "(" + literals + messageRemainder + ")"; - var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; - - // The final regexp will look like this: - // /((?:\/\/+\s*)|(?:\/\*+\s*)|(?:^(?:\s|\*)*))((?:(TODO\(jason\))|(HACK))(?:.*?))(?:$|\*\/)/gim - - // The flags of the regexp are important here. - // 'g' is so that we are doing a global search and can find matches several times - // in the input. - // - // 'i' is for case insensitivity (We do this to match C# TODO comment code). - // - // 'm' is so we can find matches in a multiline input. - return new RegExp(regExpString, "gim"); - } - - function getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { - fileName = TypeScript.switchToForwardSlashes(fileName); - - var sourceFile = getCurrentSourceFile(fileName); - var syntaxTree = sourceFile.getSyntaxTree(); cancellationToken.throwIfCancellationRequested(); - var text = syntaxTree.text; - var fileContents = text.substr(0, text.length()); + var fileContents = sourceFile.text; + cancellationToken.throwIfCancellationRequested(); var result: TodoComment[] = []; if (descriptors.length > 0) { - var regExp = getTodoCommentsRegExp(descriptors); + var regExp = getTodoCommentsRegExp(); var matchArray: RegExpExecArray; while (matchArray = regExp.exec(fileContents)) { @@ -3294,7 +5070,7 @@ module ts { // ["// hack 1", "// ", "hack 1", undefined, "hack"] // // Here are the relevant capture groups: - // 0) The full match for the entire regex. + // 0) The full match for the entire regexp. // 1) The preamble to the message portion. // 2) The message portion. // 3...N) The descriptor that was matched - by index. 'undefined' for each @@ -3308,20 +5084,19 @@ module ts { var preamble = matchArray[1]; var matchPosition = matchArray.index + preamble.length; - // Ok, we have found a match in the file. This is ony an acceptable match if + // OK, we have found a match in the file. This is only an acceptable match if // it is contained within a comment. - var token = TypeScript.findToken(syntaxTree.sourceUnit(), matchPosition); + var token = getTokenAtPosition(sourceFile, matchPosition); - if (matchPosition >= TypeScript.start(token) && matchPosition < TypeScript.end(token)) { + if (token.getStart() <= matchPosition && matchPosition < token.getEnd()) { // match was within the token itself. Not in the comment. Keep searching // descriptor. continue; } - // Looks to be within the trivia. See if we can find hte comment containing it. - var triviaList = matchPosition < TypeScript.start(token) ? token.leadingTrivia(syntaxTree.text) : token.trailingTrivia(syntaxTree.text); - var trivia = findContainingComment(triviaList, matchPosition); - if (trivia === null) { + // Looks to be within the trivia. See if we can find the comment containing it. + if (!getContainingComment(getTrailingCommentRanges(fileContents, token.getFullStart()), matchPosition) && + !getContainingComment(getLeadingCommentRanges(fileContents, token.getFullStart()), matchPosition)) { continue; } @@ -3340,29 +5115,147 @@ module ts { } var message = matchArray[2]; - result.push(new TodoComment(descriptor, message, matchPosition)); + result.push({ + descriptor: descriptor, + message: message, + position: matchPosition + }); } } return result; + + function escapeRegExp(str: string): string { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + + function getTodoCommentsRegExp(): RegExp { + // NOTE: ?: means 'non-capture group'. It allows us to have groups without having to + // filter them out later in the final result array. + + // TODO comments can appear in one of the following forms: + // + // 1) // TODO or /////////// TODO + // + // 2) /* TODO or /********** TODO + // + // 3) /* + // * TODO + // */ + // + // The following three regexps are used to match the start of the text up to the TODO + // comment portion. + var singleLineCommentStart = /(?:\/\/+\s*)/.source; + var multiLineCommentStart = /(?:\/\*+\s*)/.source; + var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + + // Match any of the above three TODO comment start regexps. + // Note that the outermost group *is* a capture group. We want to capture the preamble + // so that we can determine the starting position of the TODO comment match. + var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + + // Takes the descriptors and forms a regexp that matches them as if they were literals. + // For example, if the descriptors are "TODO(jason)" and "HACK", then this will be: + // + // (?:(TODO\(jason\))|(HACK)) + // + // Note that the outermost group is *not* a capture group, but the innermost groups + // *are* capture groups. By capturing the inner literals we can determine after + // matching which descriptor we are dealing with. + var literals = "(?:" + map(descriptors, d => "(" + escapeRegExp(d.text) + ")").join("|") + ")"; + + // After matching a descriptor literal, the following regexp matches the rest of the + // text up to the end of the line (or */). + var endOfLineOrEndOfComment = /(?:$|\*\/)/.source + var messageRemainder = /(?:.*?)/.source + + // This is the portion of the match we'll return as part of the TODO comment result. We + // match the literal portion up to the end of the line or end of comment. + var messagePortion = "(" + literals + messageRemainder + ")"; + var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + + // The final regexp will look like this: + // /((?:\/\/+\s*)|(?:\/\*+\s*)|(?:^(?:\s|\*)*))((?:(TODO\(jason\))|(HACK))(?:.*?))(?:$|\*\/)/gim + + // The flags of the regexp are important here. + // 'g' is so that we are doing a global search and can find matches several times + // in the input. + // + // 'i' is for case insensitivity (We do this to match C# TODO comment code). + // + // 'm' is so we can find matches in a multi-line input. + return new RegExp(regExpString, "gim"); + } + + function getContainingComment(comments: CommentRange[], position: number): CommentRange { + if (comments) { + for (var i = 0, n = comments.length; i < n; i++) { + var comment = comments[i]; + if (comment.pos <= position && position < comment.end) { + return comment; + } + } + } + + return undefined; + } + + function isLetterOrDigit(char: number): boolean { + return (char >= TypeScript.CharacterCodes.a && char <= TypeScript.CharacterCodes.z) || + (char >= TypeScript.CharacterCodes.A && char <= TypeScript.CharacterCodes.Z) || + (char >= TypeScript.CharacterCodes._0 && char <= TypeScript.CharacterCodes._9); + } } - function isLetterOrDigit(char: number): boolean { - return (char >= TypeScript.CharacterCodes.a && char <= TypeScript.CharacterCodes.z) || - (char >= TypeScript.CharacterCodes.A && char <= TypeScript.CharacterCodes.Z) || - (char >= TypeScript.CharacterCodes._0 && char <= TypeScript.CharacterCodes._9); - } - function findContainingComment(triviaList: TypeScript.ISyntaxTriviaList, position: number): TypeScript.ISyntaxTrivia { - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - var fullEnd = trivia.fullStart() + trivia.fullWidth(); - if (trivia.isComment() && trivia.fullStart() <= position && position < fullEnd) { - return trivia; + function getRenameInfo(fileName: string, position: number): RenameInfo { + synchronizeHostData(); + + fileName = TypeScript.switchToForwardSlashes(fileName); + var sourceFile = getSourceFile(fileName); + + var node = getTouchingWord(sourceFile, position); + + // Can only rename an identifier. + if (node && node.kind === SyntaxKind.Identifier) { + var symbol = typeInfoResolver.getSymbolInfo(node); + + // Only allow a symbol to be renamed if it actually has at least one declaration. + if (symbol && symbol.getDeclarations() && symbol.getDeclarations().length > 0) { + var kind = getSymbolKind(symbol, typeInfoResolver); + if (kind) { + return getRenameInfo(symbol.name, typeInfoResolver.getFullyQualifiedName(symbol), kind, + getSymbolModifiers(symbol), + new TypeScript.TextSpan(node.getStart(), node.getWidth())); + } } } - return null; + return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key)); + + function getRenameInfoError(localizedErrorMessage: string): RenameInfo { + return { + canRename: false, + localizedErrorMessage: getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key), + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + + function getRenameInfo(displayName: string, fullDisplayName: string, kind: string, kindModifiers: string, triggerSpan: TypeScript.TextSpan): RenameInfo { + return { + canRename: true, + localizedErrorMessage: undefined, + displayName: displayName, + fullDisplayName: fullDisplayName, + kind: kind, + kindModifiers: kindModifiers, + triggerSpan: triggerSpan + }; + } } return { @@ -3371,19 +5264,21 @@ module ts { getSyntacticDiagnostics: getSyntacticDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, + getSyntacticClassifications: getSyntacticClassifications, + getSemanticClassifications: getSemanticClassifications, getCompletionsAtPosition: getCompletionsAtPosition, getCompletionEntryDetails: getCompletionEntryDetails, - getTypeAtPosition: getTypeAtPosition, - getSignatureHelpItems: (filename, position): SignatureHelpItems => null, - getSignatureHelpCurrentArgumentState: (fileName, position, applicableSpanStart): SignatureHelpState => null, + getSignatureHelpItems: getSignatureHelpItems, + getQuickInfoAtPosition: getQuickInfoAtPosition, getDefinitionAtPosition: getDefinitionAtPosition, getReferencesAtPosition: getReferencesAtPosition, getOccurrencesAtPosition: getOccurrencesAtPosition, getImplementorsAtPosition: (filename, position) => [], getNameOrDottedNameSpan: getNameOrDottedNameSpan, getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, - getNavigateToItems: (searchValue) => [], - getRenameInfo: (fileName, position): RenameInfo => RenameInfo.CreateError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key)), + getNavigateToItems: getNavigateToItems, + getRenameInfo: getRenameInfo, + findRenameLocations: findRenameLocations, getNavigationBarItems: getNavigationBarItems, getOutliningSpans: getOutliningSpans, getTodoComments: getTodoComments, @@ -3392,40 +5287,72 @@ module ts { getFormattingEditsForRange: getFormattingEditsForRange, getFormattingEditsForDocument: getFormattingEditsForDocument, getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, - getEmitOutput: (filename): EmitOutput => null, + getEmitOutput: getEmitOutput, + getSignatureAtPosition: getSignatureAtPosition, }; } /// Classifier export function createClassifier(host: Logger): Classifier { - var scanner: Scanner; - var noRegexTable: boolean[]; + var scanner = createScanner(ScriptTarget.ES5, /*skipTrivia*/ false); /// We do not have a full parser support to know when we should parse a regex or not /// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where /// we have a series of divide operator. this list allows us to be more accurate by ruling out /// locations where a regexp cannot exist. - if (!noRegexTable) { - noRegexTable = []; - noRegexTable[SyntaxKind.Identifier] = true; - noRegexTable[SyntaxKind.StringLiteral] = true; - noRegexTable[SyntaxKind.NumericLiteral] = true; - noRegexTable[SyntaxKind.RegularExpressionLiteral] = true; - noRegexTable[SyntaxKind.ThisKeyword] = true; - noRegexTable[SyntaxKind.PlusPlusToken] = true; - noRegexTable[SyntaxKind.MinusMinusToken] = true; - noRegexTable[SyntaxKind.CloseParenToken] = true; - noRegexTable[SyntaxKind.CloseBracketToken] = true; - noRegexTable[SyntaxKind.CloseBraceToken] = true; - noRegexTable[SyntaxKind.TrueKeyword] = true; - noRegexTable[SyntaxKind.FalseKeyword] = true; + var noRegexTable: boolean[] = []; + noRegexTable[SyntaxKind.Identifier] = true; + noRegexTable[SyntaxKind.StringLiteral] = true; + noRegexTable[SyntaxKind.NumericLiteral] = true; + noRegexTable[SyntaxKind.RegularExpressionLiteral] = true; + noRegexTable[SyntaxKind.ThisKeyword] = true; + noRegexTable[SyntaxKind.PlusPlusToken] = true; + noRegexTable[SyntaxKind.MinusMinusToken] = true; + noRegexTable[SyntaxKind.CloseParenToken] = true; + noRegexTable[SyntaxKind.CloseBracketToken] = true; + noRegexTable[SyntaxKind.CloseBraceToken] = true; + noRegexTable[SyntaxKind.TrueKeyword] = true; + noRegexTable[SyntaxKind.FalseKeyword] = true; + + function isAccessibilityModifier(kind: SyntaxKind) { + switch (kind) { + case SyntaxKind.PublicKeyword: + case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: + return true; + } + + return false; + } + + /** Returns true if 'keyword2' can legally follow 'keyword1' in any language construct. */ + function canFollow(keyword1: SyntaxKind, keyword2: SyntaxKind) { + if (isAccessibilityModifier(keyword1)) { + if (keyword2 === SyntaxKind.GetKeyword || + keyword2 === SyntaxKind.SetKeyword || + keyword2 === SyntaxKind.ConstructorKeyword || + keyword2 === SyntaxKind.StaticKeyword) { + + // Allow things like "public get", "public constructor" and "public static". + // These are all legal. + return true; + } + + // Any other keyword following "public" is actually an identifier an not a real + // keyword. + return false; + } + + // Assume any other keyword combination is legal. This can be refined in the future + // if there are more cases we want the classifier to be better at. + return true; } function getClassificationsForLine(text: string, lexState: EndOfLineState): ClassificationResult { var offset = 0; var lastTokenOrCommentEnd = 0; - var lastToken = SyntaxKind.Unknown; - var inUnterminatedMultiLineComment = false; + var token = SyntaxKind.Unknown; + var lastNonTriviaToken = SyntaxKind.Unknown; // If we're in a string literal, then prepend: "\ // (and a newline). That way when we lex we'll think we're still in a string literal. @@ -3445,32 +5372,80 @@ module ts { text = "/*\n" + text; offset = 3; break; - case EndOfLineState.EndingWithDotToken: - lastToken = SyntaxKind.DotToken; - break; } + scanner.setText(text); + var result: ClassificationResult = { finalLexState: EndOfLineState.Start, entries: [] }; - scanner = createScanner(ScriptTarget.ES5, text, onError, processComment); + // We can run into an unfortunate interaction between the lexical and syntactic classifier + // when the user is typing something generic. Consider the case where the user types: + // + // Foo tokens. It's a weak heuristic, but should + // work well enough in practice. + var angleBracketStack = 0; - var token = SyntaxKind.Unknown; do { token = scanner.scan(); - if ((token === SyntaxKind.SlashToken || token === SyntaxKind.SlashEqualsToken) && !noRegexTable[lastToken]) { - if (scanner.reScanSlashToken() === SyntaxKind.RegularExpressionLiteral) { - token = SyntaxKind.RegularExpressionLiteral; + if (!isTrivia(token)) { + if ((token === SyntaxKind.SlashToken || token === SyntaxKind.SlashEqualsToken) && !noRegexTable[lastNonTriviaToken]) { + if (scanner.reScanSlashToken() === SyntaxKind.RegularExpressionLiteral) { + token = SyntaxKind.RegularExpressionLiteral; + } + } + else if (lastNonTriviaToken === SyntaxKind.DotToken && isKeyword(token)) { + token = SyntaxKind.Identifier; + } + else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { + // We have two keywords in a row. Only treat the second as a keyword if + // it's a sequence that could legally occur in the language. Otherwise + // treat it as an identifier. This way, if someone writes "private var" + // we recognize that 'var' is actually an identifier here. + token = SyntaxKind.Identifier; + } + else if (lastNonTriviaToken === SyntaxKind.Identifier && + token === SyntaxKind.LessThanToken) { + // Could be the start of something generic. Keep track of that by bumping + // up the current count of generic contexts we may be in. + angleBracketStack++; + } + else if (token === SyntaxKind.GreaterThanToken && angleBracketStack > 0) { + // If we think we're currently in something generic, then mark that that + // generic entity is complete. + angleBracketStack--; + } + else if (token === SyntaxKind.AnyKeyword || + token === SyntaxKind.StringKeyword || + token === SyntaxKind.NumberKeyword || + token === SyntaxKind.BooleanKeyword) { + if (angleBracketStack > 0) { + // If it looks like we're could be in something generic, don't classify this + // as a keyword. We may just get overwritten by the syntactic classifier, + // causing a noisy experience for the user. + token = SyntaxKind.Identifier; + } } - } - else if (lastToken === SyntaxKind.DotToken) { - token = SyntaxKind.Identifier; - } - lastToken = token; + lastNonTriviaToken = token; + } processToken(); } @@ -3478,35 +5453,17 @@ module ts { return result; - - function onError(message: DiagnosticMessage): void { - inUnterminatedMultiLineComment = message.key === Diagnostics.Asterisk_Slash_expected.key; - } - - function processComment(start: number, end: number) { - // add Leading white spaces - addLeadingWhiteSpace(start, end); - - // add the comment - addResult(end - start, TokenClass.Comment); - } - function processToken(): void { var start = scanner.getTokenPos(); var end = scanner.getTextPos(); - // add Leading white spaces - addLeadingWhiteSpace(start, end); - // add the token addResult(end - start, classFromKind(token)); if (end >= text.length) { // We're at the end. - if (inUnterminatedMultiLineComment) { - result.finalLexState = EndOfLineState.InMultiLineCommentTrivia; - } - else if (token === SyntaxKind.StringLiteral) { + if (token === SyntaxKind.StringLiteral) { + // Check to see if we finished up on a multiline string literal. var tokenText = scanner.getTokenText(); if (tokenText.length > 0 && tokenText.charCodeAt(tokenText.length - 1) === CharacterCodes.backslash) { var quoteChar = tokenText.charCodeAt(0); @@ -3515,21 +5472,18 @@ module ts { : EndOfLineState.InSingleQuoteStringLiteral; } } - else if (token === SyntaxKind.DotToken) { - result.finalLexState = EndOfLineState.EndingWithDotToken; + else if (token === SyntaxKind.MultiLineCommentTrivia) { + // Check to see if the multiline comment was unclosed. + var tokenText = scanner.getTokenText() + if (!(tokenText.length > 3 && // need to avoid catching '/*/' + tokenText.charCodeAt(tokenText.length - 2) === CharacterCodes.asterisk && + tokenText.charCodeAt(tokenText.length - 1) === CharacterCodes.slash)) { + result.finalLexState = EndOfLineState.InMultiLineCommentTrivia; + } } } } - function addLeadingWhiteSpace(start: number, end: number): void { - if (start > lastTokenOrCommentEnd) { - addResult(start - lastTokenOrCommentEnd, TokenClass.Whitespace); - } - - // Remeber the end of the last token - lastTokenOrCommentEnd = end; - } - function addResult(length: number, classification: TokenClass): void { if (length > 0) { // If this is the first classification we're adding to the list, then remove any @@ -3622,6 +5576,11 @@ module ts { return TokenClass.StringLiteral; case SyntaxKind.RegularExpressionLiteral: return TokenClass.RegExpLiteral; + case SyntaxKind.MultiLineCommentTrivia: + case SyntaxKind.SingleLineCommentTrivia: + return TokenClass.Comment; + case SyntaxKind.WhitespaceTrivia: + return TokenClass.Whitespace; case SyntaxKind.Identifier: default: return TokenClass.Identifier; diff --git a/src/services/shims.ts b/src/services/shims.ts index 0659f9f2512..fdea0202323 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -22,42 +22,40 @@ var debugObjectHost = (this); module ts { export interface ScriptSnapshotShim { - // Get's a portion of the script snapshot specified by [start, end). + /** Gets a portion of the script snapshot specified by [start, end). */ getText(start: number, end: number): string; - // Get's the length of this script snapshot. + /** Gets the length of this script snapshot. */ getLength(): number; - // This call returns the JSON encoded array of the type: - // number[] + /** This call returns the JSON-encoded array of the type: number[] */ getLineStartPositions(): string; - // Returns a JSON encoded value of the type: - // { span: { start: number; length: number }; newLength: number } - // - // Or null value if there was no change. + /** + * Returns a JSON-encoded value of the type: + * { span: { start: number; length: number }; newLength: number } + * + * Or undefined value if there was no change. + */ getChangeRange(oldSnapshot: ScriptSnapshotShim): string; } - // - // Public interface of the host of a language service shim instance. - // + /** Public interface of the host of a language service shim instance.*/ export interface LanguageServiceShimHost extends Logger { getCompilationSettings(): string; - // Returns a JSON encoded value of the type: - // string[] + /** Returns a JSON-encoded value of the type: string[] */ getScriptFileNames(): string; getScriptVersion(fileName: string): string; getScriptIsOpen(fileName: string): boolean; getScriptSnapshot(fileName: string): ScriptSnapshotShim; getLocalizedDiagnosticMessages(): string; getCancellationToken(): CancellationToken; + getCurrentDirectory(): string; + getDefaultLibFilename(): string; } - // - // Public interface of of a language service instance shim. - // + /** Public interface of a language service instance shim. */ export interface ShimFactory { registerShim(shim: Shim): void; unregisterShim(shim: Shim): void; @@ -80,48 +78,75 @@ module ts { getSemanticDiagnostics(fileName: string): string; getCompilerOptionsDiagnostics(): string; + getSyntacticClassifications(fileName: string, start: number, length: number): string; + getCompletionsAtPosition(fileName: string, position: number, isMemberCompletion: boolean): string; getCompletionEntryDetails(fileName: string, position: number, entryName: string): string; - getTypeAtPosition(fileName: string, position: number): string; + getQuickInfoAtPosition(fileName: string, position: number): string; + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string; getBreakpointStatementAtPosition(fileName: string, position: number): string; getSignatureHelpItems(fileName: string, position: number): string; - getSignatureHelpCurrentArgumentState(fileName: string, position: number, applicableSpanStart: number): string; - // Returns a JSON encoded value of the type: - // { canRename: boolean, localizedErrorMessage: string, displayName: string, fullDisplayName: string, kind: string, kindModifiers: string, triggerSpan: { start; length } } + // Obsolete. Use getSignatureHelpItems instead. + getSignatureAtPosition(fileName: string, position: number): string; + + /** + * Returns a JSON-encoded value of the type: + * { canRename: boolean, localizedErrorMessage: string, displayName: string, fullDisplayName: string, kind: string, kindModifiers: string, triggerSpan: { start; length } } + */ getRenameInfo(fileName: string, position: number): string; - // Returns a JSON encoded value of the type: - // { fileName: string; textSpan: { start: number; length: number}; kind: string; name: string; containerKind: string; containerName: string } - // - // Or null value if no definition can be found. + /** + * Returns a JSON-encoded value of the type: + * { fileName: string, textSpan: { start: number, length: number } }[] + */ + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): string; + + /** + * Returns a JSON-encoded value of the type: + * { fileName: string; textSpan: { start: number; length: number}; kind: string; name: string; containerKind: string; containerName: string } + * + * Or undefined value if no definition can be found. + */ getDefinitionAtPosition(fileName: string, position: number): string; - // Returns a JSON encoded value of the type: - // { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[] + /** + * Returns a JSON-encoded value of the type: + * { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[] + */ getReferencesAtPosition(fileName: string, position: number): string; - // Returns a JSON encoded value of the type: - // { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[] + /** + * Returns a JSON-encoded value of the type: + * { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[] + */ getOccurrencesAtPosition(fileName: string, position: number): string; - // Returns a JSON encoded value of the type: - // { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[] + /** + * Returns a JSON-encoded value of the type: + * { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[] + */ getImplementorsAtPosition(fileName: string, position: number): string; - - // Returns a JSON encoded value of the type: - // { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = []; + + /** + * Returns a JSON-encoded value of the type: + * { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = []; + */ getNavigateToItems(searchValue: string): string; - // Returns a JSON encoded value of the type: - // { text: string; kind: string; kindModifiers: string; bolded: boolean; grayed: boolean; indent: number; spans: { start: number; length: number; }[]; childItems: [] } [] = []; + /** + * Returns a JSON-encoded value of the type: + * { text: string; kind: string; kindModifiers: string; bolded: boolean; grayed: boolean; indent: number; spans: { start: number; length: number; }[]; childItems: [] } [] = []; + */ getNavigationBarItems(fileName: string): string; - // Returns a JSON encoded value of the type: - // { textSpan: { start: number, length: number }; hintSpan: { start: number, length: number }; bannerText: string; autoCollapse: boolean } [] = []; + /** + * Returns a JSON-encoded value of the type: + * { textSpan: { start: number, length: number }; hintSpan: { start: number, length: number }; bannerText: string; autoCollapse: boolean } [] = []; + */ getOutliningSpans(fileName: string): string; getTodoComments(fileName: string, todoCommentDescriptors: string): string; @@ -145,19 +170,19 @@ module ts { getDefaultCompilationSettings(): string; } - /// TODO: delete this, it is only needed untill the VS interface is updated - enum LanguageVersion { + /// TODO: delete this, it is only needed until the VS interface is updated + export enum LanguageVersion { EcmaScript3 = 0, EcmaScript5 = 1, } - enum ModuleGenTarget { + export enum ModuleGenTarget { Unspecified = 0, Synchronous = 1, Asynchronous = 2, } - interface CompilationSettings { + export interface CompilationSettings { propagateEnumConstants?: boolean; removeComments?: boolean; watch?: boolean; @@ -177,15 +202,18 @@ module ts { gatherDiagnostics?: boolean; codepage?: number; emitBOM?: boolean; + + // Declare indexer signature + [index: string]: any; } function languageVersionToScriptTarget(languageVersion: LanguageVersion): ScriptTarget { if (typeof languageVersion === "undefined") return undefined; switch (languageVersion) { - case LanguageVersion.EcmaScript3: return ScriptTarget.ES3; + case LanguageVersion.EcmaScript3: return ScriptTarget.ES3 case LanguageVersion.EcmaScript5: return ScriptTarget.ES5; - default: throw Error("unsuported LanguageVersion value: " + languageVersion); + default: throw Error("unsupported LanguageVersion value: " + languageVersion); } } @@ -196,7 +224,7 @@ module ts { case ModuleGenTarget.Asynchronous: return ModuleKind.AMD; case ModuleGenTarget.Synchronous: return ModuleKind.CommonJS; case ModuleGenTarget.Unspecified: return ModuleKind.None; - default: throw Error("unsuported ModuleGenTarget value: " + moduleGenTarget); + default: throw Error("unsupported ModuleGenTarget value: " + moduleGenTarget); } } @@ -206,7 +234,7 @@ module ts { switch (scriptTarget) { case ScriptTarget.ES3: return LanguageVersion.EcmaScript3; case ScriptTarget.ES5: return LanguageVersion.EcmaScript5; - default: throw Error("unsuported ScriptTarget value: " + scriptTarget); + default: throw Error("unsupported ScriptTarget value: " + scriptTarget); } } @@ -217,7 +245,7 @@ module ts { case ModuleKind.AMD: return ModuleGenTarget.Asynchronous; case ModuleKind.CommonJS: return ModuleGenTarget.Synchronous; case ModuleKind.None: return ModuleGenTarget.Unspecified; - default: throw Error("unsuported ModuleKind value: " + moduleKind); + default: throw Error("unsupported ModuleKind value: " + moduleKind); } } @@ -319,12 +347,6 @@ module ts { } var options = compilationSettingsToCompilerOptions(JSON.parse(settingsJson)); - /// TODO: this should be pushed into VS. - /// We can not ask the LS instance to resolve, as this will lead to asking the host about files it does not know about, - /// something it is not desinged to handle. for now make sure we never get a "noresolve == false". - /// This value should not matter, as the host runs resolution logic independentlly - options.noResolve = true; - return options; } @@ -350,6 +372,7 @@ module ts { if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { return null; } + try { return JSON.parse(diagnosticMessagesJson); } @@ -362,6 +385,14 @@ module ts { public getCancellationToken(): CancellationToken { return this.shimHost.getCancellationToken(); } + + public getDefaultLibFilename(): string { + return this.shimHost.getDefaultLibFilename(); + } + + public getCurrentDirectory(): string { + return this.shimHost.getCurrentDirectory(); + } } function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any): any { @@ -418,9 +449,12 @@ module ts { return forwardJSONCall(this.logger, actionDescription, action); } - // DISPOSE - // Ensure (almost) determinstic release of internal Javascript resources when - // some external native objects holds onto us (e.g. Com/Interop). + /// DISPOSE + + /** + * Ensure (almost) deterministic release of internal Javascript resources when + * some external native objects holds onto us (e.g. Com/Interop). + */ public dispose(dummy: any): void { this.logger.log("dispose()"); this.languageService.dispose(); @@ -437,8 +471,11 @@ module ts { super.dispose(dummy); } - // REFRESH - // Update the list of scripts known to the compiler + /// REFRESH + + /** + * Update the list of scripts known to the compiler + */ public refresh(throwOnError: boolean): void { this.forwardJSONCall( "refresh(" + throwOnError + ")", @@ -462,7 +499,8 @@ module ts { start: diagnostic.start, length: diagnostic.length, /// TODO: no need for the tolowerCase call - category: DiagnosticCategory[diagnostic.category].toLowerCase() + category: DiagnosticCategory[diagnostic.category].toLowerCase(), + code: diagnostic.code }; } @@ -477,6 +515,24 @@ module ts { }; } + public getSyntacticClassifications(fileName: string, start: number, length: number): string { + return this.forwardJSONCall( + "getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", + () => { + var classifications = this.languageService.getSyntacticClassifications(fileName, new TypeScript.TextSpan(start, length)); + return classifications; + }); + } + + public getSemanticClassifications(fileName: string, start: number, length: number): string { + return this.forwardJSONCall( + "getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", + () => { + var classifications = this.languageService.getSemanticClassifications(fileName, new TypeScript.TextSpan(start, length)); + return classifications; + }); + } + public getSyntacticDiagnostics(fileName: string): string { return this.forwardJSONCall( "getSyntacticDiagnostics('" + fileName + "')", @@ -505,20 +561,27 @@ module ts { } /// QUICKINFO - /// Computes a string representation of the type at the requested position - /// in the active file. - public getTypeAtPosition(fileName: string, position: number): string { + + /** + * Computes a string representation of the type at the requested position + * in the active file. + */ + public getQuickInfoAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( - "getTypeAtPosition('" + fileName + "', " + position + ")", + "getQuickInfoAtPosition('" + fileName + "', " + position + ")", () => { - var typeInfo = this.languageService.getTypeAtPosition(fileName, position); - return typeInfo; + var quickInfo = this.languageService.getQuickInfoAtPosition(fileName, position); + return quickInfo; }); } + /// NAMEORDOTTEDNAMESPAN - /// Computes span information of the name or dotted name at the requested position - // in the active file. + + /** + * Computes span information of the name or dotted name at the requested position + * in the active file. + */ public getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string { return this.forwardJSONCall( "getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", @@ -528,8 +591,10 @@ module ts { }); } - /// STATEMENTSPAN - /// Computes span information of statement at the requested position in the active file. + /** + * STATEMENTSPAN + * Computes span information of statement at the requested position in the active file. + */ public getBreakpointStatementAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( "getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", @@ -550,19 +615,20 @@ module ts { }); } - public getSignatureHelpCurrentArgumentState(fileName: string, position: number, applicableSpanStart: number): string { + public getSignatureAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( - "getSignatureHelpCurrentArgumentState('" + fileName + "', " + position + ", " + applicableSpanStart + ")", + "getSignatureAtPosition('" + fileName + "', " + position + ")", () => { - var signatureInfo = this.languageService.getSignatureHelpItems(fileName, position); - return signatureInfo; + return this.languageService.getSignatureAtPosition(fileName, position); }); } - /// GOTO DEFINITION - /// Computes the definition location and file for the symbol - /// at the requested position. + + /** + * Computes the definition location and file for the symbol + * at the requested position. + */ public getDefinitionAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( "getDefinitionAtPosition('" + fileName + "', " + position + ")", @@ -579,6 +645,14 @@ module ts { }); } + public findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): string { + return this.forwardJSONCall( + "findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", + () => { + return this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); + }); + } + /// GET BRACE MATCHING public getBraceMatchingAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( @@ -600,9 +674,12 @@ module ts { } /// GET REFERENCES - /// Return references to a symbol at the requested position. - /// References are separated by "\n". - /// Each reference is a "fileindex min lim" sub-string. + + /** + * Return references to a symbol at the requested position. + * References are separated by "\n". + * Each reference is a "fileindex min lim" sub-string. + */ public getReferencesAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( "getReferencesAtPosition('" + fileName + "', " + position + ")", @@ -630,9 +707,12 @@ module ts { /// COMPLETION LISTS - /// Get a string based representation of the completions - /// to provide at the given source position and providing a member completion - /// list if requested. + + /** + * Get a string based representation of the completions + * to provide at the given source position and providing a member completion + * list if requested. + */ public getCompletionsAtPosition(fileName: string, position: number, isMemberCompletion: boolean) { return this.forwardJSONCall( "getCompletionsAtPosition('" + fileName + "', " + position + ", " + isMemberCompletion + ")", @@ -642,7 +722,7 @@ module ts { }); } - /// Get a string based representation of a completion list entry details + /** Get a string based representation of a completion list entry details */ public getCompletionEntryDetails(fileName: string, position: number, entryName: string) { return this.forwardJSONCall( "getCompletionEntryDetails('" + fileName + "', " + position + ", " + entryName + ")", @@ -683,7 +763,8 @@ module ts { } /// NAVIGATE TO - /// Return a list of symbols that are interesting to navigate to + + /** Return a list of symbols that are interesting to navigate to */ public getNavigateToItems(searchValue: string): string { return this.forwardJSONCall( "getNavigateToItems('" + searchValue + "')", @@ -762,9 +843,6 @@ module ts { return forwardJSONCall(this.logger, actionDescription, action); } - /// - /// getPreProcessedFileInfo - /// public getPreProcessedFileInfo(fileName: string, sourceText: TypeScript.IScriptSnapshot): string { return this.forwardJSONCall( "getPreProcessedFileInfo('" + fileName + "')", @@ -774,9 +852,6 @@ module ts { }); } - /// - /// getDefaultCompilationSettings - /// public getDefaultCompilationSettings(): string { return this.forwardJSONCall( "getDefaultCompilationSettings()", @@ -846,7 +921,7 @@ module ts { } -/// TODO: this is used by VS, clean this up on both sides of the interfrace +/// TODO: this is used by VS, clean this up on both sides of the interface module TypeScript.Services { export var TypeScriptServicesFactory = ts.TypeScriptServicesFactory; } diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts new file mode 100644 index 00000000000..273cfda99b8 --- /dev/null +++ b/src/services/signatureHelp.ts @@ -0,0 +1,411 @@ +/// + +module ts.SignatureHelp { + + // A partially written generic type expression is not guaranteed to have the correct syntax tree. the expression could be parsed as less than/greater than expression or a comma expression + // or some other combination depending on what the user has typed so far. For the purposes of signature help we need to consider any location after "<" as a possible generic type reference. + // To do this, the method will back parse the expression starting at the position required. it will try to parse the current expression as a generic type expression, if it did succeed it + // will return the generic identifier that started the expression (e.g. "foo" in "fooargumentInfo.list.parent; + var candidates = []; + var resolvedSignature = typeInfoResolver.getResolvedSignature(call, candidates); + cancellationToken.throwIfCancellationRequested(); + + if (!candidates.length) { + return undefined; + } + + return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); + + /** + * If node is an argument, returns its index in the argument list. + * If not, returns -1. + */ + function getImmediatelyContainingArgumentInfo(node: Node): ListItemInfo { + if (node.parent.kind !== SyntaxKind.CallExpression && node.parent.kind !== SyntaxKind.NewExpression) { + return undefined; + } + + // There are 3 cases to handle: + // 1. The token introduces a list, and should begin a sig help session + // 2. The token is either not associated with a list, or ends a list, so the session should end + // 3. The token is buried inside a list, and should give sig help + // + // The following are examples of each: + // + // Case 1: + // foo<$T, U>($a, b) -> The token introduces a list, and should begin a sig help session + // Case 2: + // fo$o$(a, b)$ -> The token is either not associated with a list, or ends a list, so the session should end + // Case 3: + // foo(a$, $b$) -> The token is buried inside a list, and should give sig help + var parent = node.parent; + // Find out if 'node' is an argument, a type argument, or neither + if (node.kind === SyntaxKind.LessThanToken || node.kind === SyntaxKind.OpenParenToken) { + // Find the list that starts right *after* the < or ( token. + // If the user has just opened a list, consider this item 0. + var list = getChildListThatStartsWithOpenerToken(parent, node, sourceFile); + Debug.assert(list); + return { + list: list, + listItemIndex: 0 + }; + } + + if (node.kind === SyntaxKind.GreaterThanToken + || node.kind === SyntaxKind.CloseParenToken + || node === parent.func) { + return undefined; + } + + return findListItemInfo(node); + } + + function getContainingArgumentInfo(node: Node): ListItemInfo { + for (var n = node; n.kind !== SyntaxKind.SourceFile; n = n.parent) { + if (n.kind === SyntaxKind.FunctionBlock) { + return undefined; + } + + // If the node is not a subspan of its parent, this is a big problem. + // There have been crashes that might be caused by this violation. + if (n.pos < n.parent.pos || n.end > n.parent.end) { + Debug.fail("Node of kind " + SyntaxKind[n.kind] + " is not a subspan of its parent of kind " + SyntaxKind[n.parent.kind]); + } + + var argumentInfo = getImmediatelyContainingArgumentInfo(n); + if (argumentInfo) { + return argumentInfo; + } + + + // TODO: Handle generic call with incomplete syntax + } + return undefined; + } + + /** + * The selectedItemIndex could be negative for several reasons. + * 1. There are too many arguments for all of the overloads + * 2. None of the overloads were type compatible + * The solution here is to try to pick the best overload by picking + * either the first one that has an appropriate number of parameters, + * or the one with the most parameters. + */ + function selectBestInvalidOverloadIndex(candidates: Signature[], argumentCount: number): number { + var maxParamsSignatureIndex = -1; + var maxParams = -1; + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + + if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) { + return i; + } + + if (candidate.parameters.length > maxParams) { + maxParams = candidate.parameters.length; + maxParamsSignatureIndex = i; + } + } + + return maxParamsSignatureIndex; + } + + function createSignatureHelpItems(candidates: Signature[], bestSignature: Signature, argumentInfoOrTypeArgumentInfo: ListItemInfo): SignatureHelpItems { + var argumentListOrTypeArgumentList = argumentInfoOrTypeArgumentInfo.list; + var items: SignatureHelpItem[] = map(candidates, candidateSignature => { + var parameters = candidateSignature.parameters; + var parameterHelpItems: SignatureHelpParameter[] = parameters.length === 0 ? emptyArray : map(parameters, p => { + var displayParts: SymbolDisplayPart[] = []; + + if (candidateSignature.hasRestParameter && parameters[parameters.length - 1] === p) { + displayParts.push(punctuationPart(SyntaxKind.DotDotDotToken)); + } + + displayParts.push(symbolPart(p.name, p)); + + var isOptional = !!(p.valueDeclaration.flags & NodeFlags.QuestionMark); + if (isOptional) { + displayParts.push(punctuationPart(SyntaxKind.QuestionToken)); + } + + displayParts.push(punctuationPart(SyntaxKind.ColonToken)); + displayParts.push(spacePart()); + + var typeParts = typeToDisplayParts(typeInfoResolver, typeInfoResolver.getTypeOfSymbol(p), argumentListOrTypeArgumentList); + displayParts.push.apply(displayParts, typeParts); + + return { + name: p.name, + documentation: p.getDocumentationComment(), + displayParts: displayParts, + isOptional: isOptional + }; + }); + + var callTargetNode = (argumentListOrTypeArgumentList.parent).func; + var callTargetSymbol = typeInfoResolver.getSymbolInfo(callTargetNode); + + var prefixParts = callTargetSymbol ? symbolToDisplayParts(typeInfoResolver, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined) : []; + + var separatorParts = [punctuationPart(SyntaxKind.CommaToken), spacePart()]; + + // TODO(jfreeman): Constraints? + if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) { + prefixParts.push(punctuationPart(SyntaxKind.LessThanToken)); + + for (var i = 0, n = candidateSignature.typeParameters.length; i < n; i++) { + if (i) { + prefixParts.push.apply(prefixParts, separatorParts); + } + + var tp = candidateSignature.typeParameters[i].symbol; + prefixParts.push(symbolPart(tp.name, tp)); + } + + prefixParts.push(punctuationPart(SyntaxKind.GreaterThanToken)); + } + + prefixParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + + var suffixParts = [punctuationPart(SyntaxKind.CloseParenToken)]; + suffixParts.push(punctuationPart(SyntaxKind.ColonToken)); + suffixParts.push(spacePart()); + + var typeParts = typeToDisplayParts(typeInfoResolver, candidateSignature.getReturnType(), argumentListOrTypeArgumentList); + suffixParts.push.apply(suffixParts, typeParts); + + return { + isVariadic: candidateSignature.hasRestParameter, + prefixDisplayParts: prefixParts, + suffixDisplayParts: suffixParts, + separatorDisplayParts: separatorParts, + parameters: parameterHelpItems, + documentation: candidateSignature.getDocumentationComment() + }; + }); + + // We use full start and skip trivia on the end because we want to include trivia on + // both sides. For example, + // + // foo( /*comment */ a, b, c /*comment*/ ) + // | | + // + // The applicable span is from the first bar to the second bar (inclusive, + // but not including parentheses) + var applicableSpanStart = argumentListOrTypeArgumentList.getFullStart(); + var applicableSpanEnd = skipTrivia(sourceFile.text, argumentListOrTypeArgumentList.end, /*stopAfterLineBreak*/ false); + var applicableSpan = new TypeScript.TextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + + // The listItemIndex we got back includes commas. Our goal is to return the index of the proper + // item (not including commas). Here are some examples: + // 1. foo(a, b, c $) -> the listItemIndex is 4, we want to return 2 + // 2. foo(a, b, $ c) -> listItemIndex is 3, we want to return 2 + // 3. foo($a) -> listItemIndex is 0, we want to return 0 + // + // In general, we want to subtract the number of commas before the current index. + // But if we are on a comma, we also want to pretend we are on the argument *following* + // the comma. That amounts to taking the ceiling of half the index. + var argumentIndex = (argumentInfoOrTypeArgumentInfo.listItemIndex + 1) >> 1; + + // argumentCount is the number of commas plus one, unless the list is completely empty, + // in which case there are 0. + var argumentCount = argumentListOrTypeArgumentList.getChildCount() === 0 + ? 0 + : 1 + countWhere(argumentListOrTypeArgumentList.getChildren(), arg => arg.kind === SyntaxKind.CommaToken); + + var selectedItemIndex = candidates.indexOf(bestSignature); + if (selectedItemIndex < 0) { + selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); + } + + return { + items: items, + applicableSpan: applicableSpan, + selectedItemIndex: selectedItemIndex, + argumentIndex: argumentIndex, + argumentCount: argumentCount + }; + } + } + + function getChildListThatStartsWithOpenerToken(parent: Node, openerToken: Node, sourceFile: SourceFile): Node { + var children = parent.getChildren(sourceFile); + var indexOfOpenerToken = children.indexOf(openerToken); + return children[indexOfOpenerToken + 1]; + } +} \ No newline at end of file diff --git a/src/services/signatureInfoHelpers.ts b/src/services/signatureInfoHelpers.ts deleted file mode 100644 index 145dcc02381..00000000000 --- a/src/services/signatureInfoHelpers.ts +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. -// See LICENSE.txt in the project root for complete license information. - -/// - -module TypeScript.Services { - - export interface IPartiallyWrittenTypeArgumentListInformation { - genericIdentifer: TypeScript.ISyntaxToken; - lessThanToken: TypeScript.ISyntaxToken; - argumentIndex: number; - } - - export interface IExpressionWithArgumentListSyntax extends IExpressionSyntax { - expression: IExpressionSyntax; - argumentList: ArgumentListSyntax; - } - - export class SignatureInfoHelpers { - - // A partially written generic type expression is not guaranteed to have the correct syntax tree. the expression could be parsed as less than/greater than expression or a comma expression - // or some other combination depending on what the user has typed so far. For the purposes of signature help we need to consider any location after "<" as a possible generic type reference. - // To do this, the method will back parse the expression starting at the position required. it will try to parse the current expression as a generic type expression, if it did succeed it - // will return the generic identifier that started the expression (e.g. "foo" in "foo 1; - - for (var i = 0, n = signatures.length; i < n; i++) { - var signature = signatures[i]; - - // filter out the definition signature if there are overloads - if (hasOverloads && signature.isDefinition()) { - continue; - } - - var signatureGroupInfo = new FormalSignatureItemInfo(); - var paramIndexInfo: number[] = []; - var functionName = signature.getScopedNameEx(enclosingScopeSymbol).toString(); - if (!functionName && (!symbol.isType() || (symbol).isNamedTypeSymbol())) { - functionName = symbol.getScopedNameEx(enclosingScopeSymbol).toString(); - } - - var signatureMemberName = signature.getSignatureTypeNameEx(functionName, /*shortform*/ false, /*brackets*/ false, enclosingScopeSymbol, /*getParamMarkerInfo*/ true, /*getTypeParameterMarkerInfo*/ true); - signatureGroupInfo.signatureInfo = TypeScript.MemberName.memberNameToString(signatureMemberName, paramIndexInfo); - signatureGroupInfo.docComment = signature.docComments(); - - var parameterMarkerIndex = 0; - - if (signature.isGeneric()) { - var typeParameters = signature.getTypeParameters(); - for (var j = 0, m = typeParameters.length; j < m; j++) { - var typeParameter = typeParameters[j]; - var signatureTypeParameterInfo = new FormalTypeParameterInfo(); - signatureTypeParameterInfo.name = typeParameter.getDisplayName(); - signatureTypeParameterInfo.docComment = typeParameter.docComments(); - signatureTypeParameterInfo.minChar = paramIndexInfo[2 * parameterMarkerIndex]; - signatureTypeParameterInfo.limChar = paramIndexInfo[2 * parameterMarkerIndex + 1]; - parameterMarkerIndex++; - signatureGroupInfo.typeParameters.push(signatureTypeParameterInfo); - } - } - - var parameters = signature.parameters; - for (var j = 0, m = parameters.length; j < m; j++) { - var parameter = parameters[j]; - var signatureParameterInfo = new FormalParameterInfo(); - signatureParameterInfo.isVariable = signature.hasVarArgs && (j === parameters.length - 1); - signatureParameterInfo.name = parameter.getDisplayName(); - signatureParameterInfo.docComment = parameter.docComments(); - signatureParameterInfo.minChar = paramIndexInfo[2 * parameterMarkerIndex]; - signatureParameterInfo.limChar = paramIndexInfo[2 * parameterMarkerIndex + 1]; - parameterMarkerIndex++; - signatureGroupInfo.parameters.push(signatureParameterInfo); - } - - signatureGroup.push(signatureGroupInfo); - } - - return signatureGroup; - } - - public static getSignatureInfoFromGenericSymbol(symbol: TypeScript.PullSymbol, enclosingScopeSymbol: TypeScript.PullSymbol, compilerState: LanguageServiceCompiler) { - var signatureGroupInfo = new FormalSignatureItemInfo(); - - var paramIndexInfo: number[] = []; - var symbolName = symbol.getScopedNameEx(enclosingScopeSymbol, /*skipTypeParametersInName*/ false, /*useConstaintInName*/ true, /*getPrettyTypeName*/ false, /*getTypeParamMarkerInfo*/ true); - - signatureGroupInfo.signatureInfo = TypeScript.MemberName.memberNameToString(symbolName, paramIndexInfo); - signatureGroupInfo.docComment = symbol.docComments(); - - var parameterMarkerIndex = 0; - - var typeSymbol = symbol.type; - - var typeParameters = typeSymbol.getTypeParameters(); - for (var i = 0, n = typeParameters.length; i < n; i++) { - var typeParameter = typeParameters[i]; - var signatureTypeParameterInfo = new FormalTypeParameterInfo(); - signatureTypeParameterInfo.name = typeParameter.getDisplayName(); - signatureTypeParameterInfo.docComment = typeParameter.docComments(); - signatureTypeParameterInfo.minChar = paramIndexInfo[2 * i]; - signatureTypeParameterInfo.limChar = paramIndexInfo[2 * i + 1]; - signatureGroupInfo.typeParameters.push(signatureTypeParameterInfo); - } - - return [signatureGroupInfo]; - } - - public static getActualSignatureInfoFromCallExpression(ast: IExpressionWithArgumentListSyntax, caretPosition: number, typeParameterInformation: IPartiallyWrittenTypeArgumentListInformation): ActualSignatureInfo { - if (!ast) { - return null; - } - - var result = new ActualSignatureInfo(); - - // The expression is not guaranteed to be complete, we need to populate the min and lim with the most accurate information we have about - // type argument and argument lists - var parameterMinChar = caretPosition; - var parameterLimChar = caretPosition; - - if (ast.argumentList.typeArgumentList) { - parameterMinChar = Math.min(start(ast.argumentList.typeArgumentList)); - parameterLimChar = Math.max(Math.max(start(ast.argumentList.typeArgumentList), end(ast.argumentList.typeArgumentList) + trailingTriviaWidth(ast.argumentList.typeArgumentList))); - } - - if (ast.argumentList.arguments) { - parameterMinChar = Math.min(parameterMinChar, end(ast.argumentList.openParenToken)); - parameterLimChar = Math.max(parameterLimChar, - ast.argumentList.closeParenToken.fullWidth() > 0 ? start(ast.argumentList.closeParenToken) : fullEnd(ast.argumentList)); - } - - result.parameterMinChar = parameterMinChar; - result.parameterLimChar = parameterLimChar; - result.currentParameterIsTypeParameter = false; - result.currentParameter = -1; - - if (typeParameterInformation) { - result.currentParameterIsTypeParameter = true; - result.currentParameter = typeParameterInformation.argumentIndex; - } - else if (ast.argumentList.arguments && ast.argumentList.arguments.length > 0) { - result.currentParameter = 0; - for (var index = 0; index < ast.argumentList.arguments.length; index++) { - if (caretPosition > end(ast.argumentList.arguments[index]) + lastToken(ast.argumentList.arguments[index]).trailingTriviaWidth()) { - result.currentParameter++; - } - } - } - - return result; - } - - public static getActualSignatureInfoFromPartiallyWritenGenericExpression(caretPosition: number, typeParameterInformation: IPartiallyWrittenTypeArgumentListInformation): ActualSignatureInfo { - var result = new ActualSignatureInfo(); - - result.parameterMinChar = start(typeParameterInformation.lessThanToken); - result.parameterLimChar = Math.max(fullEnd(typeParameterInformation.lessThanToken), caretPosition); - result.currentParameterIsTypeParameter = true; - result.currentParameter = typeParameterInformation.argumentIndex; - - return result; - } - - public static isSignatureHelpBlocker(sourceUnit: TypeScript.SourceUnitSyntax, position: number): boolean { - // We shouldn't be getting a possition that is outside the file because - // isEntirelyInsideComment can't handle when the position is out of bounds, - // callers should be fixed, however we should be resiliant to bad inputs - // so we return true (this position is a blocker for getting signature help) - if (position < 0 || position > fullWidth(sourceUnit)) { - return true; - } - - return TypeScript.Syntax.isEntirelyInsideComment(sourceUnit, position); - } - - public static isTargetOfObjectCreationExpression(positionedToken: TypeScript.ISyntaxToken): boolean { - var positionedParent = TypeScript.Syntax.getAncestorOfKind(positionedToken, TypeScript.SyntaxKind.ObjectCreationExpression); - if (positionedParent) { - var objectCreationExpression = positionedParent; - var expressionRelativeStart = objectCreationExpression.newKeyword.fullWidth(); - var tokenRelativeStart = positionedToken.fullStart() - fullStart(positionedParent); - return tokenRelativeStart >= expressionRelativeStart && - tokenRelativeStart <= (expressionRelativeStart + fullWidth(objectCreationExpression.expression)); - } - - return false; - } - - private static moveBackUpTillMatchingTokenKind(token: TypeScript.ISyntaxToken, tokenKind: TypeScript.SyntaxKind, matchingTokenKind: TypeScript.SyntaxKind): TypeScript.ISyntaxToken { - if (!token || token.kind() !== tokenKind) { - throw TypeScript.Errors.invalidOperation(); - } - - // Skip the current token - token = previousToken(token, /*includeSkippedTokens*/ true); - - var stack = 0; - - while (token) { - if (token.kind() === matchingTokenKind) { - if (stack === 0) { - // Found the matching token, return - return token; - } - else if (stack < 0) { - // tokens overlapped.. bail out. - break; - } - else { - stack--; - } - } - else if (token.kind() === tokenKind) { - stack++; - } - - // Move back - token = previousToken(token, /*includeSkippedTokens*/ true); - } - - // Did not find matching token - return null; - } - } -} \ No newline at end of file diff --git a/src/services/syntax/defaultSyntaxVisitor.generated.ts b/src/services/syntax/defaultSyntaxVisitor.generated.ts index 041b72b9359..32a0cfad4a5 100644 --- a/src/services/syntax/defaultSyntaxVisitor.generated.ts +++ b/src/services/syntax/defaultSyntaxVisitor.generated.ts @@ -42,6 +42,10 @@ module TypeScript { return this.defaultVisit(node); } + public visitTupleType(node: TupleTypeSyntax): any { + return this.defaultVisit(node); + } + public visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): any { return this.defaultVisit(node); } diff --git a/src/services/syntax/parser.ts b/src/services/syntax/parser.ts index 31a87b857b1..a35ddc5737b 100644 --- a/src/services/syntax/parser.ts +++ b/src/services/syntax/parser.ts @@ -1048,6 +1048,7 @@ module TypeScript.Parser { case SyntaxKind.ExportKeyword: case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: case SyntaxKind.DeclareKeyword: return true; @@ -1434,6 +1435,19 @@ module TypeScript.Parser { return new syntaxFactory.ObjectTypeSyntax(parseNodeData, openBraceToken, typeMembers, eatToken(SyntaxKind.CloseBraceToken)); } + function parseTupleType(currentToken: ISyntaxToken): TupleTypeSyntax { + var openBracket = consumeToken(currentToken); + + var types = Syntax.emptySeparatedList(); + if (openBracket.fullWidth() > 0) { + var skippedTokens: ISyntaxToken[] = getArray(); + types = parseSeparatedSyntaxList(ListParsingState.TupleType_Types, skippedTokens); + openBracket = addSkippedTokensAfterToken(openBracket, skippedTokens); + } + + return new syntaxFactory.TupleTypeSyntax(parseNodeData, openBracket, types, eatToken(SyntaxKind.CloseBracketToken)); + } + function isTypeMember(inErrorRecovery: boolean): boolean { if (SyntaxUtilities.isTypeMember(currentNode())) { return true; @@ -1663,6 +1677,7 @@ module TypeScript.Parser { // ERROR RECOVERY case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: // None of the above are actually keywords. And they might show up in a real // statement (i.e. "public();"). However, if we see 'public ' then @@ -1731,6 +1746,7 @@ module TypeScript.Parser { // ERROR RECOVERY case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: // None of the above are actually keywords. And they might show up in a real // statement (i.e. "public();"). However, if we see 'public ' then @@ -3133,7 +3149,7 @@ module TypeScript.Parser { token2 = peekToken(2); token2Kind = token2.kind(); - if (token1Kind === SyntaxKind.PublicKeyword || token1Kind === SyntaxKind.PrivateKeyword) { + if (SyntaxFacts.isAccessibilityModifier(token1Kind)) { if (isIdentifier(token2)) { // "(public id" or "(function id". Definitely an arrow function. Could never // be a parenthesized expression. Note: this will be an *illegal* arrow @@ -3557,11 +3573,12 @@ module TypeScript.Parser { return consumeToken(_currentToken); case SyntaxKind.OpenParenToken: - case SyntaxKind.LessThanToken: return tryParseFunctionType(); - case SyntaxKind.VoidKeyword: return consumeToken(_currentToken); - case SyntaxKind.OpenBraceToken: return parseObjectType(); - case SyntaxKind.NewKeyword: return parseConstructorType(); - case SyntaxKind.TypeOfKeyword: return parseTypeQuery(_currentToken); + case SyntaxKind.LessThanToken: return tryParseFunctionType(); + case SyntaxKind.VoidKeyword: return consumeToken(_currentToken); + case SyntaxKind.OpenBraceToken: return parseObjectType(); + case SyntaxKind.NewKeyword: return parseConstructorType(); + case SyntaxKind.TypeOfKeyword: return parseTypeQuery(_currentToken); + case SyntaxKind.OpenBracketToken: return parseTupleType(_currentToken); } return tryParseNameOrGenericType(); @@ -3973,6 +3990,7 @@ module TypeScript.Parser { case ListParsingState.IndexSignature_Parameters: return isExpectedIndexSignature_ParametersTerminator(); case ListParsingState.TypeArgumentList_Types: return isExpectedTypeArgumentList_TypesTerminator(); case ListParsingState.TypeParameterList_TypeParameters: return isExpectedTypeParameterList_TypeParametersTerminator(); + case ListParsingState.TupleType_Types: return isExpectedTupleType_TypesTerminator(); default: throw Errors.invalidOperation(); } @@ -4019,6 +4037,17 @@ module TypeScript.Parser { return false; } + function isExpectedTupleType_TypesTerminator(): boolean { + var token = currentToken(); + var tokenKind = token.kind(); + if (tokenKind === SyntaxKind.CloseBracketToken) { + return true; + } + + // TODO: add more cases as necessary for error tolerance. + return false; + } + function isExpectedTypeParameterList_TypeParametersTerminator(): boolean { var tokenKind = currentToken().kind(); if (tokenKind === SyntaxKind.GreaterThanToken) { @@ -4187,6 +4216,7 @@ module TypeScript.Parser { case ListParsingState.IndexSignature_Parameters: return isParameter(); case ListParsingState.TypeArgumentList_Types: return isType(); case ListParsingState.TypeParameterList_TypeParameters: return isTypeParameter(); + case ListParsingState.TupleType_Types: return isType(); default: throw Errors.invalidOperation(); } } @@ -4230,6 +4260,7 @@ module TypeScript.Parser { case ListParsingState.IndexSignature_Parameters: return tryParseParameter(); case ListParsingState.TypeArgumentList_Types: return tryParseType(); case ListParsingState.TypeParameterList_TypeParameters: return tryParseTypeParameter(); + case ListParsingState.TupleType_Types: return tryParseType(); default: throw Errors.invalidOperation(); } } @@ -4254,6 +4285,7 @@ module TypeScript.Parser { case ListParsingState.IndexSignature_Parameters: return getLocalizedText(DiagnosticCode.parameter, null); case ListParsingState.TypeArgumentList_Types: return getLocalizedText(DiagnosticCode.type, null); case ListParsingState.TypeParameterList_TypeParameters: return getLocalizedText(DiagnosticCode.type_parameter, null); + case ListParsingState.TupleType_Types: return getLocalizedText(DiagnosticCode.type, null); case ListParsingState.ArrayLiteralExpression_AssignmentExpressions: return getLocalizedText(DiagnosticCode.expression, null); default: throw Errors.invalidOperation(); } @@ -4376,9 +4408,10 @@ module TypeScript.Parser { IndexSignature_Parameters = 18, TypeArgumentList_Types = 19, TypeParameterList_TypeParameters = 20, + TupleType_Types = 21, FirstListParsingState = SourceUnit_ModuleElements, - LastListParsingState = TypeParameterList_TypeParameters, + LastListParsingState = TupleType_Types, } // We keep the parser around as a singleton. This is because calling createParser is actually diff --git a/src/services/syntax/prettyPrinter.ts b/src/services/syntax/prettyPrinter.ts index f19b9224f7e..df22bcab559 100644 --- a/src/services/syntax/prettyPrinter.ts +++ b/src/services/syntax/prettyPrinter.ts @@ -421,6 +421,12 @@ module TypeScript.PrettyPrinter { this.appendToken(node.greaterThanToken); } + public visitTupleType(node: TupleTypeSyntax): void { + this.appendToken(node.openBracketToken); + this.appendSeparatorSpaceList(node.types); + this.appendToken(node.closeBracketToken); + } + public visitConstructorType(node: ConstructorTypeSyntax): void { this.appendToken(node.newKeyword); this.ensureSpace(); diff --git a/src/services/syntax/syntaxFacts2.ts b/src/services/syntax/syntaxFacts2.ts index ec59a583e05..99a144176a4 100644 --- a/src/services/syntax/syntaxFacts2.ts +++ b/src/services/syntax/syntaxFacts2.ts @@ -26,4 +26,15 @@ module TypeScript.SyntaxFacts { var tokenKind = token.kind(); return tokenKind === SyntaxKind.IdentifierName || SyntaxFacts.isAnyKeyword(tokenKind); } + + export function isAccessibilityModifier(kind: SyntaxKind): boolean { + switch (kind) { + case SyntaxKind.PublicKeyword: + case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: + return true; + } + + return false; + } } \ No newline at end of file diff --git a/src/services/syntax/syntaxGenerator.ts b/src/services/syntax/syntaxGenerator.ts index 21f65bb79e3..ebc2673b98c 100644 --- a/src/services/syntax/syntaxGenerator.ts +++ b/src/services/syntax/syntaxGenerator.ts @@ -354,6 +354,17 @@ var definitions:ITypeDefinition[] = [ ], isTypeScriptSpecific: true }, + { + name: 'TupleTypeSyntax', + baseType: 'ISyntaxNode', + interfaces: ['ITypeSyntax'], + children: [ + { name: 'openBracketToken', isToken: true, excludeFromAST: true }, + { name: 'types', isSeparatedList: true, elementType: 'ITypeSyntax' }, + { name: 'closeBracketToken', isToken: true, excludeFromAST: true } + ], + isTypeScriptSpecific: true + }, { name: 'TypeAnnotationSyntax', baseType: 'ISyntaxNode', diff --git a/src/services/syntax/syntaxKind.ts b/src/services/syntax/syntaxKind.ts index bcc6ab46eec..1021c2fcfd7 100644 --- a/src/services/syntax/syntaxKind.ts +++ b/src/services/syntax/syntaxKind.ts @@ -158,6 +158,7 @@ module TypeScript { ConstructorType, GenericType, TypeQuery, + TupleType, // Module elements. InterfaceDeclaration, diff --git a/src/services/syntax/syntaxNodes.abstract.generated.ts b/src/services/syntax/syntaxNodes.abstract.generated.ts index 031b0363ca4..9cba7f66d00 100644 --- a/src/services/syntax/syntaxNodes.abstract.generated.ts +++ b/src/services/syntax/syntaxNodes.abstract.generated.ts @@ -108,6 +108,17 @@ module TypeScript.Syntax.Abstract { name.parent = this; } } + export class TupleTypeSyntax extends SyntaxNode implements ITypeSyntax { + public openBracketToken: ISyntaxToken; + public types: ITypeSyntax[]; + public closeBracketToken: ISyntaxToken; + public _typeBrand: any; + constructor(data: number, openBracketToken: ISyntaxToken, types: ITypeSyntax[], closeBracketToken: ISyntaxToken) { + super(data); + this.types = types, + !isShared(types) && (types.parent = this); + } + } export class InterfaceDeclarationSyntax extends SyntaxNode implements IModuleElementSyntax { public modifiers: ISyntaxToken[]; public interfaceKeyword: ISyntaxToken; @@ -1190,5 +1201,5 @@ module TypeScript.Syntax.Abstract { } } - (SourceUnitSyntax).prototype.__kind = SyntaxKind.SourceUnit, (QualifiedNameSyntax).prototype.__kind = SyntaxKind.QualifiedName, (ObjectTypeSyntax).prototype.__kind = SyntaxKind.ObjectType, (FunctionTypeSyntax).prototype.__kind = SyntaxKind.FunctionType, (ArrayTypeSyntax).prototype.__kind = SyntaxKind.ArrayType, (ConstructorTypeSyntax).prototype.__kind = SyntaxKind.ConstructorType, (GenericTypeSyntax).prototype.__kind = SyntaxKind.GenericType, (TypeQuerySyntax).prototype.__kind = SyntaxKind.TypeQuery, (InterfaceDeclarationSyntax).prototype.__kind = SyntaxKind.InterfaceDeclaration, (FunctionDeclarationSyntax).prototype.__kind = SyntaxKind.FunctionDeclaration, (ModuleDeclarationSyntax).prototype.__kind = SyntaxKind.ModuleDeclaration, (ClassDeclarationSyntax).prototype.__kind = SyntaxKind.ClassDeclaration, (EnumDeclarationSyntax).prototype.__kind = SyntaxKind.EnumDeclaration, (ImportDeclarationSyntax).prototype.__kind = SyntaxKind.ImportDeclaration, (ExportAssignmentSyntax).prototype.__kind = SyntaxKind.ExportAssignment, (MemberFunctionDeclarationSyntax).prototype.__kind = SyntaxKind.MemberFunctionDeclaration, (MemberVariableDeclarationSyntax).prototype.__kind = SyntaxKind.MemberVariableDeclaration, (ConstructorDeclarationSyntax).prototype.__kind = SyntaxKind.ConstructorDeclaration, (IndexMemberDeclarationSyntax).prototype.__kind = SyntaxKind.IndexMemberDeclaration, (GetAccessorSyntax).prototype.__kind = SyntaxKind.GetAccessor, (SetAccessorSyntax).prototype.__kind = SyntaxKind.SetAccessor, (PropertySignatureSyntax).prototype.__kind = SyntaxKind.PropertySignature, (CallSignatureSyntax).prototype.__kind = SyntaxKind.CallSignature, (ConstructSignatureSyntax).prototype.__kind = SyntaxKind.ConstructSignature, (IndexSignatureSyntax).prototype.__kind = SyntaxKind.IndexSignature, (MethodSignatureSyntax).prototype.__kind = SyntaxKind.MethodSignature, (BlockSyntax).prototype.__kind = SyntaxKind.Block, (IfStatementSyntax).prototype.__kind = SyntaxKind.IfStatement, (VariableStatementSyntax).prototype.__kind = SyntaxKind.VariableStatement, (ExpressionStatementSyntax).prototype.__kind = SyntaxKind.ExpressionStatement, (ReturnStatementSyntax).prototype.__kind = SyntaxKind.ReturnStatement, (SwitchStatementSyntax).prototype.__kind = SyntaxKind.SwitchStatement, (BreakStatementSyntax).prototype.__kind = SyntaxKind.BreakStatement, (ContinueStatementSyntax).prototype.__kind = SyntaxKind.ContinueStatement, (ForStatementSyntax).prototype.__kind = SyntaxKind.ForStatement, (ForInStatementSyntax).prototype.__kind = SyntaxKind.ForInStatement, (EmptyStatementSyntax).prototype.__kind = SyntaxKind.EmptyStatement, (ThrowStatementSyntax).prototype.__kind = SyntaxKind.ThrowStatement, (WhileStatementSyntax).prototype.__kind = SyntaxKind.WhileStatement, (TryStatementSyntax).prototype.__kind = SyntaxKind.TryStatement, (LabeledStatementSyntax).prototype.__kind = SyntaxKind.LabeledStatement, (DoStatementSyntax).prototype.__kind = SyntaxKind.DoStatement, (DebuggerStatementSyntax).prototype.__kind = SyntaxKind.DebuggerStatement, (WithStatementSyntax).prototype.__kind = SyntaxKind.WithStatement, (DeleteExpressionSyntax).prototype.__kind = SyntaxKind.DeleteExpression, (TypeOfExpressionSyntax).prototype.__kind = SyntaxKind.TypeOfExpression, (VoidExpressionSyntax).prototype.__kind = SyntaxKind.VoidExpression, (ConditionalExpressionSyntax).prototype.__kind = SyntaxKind.ConditionalExpression, (MemberAccessExpressionSyntax).prototype.__kind = SyntaxKind.MemberAccessExpression, (InvocationExpressionSyntax).prototype.__kind = SyntaxKind.InvocationExpression, (ArrayLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ArrayLiteralExpression, (ObjectLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ObjectLiteralExpression, (ObjectCreationExpressionSyntax).prototype.__kind = SyntaxKind.ObjectCreationExpression, (ParenthesizedExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedExpression, (ParenthesizedArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedArrowFunctionExpression, (SimpleArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.SimpleArrowFunctionExpression, (CastExpressionSyntax).prototype.__kind = SyntaxKind.CastExpression, (ElementAccessExpressionSyntax).prototype.__kind = SyntaxKind.ElementAccessExpression, (FunctionExpressionSyntax).prototype.__kind = SyntaxKind.FunctionExpression, (OmittedExpressionSyntax).prototype.__kind = SyntaxKind.OmittedExpression, (VariableDeclarationSyntax).prototype.__kind = SyntaxKind.VariableDeclaration, (VariableDeclaratorSyntax).prototype.__kind = SyntaxKind.VariableDeclarator, (ArgumentListSyntax).prototype.__kind = SyntaxKind.ArgumentList, (ParameterListSyntax).prototype.__kind = SyntaxKind.ParameterList, (TypeArgumentListSyntax).prototype.__kind = SyntaxKind.TypeArgumentList, (TypeParameterListSyntax).prototype.__kind = SyntaxKind.TypeParameterList, (EqualsValueClauseSyntax).prototype.__kind = SyntaxKind.EqualsValueClause, (CaseSwitchClauseSyntax).prototype.__kind = SyntaxKind.CaseSwitchClause, (DefaultSwitchClauseSyntax).prototype.__kind = SyntaxKind.DefaultSwitchClause, (ElseClauseSyntax).prototype.__kind = SyntaxKind.ElseClause, (CatchClauseSyntax).prototype.__kind = SyntaxKind.CatchClause, (FinallyClauseSyntax).prototype.__kind = SyntaxKind.FinallyClause, (TypeParameterSyntax).prototype.__kind = SyntaxKind.TypeParameter, (ConstraintSyntax).prototype.__kind = SyntaxKind.Constraint, (SimplePropertyAssignmentSyntax).prototype.__kind = SyntaxKind.SimplePropertyAssignment, (FunctionPropertyAssignmentSyntax).prototype.__kind = SyntaxKind.FunctionPropertyAssignment, (ParameterSyntax).prototype.__kind = SyntaxKind.Parameter, (EnumElementSyntax).prototype.__kind = SyntaxKind.EnumElement, (TypeAnnotationSyntax).prototype.__kind = SyntaxKind.TypeAnnotation, (ExternalModuleReferenceSyntax).prototype.__kind = SyntaxKind.ExternalModuleReference, (ModuleNameModuleReferenceSyntax).prototype.__kind = SyntaxKind.ModuleNameModuleReference; + (SourceUnitSyntax).prototype.__kind = SyntaxKind.SourceUnit, (QualifiedNameSyntax).prototype.__kind = SyntaxKind.QualifiedName, (ObjectTypeSyntax).prototype.__kind = SyntaxKind.ObjectType, (FunctionTypeSyntax).prototype.__kind = SyntaxKind.FunctionType, (ArrayTypeSyntax).prototype.__kind = SyntaxKind.ArrayType, (ConstructorTypeSyntax).prototype.__kind = SyntaxKind.ConstructorType, (GenericTypeSyntax).prototype.__kind = SyntaxKind.GenericType, (TypeQuerySyntax).prototype.__kind = SyntaxKind.TypeQuery, (TupleTypeSyntax).prototype.__kind = SyntaxKind.TupleType, (InterfaceDeclarationSyntax).prototype.__kind = SyntaxKind.InterfaceDeclaration, (FunctionDeclarationSyntax).prototype.__kind = SyntaxKind.FunctionDeclaration, (ModuleDeclarationSyntax).prototype.__kind = SyntaxKind.ModuleDeclaration, (ClassDeclarationSyntax).prototype.__kind = SyntaxKind.ClassDeclaration, (EnumDeclarationSyntax).prototype.__kind = SyntaxKind.EnumDeclaration, (ImportDeclarationSyntax).prototype.__kind = SyntaxKind.ImportDeclaration, (ExportAssignmentSyntax).prototype.__kind = SyntaxKind.ExportAssignment, (MemberFunctionDeclarationSyntax).prototype.__kind = SyntaxKind.MemberFunctionDeclaration, (MemberVariableDeclarationSyntax).prototype.__kind = SyntaxKind.MemberVariableDeclaration, (ConstructorDeclarationSyntax).prototype.__kind = SyntaxKind.ConstructorDeclaration, (IndexMemberDeclarationSyntax).prototype.__kind = SyntaxKind.IndexMemberDeclaration, (GetAccessorSyntax).prototype.__kind = SyntaxKind.GetAccessor, (SetAccessorSyntax).prototype.__kind = SyntaxKind.SetAccessor, (PropertySignatureSyntax).prototype.__kind = SyntaxKind.PropertySignature, (CallSignatureSyntax).prototype.__kind = SyntaxKind.CallSignature, (ConstructSignatureSyntax).prototype.__kind = SyntaxKind.ConstructSignature, (IndexSignatureSyntax).prototype.__kind = SyntaxKind.IndexSignature, (MethodSignatureSyntax).prototype.__kind = SyntaxKind.MethodSignature, (BlockSyntax).prototype.__kind = SyntaxKind.Block, (IfStatementSyntax).prototype.__kind = SyntaxKind.IfStatement, (VariableStatementSyntax).prototype.__kind = SyntaxKind.VariableStatement, (ExpressionStatementSyntax).prototype.__kind = SyntaxKind.ExpressionStatement, (ReturnStatementSyntax).prototype.__kind = SyntaxKind.ReturnStatement, (SwitchStatementSyntax).prototype.__kind = SyntaxKind.SwitchStatement, (BreakStatementSyntax).prototype.__kind = SyntaxKind.BreakStatement, (ContinueStatementSyntax).prototype.__kind = SyntaxKind.ContinueStatement, (ForStatementSyntax).prototype.__kind = SyntaxKind.ForStatement, (ForInStatementSyntax).prototype.__kind = SyntaxKind.ForInStatement, (EmptyStatementSyntax).prototype.__kind = SyntaxKind.EmptyStatement, (ThrowStatementSyntax).prototype.__kind = SyntaxKind.ThrowStatement, (WhileStatementSyntax).prototype.__kind = SyntaxKind.WhileStatement, (TryStatementSyntax).prototype.__kind = SyntaxKind.TryStatement, (LabeledStatementSyntax).prototype.__kind = SyntaxKind.LabeledStatement, (DoStatementSyntax).prototype.__kind = SyntaxKind.DoStatement, (DebuggerStatementSyntax).prototype.__kind = SyntaxKind.DebuggerStatement, (WithStatementSyntax).prototype.__kind = SyntaxKind.WithStatement, (DeleteExpressionSyntax).prototype.__kind = SyntaxKind.DeleteExpression, (TypeOfExpressionSyntax).prototype.__kind = SyntaxKind.TypeOfExpression, (VoidExpressionSyntax).prototype.__kind = SyntaxKind.VoidExpression, (ConditionalExpressionSyntax).prototype.__kind = SyntaxKind.ConditionalExpression, (MemberAccessExpressionSyntax).prototype.__kind = SyntaxKind.MemberAccessExpression, (InvocationExpressionSyntax).prototype.__kind = SyntaxKind.InvocationExpression, (ArrayLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ArrayLiteralExpression, (ObjectLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ObjectLiteralExpression, (ObjectCreationExpressionSyntax).prototype.__kind = SyntaxKind.ObjectCreationExpression, (ParenthesizedExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedExpression, (ParenthesizedArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedArrowFunctionExpression, (SimpleArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.SimpleArrowFunctionExpression, (CastExpressionSyntax).prototype.__kind = SyntaxKind.CastExpression, (ElementAccessExpressionSyntax).prototype.__kind = SyntaxKind.ElementAccessExpression, (FunctionExpressionSyntax).prototype.__kind = SyntaxKind.FunctionExpression, (OmittedExpressionSyntax).prototype.__kind = SyntaxKind.OmittedExpression, (VariableDeclarationSyntax).prototype.__kind = SyntaxKind.VariableDeclaration, (VariableDeclaratorSyntax).prototype.__kind = SyntaxKind.VariableDeclarator, (ArgumentListSyntax).prototype.__kind = SyntaxKind.ArgumentList, (ParameterListSyntax).prototype.__kind = SyntaxKind.ParameterList, (TypeArgumentListSyntax).prototype.__kind = SyntaxKind.TypeArgumentList, (TypeParameterListSyntax).prototype.__kind = SyntaxKind.TypeParameterList, (EqualsValueClauseSyntax).prototype.__kind = SyntaxKind.EqualsValueClause, (CaseSwitchClauseSyntax).prototype.__kind = SyntaxKind.CaseSwitchClause, (DefaultSwitchClauseSyntax).prototype.__kind = SyntaxKind.DefaultSwitchClause, (ElseClauseSyntax).prototype.__kind = SyntaxKind.ElseClause, (CatchClauseSyntax).prototype.__kind = SyntaxKind.CatchClause, (FinallyClauseSyntax).prototype.__kind = SyntaxKind.FinallyClause, (TypeParameterSyntax).prototype.__kind = SyntaxKind.TypeParameter, (ConstraintSyntax).prototype.__kind = SyntaxKind.Constraint, (SimplePropertyAssignmentSyntax).prototype.__kind = SyntaxKind.SimplePropertyAssignment, (FunctionPropertyAssignmentSyntax).prototype.__kind = SyntaxKind.FunctionPropertyAssignment, (ParameterSyntax).prototype.__kind = SyntaxKind.Parameter, (EnumElementSyntax).prototype.__kind = SyntaxKind.EnumElement, (TypeAnnotationSyntax).prototype.__kind = SyntaxKind.TypeAnnotation, (ExternalModuleReferenceSyntax).prototype.__kind = SyntaxKind.ExternalModuleReference, (ModuleNameModuleReferenceSyntax).prototype.__kind = SyntaxKind.ModuleNameModuleReference; } \ No newline at end of file diff --git a/src/services/syntax/syntaxNodes.concrete.generated.ts b/src/services/syntax/syntaxNodes.concrete.generated.ts index cc493aa53a6..fa593fd1976 100644 --- a/src/services/syntax/syntaxNodes.concrete.generated.ts +++ b/src/services/syntax/syntaxNodes.concrete.generated.ts @@ -126,6 +126,21 @@ module TypeScript.Syntax.Concrete { name.parent = this; } } + export class TupleTypeSyntax extends SyntaxNode implements ITypeSyntax { + public openBracketToken: ISyntaxToken; + public types: ITypeSyntax[]; + public closeBracketToken: ISyntaxToken; + public _typeBrand: any; + constructor(data: number, openBracketToken: ISyntaxToken, types: ITypeSyntax[], closeBracketToken: ISyntaxToken) { + super(data); + this.openBracketToken = openBracketToken, + this.types = types, + this.closeBracketToken = closeBracketToken, + openBracketToken.parent = this, + !isShared(types) && (types.parent = this), + closeBracketToken.parent = this; + } + } export class InterfaceDeclarationSyntax extends SyntaxNode implements IModuleElementSyntax { public modifiers: ISyntaxToken[]; public interfaceKeyword: ISyntaxToken; @@ -1420,5 +1435,5 @@ module TypeScript.Syntax.Concrete { } } - (SourceUnitSyntax).prototype.__kind = SyntaxKind.SourceUnit, (QualifiedNameSyntax).prototype.__kind = SyntaxKind.QualifiedName, (ObjectTypeSyntax).prototype.__kind = SyntaxKind.ObjectType, (FunctionTypeSyntax).prototype.__kind = SyntaxKind.FunctionType, (ArrayTypeSyntax).prototype.__kind = SyntaxKind.ArrayType, (ConstructorTypeSyntax).prototype.__kind = SyntaxKind.ConstructorType, (GenericTypeSyntax).prototype.__kind = SyntaxKind.GenericType, (TypeQuerySyntax).prototype.__kind = SyntaxKind.TypeQuery, (InterfaceDeclarationSyntax).prototype.__kind = SyntaxKind.InterfaceDeclaration, (FunctionDeclarationSyntax).prototype.__kind = SyntaxKind.FunctionDeclaration, (ModuleDeclarationSyntax).prototype.__kind = SyntaxKind.ModuleDeclaration, (ClassDeclarationSyntax).prototype.__kind = SyntaxKind.ClassDeclaration, (EnumDeclarationSyntax).prototype.__kind = SyntaxKind.EnumDeclaration, (ImportDeclarationSyntax).prototype.__kind = SyntaxKind.ImportDeclaration, (ExportAssignmentSyntax).prototype.__kind = SyntaxKind.ExportAssignment, (MemberFunctionDeclarationSyntax).prototype.__kind = SyntaxKind.MemberFunctionDeclaration, (MemberVariableDeclarationSyntax).prototype.__kind = SyntaxKind.MemberVariableDeclaration, (ConstructorDeclarationSyntax).prototype.__kind = SyntaxKind.ConstructorDeclaration, (IndexMemberDeclarationSyntax).prototype.__kind = SyntaxKind.IndexMemberDeclaration, (GetAccessorSyntax).prototype.__kind = SyntaxKind.GetAccessor, (SetAccessorSyntax).prototype.__kind = SyntaxKind.SetAccessor, (PropertySignatureSyntax).prototype.__kind = SyntaxKind.PropertySignature, (CallSignatureSyntax).prototype.__kind = SyntaxKind.CallSignature, (ConstructSignatureSyntax).prototype.__kind = SyntaxKind.ConstructSignature, (IndexSignatureSyntax).prototype.__kind = SyntaxKind.IndexSignature, (MethodSignatureSyntax).prototype.__kind = SyntaxKind.MethodSignature, (BlockSyntax).prototype.__kind = SyntaxKind.Block, (IfStatementSyntax).prototype.__kind = SyntaxKind.IfStatement, (VariableStatementSyntax).prototype.__kind = SyntaxKind.VariableStatement, (ExpressionStatementSyntax).prototype.__kind = SyntaxKind.ExpressionStatement, (ReturnStatementSyntax).prototype.__kind = SyntaxKind.ReturnStatement, (SwitchStatementSyntax).prototype.__kind = SyntaxKind.SwitchStatement, (BreakStatementSyntax).prototype.__kind = SyntaxKind.BreakStatement, (ContinueStatementSyntax).prototype.__kind = SyntaxKind.ContinueStatement, (ForStatementSyntax).prototype.__kind = SyntaxKind.ForStatement, (ForInStatementSyntax).prototype.__kind = SyntaxKind.ForInStatement, (EmptyStatementSyntax).prototype.__kind = SyntaxKind.EmptyStatement, (ThrowStatementSyntax).prototype.__kind = SyntaxKind.ThrowStatement, (WhileStatementSyntax).prototype.__kind = SyntaxKind.WhileStatement, (TryStatementSyntax).prototype.__kind = SyntaxKind.TryStatement, (LabeledStatementSyntax).prototype.__kind = SyntaxKind.LabeledStatement, (DoStatementSyntax).prototype.__kind = SyntaxKind.DoStatement, (DebuggerStatementSyntax).prototype.__kind = SyntaxKind.DebuggerStatement, (WithStatementSyntax).prototype.__kind = SyntaxKind.WithStatement, (DeleteExpressionSyntax).prototype.__kind = SyntaxKind.DeleteExpression, (TypeOfExpressionSyntax).prototype.__kind = SyntaxKind.TypeOfExpression, (VoidExpressionSyntax).prototype.__kind = SyntaxKind.VoidExpression, (ConditionalExpressionSyntax).prototype.__kind = SyntaxKind.ConditionalExpression, (MemberAccessExpressionSyntax).prototype.__kind = SyntaxKind.MemberAccessExpression, (InvocationExpressionSyntax).prototype.__kind = SyntaxKind.InvocationExpression, (ArrayLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ArrayLiteralExpression, (ObjectLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ObjectLiteralExpression, (ObjectCreationExpressionSyntax).prototype.__kind = SyntaxKind.ObjectCreationExpression, (ParenthesizedExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedExpression, (ParenthesizedArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedArrowFunctionExpression, (SimpleArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.SimpleArrowFunctionExpression, (CastExpressionSyntax).prototype.__kind = SyntaxKind.CastExpression, (ElementAccessExpressionSyntax).prototype.__kind = SyntaxKind.ElementAccessExpression, (FunctionExpressionSyntax).prototype.__kind = SyntaxKind.FunctionExpression, (OmittedExpressionSyntax).prototype.__kind = SyntaxKind.OmittedExpression, (VariableDeclarationSyntax).prototype.__kind = SyntaxKind.VariableDeclaration, (VariableDeclaratorSyntax).prototype.__kind = SyntaxKind.VariableDeclarator, (ArgumentListSyntax).prototype.__kind = SyntaxKind.ArgumentList, (ParameterListSyntax).prototype.__kind = SyntaxKind.ParameterList, (TypeArgumentListSyntax).prototype.__kind = SyntaxKind.TypeArgumentList, (TypeParameterListSyntax).prototype.__kind = SyntaxKind.TypeParameterList, (EqualsValueClauseSyntax).prototype.__kind = SyntaxKind.EqualsValueClause, (CaseSwitchClauseSyntax).prototype.__kind = SyntaxKind.CaseSwitchClause, (DefaultSwitchClauseSyntax).prototype.__kind = SyntaxKind.DefaultSwitchClause, (ElseClauseSyntax).prototype.__kind = SyntaxKind.ElseClause, (CatchClauseSyntax).prototype.__kind = SyntaxKind.CatchClause, (FinallyClauseSyntax).prototype.__kind = SyntaxKind.FinallyClause, (TypeParameterSyntax).prototype.__kind = SyntaxKind.TypeParameter, (ConstraintSyntax).prototype.__kind = SyntaxKind.Constraint, (SimplePropertyAssignmentSyntax).prototype.__kind = SyntaxKind.SimplePropertyAssignment, (FunctionPropertyAssignmentSyntax).prototype.__kind = SyntaxKind.FunctionPropertyAssignment, (ParameterSyntax).prototype.__kind = SyntaxKind.Parameter, (EnumElementSyntax).prototype.__kind = SyntaxKind.EnumElement, (TypeAnnotationSyntax).prototype.__kind = SyntaxKind.TypeAnnotation, (ExternalModuleReferenceSyntax).prototype.__kind = SyntaxKind.ExternalModuleReference, (ModuleNameModuleReferenceSyntax).prototype.__kind = SyntaxKind.ModuleNameModuleReference; + (SourceUnitSyntax).prototype.__kind = SyntaxKind.SourceUnit, (QualifiedNameSyntax).prototype.__kind = SyntaxKind.QualifiedName, (ObjectTypeSyntax).prototype.__kind = SyntaxKind.ObjectType, (FunctionTypeSyntax).prototype.__kind = SyntaxKind.FunctionType, (ArrayTypeSyntax).prototype.__kind = SyntaxKind.ArrayType, (ConstructorTypeSyntax).prototype.__kind = SyntaxKind.ConstructorType, (GenericTypeSyntax).prototype.__kind = SyntaxKind.GenericType, (TypeQuerySyntax).prototype.__kind = SyntaxKind.TypeQuery, (TupleTypeSyntax).prototype.__kind = SyntaxKind.TupleType, (InterfaceDeclarationSyntax).prototype.__kind = SyntaxKind.InterfaceDeclaration, (FunctionDeclarationSyntax).prototype.__kind = SyntaxKind.FunctionDeclaration, (ModuleDeclarationSyntax).prototype.__kind = SyntaxKind.ModuleDeclaration, (ClassDeclarationSyntax).prototype.__kind = SyntaxKind.ClassDeclaration, (EnumDeclarationSyntax).prototype.__kind = SyntaxKind.EnumDeclaration, (ImportDeclarationSyntax).prototype.__kind = SyntaxKind.ImportDeclaration, (ExportAssignmentSyntax).prototype.__kind = SyntaxKind.ExportAssignment, (MemberFunctionDeclarationSyntax).prototype.__kind = SyntaxKind.MemberFunctionDeclaration, (MemberVariableDeclarationSyntax).prototype.__kind = SyntaxKind.MemberVariableDeclaration, (ConstructorDeclarationSyntax).prototype.__kind = SyntaxKind.ConstructorDeclaration, (IndexMemberDeclarationSyntax).prototype.__kind = SyntaxKind.IndexMemberDeclaration, (GetAccessorSyntax).prototype.__kind = SyntaxKind.GetAccessor, (SetAccessorSyntax).prototype.__kind = SyntaxKind.SetAccessor, (PropertySignatureSyntax).prototype.__kind = SyntaxKind.PropertySignature, (CallSignatureSyntax).prototype.__kind = SyntaxKind.CallSignature, (ConstructSignatureSyntax).prototype.__kind = SyntaxKind.ConstructSignature, (IndexSignatureSyntax).prototype.__kind = SyntaxKind.IndexSignature, (MethodSignatureSyntax).prototype.__kind = SyntaxKind.MethodSignature, (BlockSyntax).prototype.__kind = SyntaxKind.Block, (IfStatementSyntax).prototype.__kind = SyntaxKind.IfStatement, (VariableStatementSyntax).prototype.__kind = SyntaxKind.VariableStatement, (ExpressionStatementSyntax).prototype.__kind = SyntaxKind.ExpressionStatement, (ReturnStatementSyntax).prototype.__kind = SyntaxKind.ReturnStatement, (SwitchStatementSyntax).prototype.__kind = SyntaxKind.SwitchStatement, (BreakStatementSyntax).prototype.__kind = SyntaxKind.BreakStatement, (ContinueStatementSyntax).prototype.__kind = SyntaxKind.ContinueStatement, (ForStatementSyntax).prototype.__kind = SyntaxKind.ForStatement, (ForInStatementSyntax).prototype.__kind = SyntaxKind.ForInStatement, (EmptyStatementSyntax).prototype.__kind = SyntaxKind.EmptyStatement, (ThrowStatementSyntax).prototype.__kind = SyntaxKind.ThrowStatement, (WhileStatementSyntax).prototype.__kind = SyntaxKind.WhileStatement, (TryStatementSyntax).prototype.__kind = SyntaxKind.TryStatement, (LabeledStatementSyntax).prototype.__kind = SyntaxKind.LabeledStatement, (DoStatementSyntax).prototype.__kind = SyntaxKind.DoStatement, (DebuggerStatementSyntax).prototype.__kind = SyntaxKind.DebuggerStatement, (WithStatementSyntax).prototype.__kind = SyntaxKind.WithStatement, (DeleteExpressionSyntax).prototype.__kind = SyntaxKind.DeleteExpression, (TypeOfExpressionSyntax).prototype.__kind = SyntaxKind.TypeOfExpression, (VoidExpressionSyntax).prototype.__kind = SyntaxKind.VoidExpression, (ConditionalExpressionSyntax).prototype.__kind = SyntaxKind.ConditionalExpression, (MemberAccessExpressionSyntax).prototype.__kind = SyntaxKind.MemberAccessExpression, (InvocationExpressionSyntax).prototype.__kind = SyntaxKind.InvocationExpression, (ArrayLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ArrayLiteralExpression, (ObjectLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ObjectLiteralExpression, (ObjectCreationExpressionSyntax).prototype.__kind = SyntaxKind.ObjectCreationExpression, (ParenthesizedExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedExpression, (ParenthesizedArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedArrowFunctionExpression, (SimpleArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.SimpleArrowFunctionExpression, (CastExpressionSyntax).prototype.__kind = SyntaxKind.CastExpression, (ElementAccessExpressionSyntax).prototype.__kind = SyntaxKind.ElementAccessExpression, (FunctionExpressionSyntax).prototype.__kind = SyntaxKind.FunctionExpression, (OmittedExpressionSyntax).prototype.__kind = SyntaxKind.OmittedExpression, (VariableDeclarationSyntax).prototype.__kind = SyntaxKind.VariableDeclaration, (VariableDeclaratorSyntax).prototype.__kind = SyntaxKind.VariableDeclarator, (ArgumentListSyntax).prototype.__kind = SyntaxKind.ArgumentList, (ParameterListSyntax).prototype.__kind = SyntaxKind.ParameterList, (TypeArgumentListSyntax).prototype.__kind = SyntaxKind.TypeArgumentList, (TypeParameterListSyntax).prototype.__kind = SyntaxKind.TypeParameterList, (EqualsValueClauseSyntax).prototype.__kind = SyntaxKind.EqualsValueClause, (CaseSwitchClauseSyntax).prototype.__kind = SyntaxKind.CaseSwitchClause, (DefaultSwitchClauseSyntax).prototype.__kind = SyntaxKind.DefaultSwitchClause, (ElseClauseSyntax).prototype.__kind = SyntaxKind.ElseClause, (CatchClauseSyntax).prototype.__kind = SyntaxKind.CatchClause, (FinallyClauseSyntax).prototype.__kind = SyntaxKind.FinallyClause, (TypeParameterSyntax).prototype.__kind = SyntaxKind.TypeParameter, (ConstraintSyntax).prototype.__kind = SyntaxKind.Constraint, (SimplePropertyAssignmentSyntax).prototype.__kind = SyntaxKind.SimplePropertyAssignment, (FunctionPropertyAssignmentSyntax).prototype.__kind = SyntaxKind.FunctionPropertyAssignment, (ParameterSyntax).prototype.__kind = SyntaxKind.Parameter, (EnumElementSyntax).prototype.__kind = SyntaxKind.EnumElement, (TypeAnnotationSyntax).prototype.__kind = SyntaxKind.TypeAnnotation, (ExternalModuleReferenceSyntax).prototype.__kind = SyntaxKind.ExternalModuleReference, (ModuleNameModuleReferenceSyntax).prototype.__kind = SyntaxKind.ModuleNameModuleReference; } \ No newline at end of file diff --git a/src/services/syntax/syntaxNodes.interfaces.generated.ts b/src/services/syntax/syntaxNodes.interfaces.generated.ts index 0ecc9cbf9c6..949141ba229 100644 --- a/src/services/syntax/syntaxNodes.interfaces.generated.ts +++ b/src/services/syntax/syntaxNodes.interfaces.generated.ts @@ -42,6 +42,11 @@ module TypeScript { typeOfKeyword: ISyntaxToken; name: INameSyntax; } + export interface TupleTypeSyntax extends ISyntaxNode, ITypeSyntax { + openBracketToken: ISyntaxToken; + types: ITypeSyntax[]; + closeBracketToken: ISyntaxToken; + } export interface InterfaceDeclarationSyntax extends ISyntaxNode, IModuleElementSyntax { modifiers: ISyntaxToken[]; interfaceKeyword: ISyntaxToken; @@ -478,7 +483,7 @@ module TypeScript { moduleName: INameSyntax; } - export var nodeMetadata: string[][] = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],["moduleElements","endOfFileToken"],["left","dotToken","right"],["openBraceToken","typeMembers","closeBraceToken"],["typeParameterList","parameterList","equalsGreaterThanToken","type"],["type","openBracketToken","closeBracketToken"],["newKeyword","typeParameterList","parameterList","equalsGreaterThanToken","type"],["name","typeArgumentList"],["typeOfKeyword","name"],["modifiers","interfaceKeyword","identifier","typeParameterList","heritageClauses","body"],["modifiers","functionKeyword","identifier","callSignature","block","semicolonToken"],["modifiers","moduleKeyword","name","stringLiteral","openBraceToken","moduleElements","closeBraceToken"],["modifiers","classKeyword","identifier","typeParameterList","heritageClauses","openBraceToken","classElements","closeBraceToken"],["modifiers","enumKeyword","identifier","openBraceToken","enumElements","closeBraceToken"],["modifiers","importKeyword","identifier","equalsToken","moduleReference","semicolonToken"],["exportKeyword","equalsToken","identifier","semicolonToken"],["modifiers","propertyName","callSignature","block","semicolonToken"],["modifiers","variableDeclarator","semicolonToken"],["modifiers","constructorKeyword","callSignature","block","semicolonToken"],["modifiers","indexSignature","semicolonToken"],["modifiers","getKeyword","propertyName","callSignature","block"],["modifiers","setKeyword","propertyName","callSignature","block"],["propertyName","questionToken","typeAnnotation"],["typeParameterList","parameterList","typeAnnotation"],["newKeyword","callSignature"],["openBracketToken","parameters","closeBracketToken","typeAnnotation"],["propertyName","questionToken","callSignature"],["openBraceToken","statements","closeBraceToken"],["ifKeyword","openParenToken","condition","closeParenToken","statement","elseClause"],["modifiers","variableDeclaration","semicolonToken"],["expression","semicolonToken"],["returnKeyword","expression","semicolonToken"],["switchKeyword","openParenToken","expression","closeParenToken","openBraceToken","switchClauses","closeBraceToken"],["breakKeyword","identifier","semicolonToken"],["continueKeyword","identifier","semicolonToken"],["forKeyword","openParenToken","variableDeclaration","initializer","firstSemicolonToken","condition","secondSemicolonToken","incrementor","closeParenToken","statement"],["forKeyword","openParenToken","variableDeclaration","left","inKeyword","expression","closeParenToken","statement"],["semicolonToken"],["throwKeyword","expression","semicolonToken"],["whileKeyword","openParenToken","condition","closeParenToken","statement"],["tryKeyword","block","catchClause","finallyClause"],["identifier","colonToken","statement"],["doKeyword","statement","whileKeyword","openParenToken","condition","closeParenToken","semicolonToken"],["debuggerKeyword","semicolonToken"],["withKeyword","openParenToken","condition","closeParenToken","statement"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["deleteKeyword","expression"],["typeOfKeyword","expression"],["voidKeyword","expression"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["condition","questionToken","whenTrue","colonToken","whenFalse"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["operand","operatorToken"],["operand","operatorToken"],["expression","dotToken","name"],["expression","argumentList"],["openBracketToken","expressions","closeBracketToken"],["openBraceToken","propertyAssignments","closeBraceToken"],["newKeyword","expression","argumentList"],["openParenToken","expression","closeParenToken"],["callSignature","equalsGreaterThanToken","block","expression"],["parameter","equalsGreaterThanToken","block","expression"],["lessThanToken","type","greaterThanToken","expression"],["expression","openBracketToken","argumentExpression","closeBracketToken"],["functionKeyword","identifier","callSignature","block"],[],["varKeyword","variableDeclarators"],["propertyName","typeAnnotation","equalsValueClause"],["typeArgumentList","openParenToken","arguments","closeParenToken"],["openParenToken","parameters","closeParenToken"],["lessThanToken","typeArguments","greaterThanToken"],["lessThanToken","typeParameters","greaterThanToken"],["extendsOrImplementsKeyword","typeNames"],["extendsOrImplementsKeyword","typeNames"],["equalsToken","value"],["caseKeyword","expression","colonToken","statements"],["defaultKeyword","colonToken","statements"],["elseKeyword","statement"],["catchKeyword","openParenToken","identifier","typeAnnotation","closeParenToken","block"],["finallyKeyword","block"],["identifier","constraint"],["extendsKeyword","typeOrExpression"],["propertyName","colonToken","expression"],["propertyName","callSignature","block"],["dotDotDotToken","modifiers","identifier","questionToken","typeAnnotation","equalsValueClause"],["propertyName","equalsValueClause"],["colonToken","type"],["requireKeyword","openParenToken","stringLiteral","closeParenToken"],["moduleName"],]; + export var nodeMetadata: string[][] = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],["moduleElements","endOfFileToken"],["left","dotToken","right"],["openBraceToken","typeMembers","closeBraceToken"],["typeParameterList","parameterList","equalsGreaterThanToken","type"],["type","openBracketToken","closeBracketToken"],["newKeyword","typeParameterList","parameterList","equalsGreaterThanToken","type"],["name","typeArgumentList"],["typeOfKeyword","name"],["openBracketToken","types","closeBracketToken"],["modifiers","interfaceKeyword","identifier","typeParameterList","heritageClauses","body"],["modifiers","functionKeyword","identifier","callSignature","block","semicolonToken"],["modifiers","moduleKeyword","name","stringLiteral","openBraceToken","moduleElements","closeBraceToken"],["modifiers","classKeyword","identifier","typeParameterList","heritageClauses","openBraceToken","classElements","closeBraceToken"],["modifiers","enumKeyword","identifier","openBraceToken","enumElements","closeBraceToken"],["modifiers","importKeyword","identifier","equalsToken","moduleReference","semicolonToken"],["exportKeyword","equalsToken","identifier","semicolonToken"],["modifiers","propertyName","callSignature","block","semicolonToken"],["modifiers","variableDeclarator","semicolonToken"],["modifiers","constructorKeyword","callSignature","block","semicolonToken"],["modifiers","indexSignature","semicolonToken"],["modifiers","getKeyword","propertyName","callSignature","block"],["modifiers","setKeyword","propertyName","callSignature","block"],["propertyName","questionToken","typeAnnotation"],["typeParameterList","parameterList","typeAnnotation"],["newKeyword","callSignature"],["openBracketToken","parameters","closeBracketToken","typeAnnotation"],["propertyName","questionToken","callSignature"],["openBraceToken","statements","closeBraceToken"],["ifKeyword","openParenToken","condition","closeParenToken","statement","elseClause"],["modifiers","variableDeclaration","semicolonToken"],["expression","semicolonToken"],["returnKeyword","expression","semicolonToken"],["switchKeyword","openParenToken","expression","closeParenToken","openBraceToken","switchClauses","closeBraceToken"],["breakKeyword","identifier","semicolonToken"],["continueKeyword","identifier","semicolonToken"],["forKeyword","openParenToken","variableDeclaration","initializer","firstSemicolonToken","condition","secondSemicolonToken","incrementor","closeParenToken","statement"],["forKeyword","openParenToken","variableDeclaration","left","inKeyword","expression","closeParenToken","statement"],["semicolonToken"],["throwKeyword","expression","semicolonToken"],["whileKeyword","openParenToken","condition","closeParenToken","statement"],["tryKeyword","block","catchClause","finallyClause"],["identifier","colonToken","statement"],["doKeyword","statement","whileKeyword","openParenToken","condition","closeParenToken","semicolonToken"],["debuggerKeyword","semicolonToken"],["withKeyword","openParenToken","condition","closeParenToken","statement"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["deleteKeyword","expression"],["typeOfKeyword","expression"],["voidKeyword","expression"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["condition","questionToken","whenTrue","colonToken","whenFalse"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["operand","operatorToken"],["operand","operatorToken"],["expression","dotToken","name"],["expression","argumentList"],["openBracketToken","expressions","closeBracketToken"],["openBraceToken","propertyAssignments","closeBraceToken"],["newKeyword","expression","argumentList"],["openParenToken","expression","closeParenToken"],["callSignature","equalsGreaterThanToken","block","expression"],["parameter","equalsGreaterThanToken","block","expression"],["lessThanToken","type","greaterThanToken","expression"],["expression","openBracketToken","argumentExpression","closeBracketToken"],["functionKeyword","identifier","callSignature","block"],[],["varKeyword","variableDeclarators"],["propertyName","typeAnnotation","equalsValueClause"],["typeArgumentList","openParenToken","arguments","closeParenToken"],["openParenToken","parameters","closeParenToken"],["lessThanToken","typeArguments","greaterThanToken"],["lessThanToken","typeParameters","greaterThanToken"],["extendsOrImplementsKeyword","typeNames"],["extendsOrImplementsKeyword","typeNames"],["equalsToken","value"],["caseKeyword","expression","colonToken","statements"],["defaultKeyword","colonToken","statements"],["elseKeyword","statement"],["catchKeyword","openParenToken","identifier","typeAnnotation","closeParenToken","block"],["finallyKeyword","block"],["identifier","constraint"],["extendsKeyword","typeOrExpression"],["propertyName","colonToken","expression"],["propertyName","callSignature","block"],["dotDotDotToken","modifiers","identifier","questionToken","typeAnnotation","equalsValueClause"],["propertyName","equalsValueClause"],["colonToken","type"],["requireKeyword","openParenToken","stringLiteral","closeParenToken"],["moduleName"],]; export module Syntax { export interface ISyntaxFactory { @@ -491,6 +496,7 @@ module TypeScript { ConstructorTypeSyntax: { new(data: number, newKeyword: ISyntaxToken, typeParameterList: TypeParameterListSyntax, parameterList: ParameterListSyntax, equalsGreaterThanToken: ISyntaxToken, type: ITypeSyntax): ConstructorTypeSyntax }; GenericTypeSyntax: { new(data: number, name: INameSyntax, typeArgumentList: TypeArgumentListSyntax): GenericTypeSyntax }; TypeQuerySyntax: { new(data: number, typeOfKeyword: ISyntaxToken, name: INameSyntax): TypeQuerySyntax }; + TupleTypeSyntax: { new(data: number, openBracketToken: ISyntaxToken, types: ITypeSyntax[], closeBracketToken: ISyntaxToken): TupleTypeSyntax }; InterfaceDeclarationSyntax: { new(data: number, modifiers: ISyntaxToken[], interfaceKeyword: ISyntaxToken, identifier: ISyntaxToken, typeParameterList: TypeParameterListSyntax, heritageClauses: HeritageClauseSyntax[], body: ObjectTypeSyntax): InterfaceDeclarationSyntax }; FunctionDeclarationSyntax: { new(data: number, modifiers: ISyntaxToken[], functionKeyword: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, block: BlockSyntax, semicolonToken: ISyntaxToken): FunctionDeclarationSyntax }; ModuleDeclarationSyntax: { new(data: number, modifiers: ISyntaxToken[], moduleKeyword: ISyntaxToken, name: INameSyntax, stringLiteral: ISyntaxToken, openBraceToken: ISyntaxToken, moduleElements: IModuleElementSyntax[], closeBraceToken: ISyntaxToken): ModuleDeclarationSyntax }; diff --git a/src/services/syntax/syntaxTree.ts b/src/services/syntax/syntaxTree.ts index de4c4cf7add..1e8ac95c483 100644 --- a/src/services/syntax/syntaxTree.ts +++ b/src/services/syntax/syntaxTree.ts @@ -239,7 +239,7 @@ module TypeScript { } private checkParameterAccessibilityModifier(parameterList: ParameterListSyntax, modifier: ISyntaxToken, modifierIndex: number): boolean { - if (modifier.kind() !== SyntaxKind.PublicKeyword && modifier.kind() !== SyntaxKind.PrivateKeyword) { + if (!SyntaxFacts.isAccessibilityModifier(modifier.kind())) { this.pushDiagnostic(modifier, DiagnosticCode._0_modifier_cannot_appear_on_a_parameter, [modifier.text()]); return true; } @@ -321,6 +321,15 @@ module TypeScript { super.visitTypeArgumentList(node); } + public visitTupleType(node: TupleTypeSyntax): void { + if (this.checkForTrailingComma(node.types) || + this.checkForAtLeastOneElement(node, node.types, node.openBracketToken, getLocalizedText(DiagnosticCode.type, null))) { + return + } + + super.visitTupleType(node); + } + public visitTypeParameterList(node: TypeParameterListSyntax): void { if (this.checkForTrailingComma(node.typeParameters) || this.checkForAtLeastOneElement(node, node.typeParameters, node.lessThanToken, getLocalizedText(DiagnosticCode.type_parameter, null))) { @@ -515,9 +524,7 @@ module TypeScript { for (var i = 0, n = list.length; i < n; i++) { var modifier = list[i]; - if (modifier.kind() === SyntaxKind.PublicKeyword || - modifier.kind() === SyntaxKind.PrivateKeyword) { - + if (SyntaxFacts.isAccessibilityModifier(modifier.kind())) { if (seenAccessibilityModifier) { this.pushDiagnostic(modifier, DiagnosticCode.Accessibility_modifier_already_seen); return true; @@ -752,8 +759,7 @@ module TypeScript { for (var i = 0, n = modifiers.length; i < n; i++) { var modifier = modifiers[i]; - if (modifier.kind() === SyntaxKind.PublicKeyword || - modifier.kind() === SyntaxKind.PrivateKeyword || + if (SyntaxFacts.isAccessibilityModifier(modifier.kind()) || modifier.kind() === SyntaxKind.StaticKeyword) { this.pushDiagnostic(modifier, DiagnosticCode._0_modifier_cannot_appear_on_a_module_element, [modifier.text()]); return true; diff --git a/src/services/syntax/syntaxTrivia.ts b/src/services/syntax/syntaxTrivia.ts index 1c8d79cf6bf..38e641d86f9 100644 --- a/src/services/syntax/syntaxTrivia.ts +++ b/src/services/syntax/syntaxTrivia.ts @@ -150,7 +150,6 @@ module TypeScript.Syntax { // When we run into a newline for the first time, create the string builder and copy // all the values up to this newline into it. - var isCarriageReturnLineFeed = false; switch (ch) { case CharacterCodes.carriageReturn: if (i < triviaText.length - 1 && triviaText.charCodeAt(i + 1) === CharacterCodes.lineFeed) { diff --git a/src/services/syntax/syntaxVisitor.generated.ts b/src/services/syntax/syntaxVisitor.generated.ts index 7081499105d..55aaef53255 100644 --- a/src/services/syntax/syntaxVisitor.generated.ts +++ b/src/services/syntax/syntaxVisitor.generated.ts @@ -13,6 +13,7 @@ module TypeScript { case SyntaxKind.ConstructorType: return visitor.visitConstructorType(element); case SyntaxKind.GenericType: return visitor.visitGenericType(element); case SyntaxKind.TypeQuery: return visitor.visitTypeQuery(element); + case SyntaxKind.TupleType: return visitor.visitTupleType(element); case SyntaxKind.InterfaceDeclaration: return visitor.visitInterfaceDeclaration(element); case SyntaxKind.FunctionDeclaration: return visitor.visitFunctionDeclaration(element); case SyntaxKind.ModuleDeclaration: return visitor.visitModuleDeclaration(element); @@ -109,6 +110,7 @@ module TypeScript { visitConstructorType(node: ConstructorTypeSyntax): any; visitGenericType(node: GenericTypeSyntax): any; visitTypeQuery(node: TypeQuerySyntax): any; + visitTupleType(node: TupleTypeSyntax): any; visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): any; visitFunctionDeclaration(node: FunctionDeclarationSyntax): any; visitModuleDeclaration(node: ModuleDeclarationSyntax): any; diff --git a/src/services/syntax/syntaxWalker.generated.ts b/src/services/syntax/syntaxWalker.generated.ts index 73f70f1834b..7b335709853 100644 --- a/src/services/syntax/syntaxWalker.generated.ts +++ b/src/services/syntax/syntaxWalker.generated.ts @@ -103,6 +103,12 @@ module TypeScript { this.visitNodeOrToken(node.name); } + public visitTupleType(node: TupleTypeSyntax): void { + this.visitToken(node.openBracketToken); + this.visitSeparatedList(node.types); + this.visitToken(node.closeBracketToken); + } + public visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): void { this.visitList(node.modifiers); this.visitToken(node.interfaceKeyword); diff --git a/src/services/text/scriptSnapshot.ts b/src/services/text/scriptSnapshot.ts index 1c7091d6cae..574657f6c40 100644 --- a/src/services/text/scriptSnapshot.ts +++ b/src/services/text/scriptSnapshot.ts @@ -1,26 +1,32 @@ /// module TypeScript { - // Represents an immutable snapshot of a script at a specified time. Once acquired, the - // snapshot is observably immutable. i.e. the same calls with the same parameters will return - // the same values. + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ export interface IScriptSnapshot { - // Get's a portion of the script snapshot specified by [start, end). + /** Gets a portion of the script snapshot specified by [start, end). */ getText(start: number, end: number): string; - // Get's the length of this script snapshot. + /** Gets the length of this script snapshot. */ getLength(): number; - // This call returns the array containing the start position of every line. - // i.e."[0, 10, 55]". TODO: consider making this optional. The language service could - // always determine this (albeit in a more expensive manner). + /** + * This call returns the array containing the start position of every line. + * i.e."[0, 10, 55]". TODO: consider making this optional. The language service could + * always determine this (albeit in a more expensive manner). + */ getLineStartPositions(): number[]; - // Gets the TextChangeRange that describe how the text changed between this text and - // an older version. This informatoin is used by the incremental parser to determine - // what sections of the script need to be reparsed. 'null' can be returned if the - // change range cannot be determined. However, in that case, incremental parsing will - // not happen and the entire document will be reparsed. + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; } diff --git a/src/services/text/textSpan.ts b/src/services/text/textSpan.ts index d719e244010..999070a73b4 100644 --- a/src/services/text/textSpan.ts +++ b/src/services/text/textSpan.ts @@ -1,6 +1,7 @@ /// module TypeScript { + export interface ISpan { start(): number; end(): number; diff --git a/src/services/utilities.ts b/src/services/utilities.ts new file mode 100644 index 00000000000..4ceb20fdcee --- /dev/null +++ b/src/services/utilities.ts @@ -0,0 +1,247 @@ +// These utilities are common to multiple language service features. +module ts { + export interface ListItemInfo { + listItemIndex: number; + list: Node; + } + + export function findListItemInfo(node: Node): ListItemInfo { + var syntaxList = findContainingList(node); + var children = syntaxList.getChildren(); + var index = indexOf(children, node); + + return { + listItemIndex: index, + list: syntaxList + }; + } + + export function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node { + return forEach(n.getChildren(sourceFile), c => c.kind === kind && c); + } + + export function findContainingList(node: Node): Node { + // The node might be a list element (nonsynthetic) or a comma (synthetic). Either way, it will + // be parented by the container of the SyntaxList, not the SyntaxList itself. + // In order to find the list item index, we first need to locate SyntaxList itself and then search + // for the position of the relevant node (or comma). + var syntaxList = forEach(node.parent.getChildren(), c => { + // find syntax list that covers the span of the node + if (c.kind === SyntaxKind.SyntaxList && c.pos <= node.pos && c.end >= node.end) { + return c; + } + }); + + // syntaxList should not be undefined here. If it is, there is a problem. Find out if + // there at least is a child that is a list. + if (!syntaxList) { + Debug.assert(findChildOfKind(node.parent, SyntaxKind.SyntaxList), + "Node of kind " + SyntaxKind[node.parent.kind] + " has no list children"); + } + + return syntaxList; + } + + /** + * Includes the start position of each child, but excludes the end. + */ + export function findListItemIndexContainingPosition(list: Node, position: number): number { + Debug.assert(list.kind === SyntaxKind.SyntaxList); + var children = list.getChildren(); + for (var i = 0; i < children.length; i++) { + if (children[i].pos <= position && children[i].end > position) { + return i; + } + } + + return -1; + } + + /* Gets the token whose text has range [start, end) and + * position >= start and (position < end or (position === end && token is keyword or identifier)) + */ + export function getTouchingWord(sourceFile: SourceFile, position: number): Node { + return getTouchingToken(sourceFile, position, isWord); + } + + /* Gets the token whose text has range [start, end) and position >= start + * and (position < end or (position === end && token is keyword or identifier or numeric\string litera)) + */ + export function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node { + return getTouchingToken(sourceFile, position, isPropertyName); + } + + /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */ + export function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean): Node { + return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ false, includeItemAtEndPosition); + } + + /** Returns a token if position is in [start-of-leading-trivia, end) */ + export function getTokenAtPosition(sourceFile: SourceFile, position: number): Node { + return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ true, /*includeItemAtEndPosition*/ undefined); + } + + /** Get the token whose text contains the position */ + function getTokenAtPositionWorker(sourceFile: SourceFile, position: number, allowPositionInLeadingTrivia: boolean, includeItemAtEndPosition: (n: Node) => boolean): Node { + var current: Node = sourceFile; + outer: while (true) { + if (isToken(current)) { + // exit early + return current; + } + + // find the child that contains 'position' + for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { + var child = current.getChildAt(i); + var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile); + if (start <= position) { + if (position < child.getEnd()) { + current = child; + continue outer; + } + else if (includeItemAtEndPosition && child.getEnd() === position) { + var previousToken = findPrecedingToken(position, sourceFile, child); + if (previousToken && includeItemAtEndPosition(previousToken)) { + return previousToken; + } + } + } + } + return current; + } + } + + /** + * The token on the left of the position is the token that strictly includes the position + * or sits to the left of the cursor if it is on a boundary. For example + * + * fo|o -> will return foo + * foo |bar -> will return foo + * + */ + export function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node { + // Ideally, getTokenAtPosition should return a token. However, it is currently + // broken, so we do a check to make sure the result was indeed a token. + var tokenAtPosition = getTokenAtPosition(file, position); + if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + return tokenAtPosition; + } + + return findPrecedingToken(position, file); + } + + export function findNextToken(previousToken: Node, parent: Node): Node { + return find(parent); + + function find(n: Node): Node { + if (isToken(n) && n.pos === previousToken.end) { + // this is token that starts at the end of previous token - return it + return n; + } + + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; ++i) { + var child = children[i]; + var shouldDiveInChildNode = + // previous token is enclosed somewhere in the child + (child.pos <= previousToken.pos && child.end > previousToken.end) || + // previous token ends exactly at the beginning of child + (child.pos === previousToken.end); + + if (shouldDiveInChildNode && nodeHasTokens(child)) { + return find(child); + } + } + + return undefined; + } + } + + export function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node { + return find(startNode || sourceFile); + + function findRightmostToken(n: Node): Node { + if (isToken(n)) { + return n; + } + + var children = n.getChildren(); + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); + return candidate && findRightmostToken(candidate); + + } + + function find(n: Node): Node { + if (isToken(n)) { + return n; + } + + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; ++i) { + var child = children[i]; + if (nodeHasTokens(child)) { + if (position < child.end) { + if (child.getStart(sourceFile) >= position) { + // actual start of the node is past the position - previous token should be at the end of previous child + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); + return candidate && findRightmostToken(candidate) + } + else { + // candidate should be in this node + return find(child); + } + } + } + } + + Debug.assert(startNode || n.kind === SyntaxKind.SourceFile); + + // Here we know that none of child token nodes embrace the position, + // the only known case is when position is at the end of the file. + // Try to find the rightmost token in the file without filtering. + // Namely we are skipping the check: 'position < node.end' + if (children.length) { + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); + return candidate && findRightmostToken(candidate); + } + } + + /// finds last node that is considered as candidate for search (isCandidate(node) === true) starting from 'exclusiveStartPosition' + function findRightmostChildNodeWithTokens(children: Node[], exclusiveStartPosition: number): Node { + for (var i = exclusiveStartPosition - 1; i >= 0; --i) { + if (nodeHasTokens(children[i])) { + return children[i]; + } + } + } + } + + function nodeHasTokens(n: Node): boolean { + if (n.kind === SyntaxKind.ExpressionStatement) { + return nodeHasTokens((n).expression); + } + + if (n.kind === SyntaxKind.EndOfFileToken || n.kind === SyntaxKind.OmittedExpression || n.kind === SyntaxKind.Missing) { + return false; + } + + // SyntaxList is already realized so getChildCount should be fast and non-expensive + return n.kind !== SyntaxKind.SyntaxList || n.getChildCount() !== 0; + } + + export function isToken(n: Node): boolean { + return n.kind >= SyntaxKind.FirstToken && n.kind <= SyntaxKind.LastToken; + } + + function isKeyword(n: Node): boolean { + return n.kind >= SyntaxKind.FirstKeyword && n.kind <= SyntaxKind.LastKeyword; + } + + function isWord(n: Node): boolean { + return n.kind === SyntaxKind.Identifier || isKeyword(n); + } + + function isPropertyName(n: Node): boolean { + return n.kind === SyntaxKind.StringLiteral || n.kind === SyntaxKind.NumericLiteral || isWord(n); + } +} \ No newline at end of file diff --git a/tests/baselines/reference/ArrowFunction1.errors.txt b/tests/baselines/reference/ArrowFunction1.errors.txt index ed868daec13..96f77039224 100644 --- a/tests/baselines/reference/ArrowFunction1.errors.txt +++ b/tests/baselines/reference/ArrowFunction1.errors.txt @@ -1,6 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction1.ts(1,13): error TS1110: Type expected. + + ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction1.ts (1 errors) ==== var v = (a: ) => { ~ -!!! Type expected. +!!! error TS1110: Type expected. }; \ No newline at end of file diff --git a/tests/baselines/reference/ArrowFunction2.errors.txt b/tests/baselines/reference/ArrowFunction2.errors.txt index eef47a30ba2..26e1f336cb6 100644 --- a/tests/baselines/reference/ArrowFunction2.errors.txt +++ b/tests/baselines/reference/ArrowFunction2.errors.txt @@ -1,8 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,13): error TS2304: Cannot find name 'b'. + + ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts (2 errors) ==== var v = (a: b,) => { ~ -!!! Trailing comma not allowed. +!!! error TS1009: Trailing comma not allowed. ~ -!!! Cannot find name 'b'. +!!! error TS2304: Cannot find name 'b'. }; \ No newline at end of file diff --git a/tests/baselines/reference/ArrowFunction3.errors.txt b/tests/baselines/reference/ArrowFunction3.errors.txt index a286116ff29..be20d77c343 100644 --- a/tests/baselines/reference/ArrowFunction3.errors.txt +++ b/tests/baselines/reference/ArrowFunction3.errors.txt @@ -1,10 +1,15 @@ +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,12): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,14): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,10): error TS2304: Cannot find name 'a'. + + ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts (3 errors) ==== var v = (a): => { ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Cannot find name 'a'. +!!! error TS2304: Cannot find name 'a'. }; \ No newline at end of file diff --git a/tests/baselines/reference/ArrowFunctionExpression1.errors.txt b/tests/baselines/reference/ArrowFunctionExpression1.errors.txt index 25c9af3d286..593b75d4ee2 100644 --- a/tests/baselines/reference/ArrowFunctionExpression1.errors.txt +++ b/tests/baselines/reference/ArrowFunctionExpression1.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/ArrowFunctionExpression1.ts(1,10): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/ArrowFunctionExpression1.ts (1 errors) ==== var v = (public x: string) => { }; ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. \ No newline at end of file +!!! error TS2369: A parameter property is only allowed in a constructor implementation. \ No newline at end of file diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.errors.txt index f7d6aafc017..aa97ca3caa5 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.errors.txt +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.errors.txt @@ -1,3 +1,10 @@ +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(10,19): error TS2304: Cannot find name 'T'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(20,12): error TS2304: Cannot find name 'T'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(22,23): error TS2304: Cannot find name 'T'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(35,26): error TS2304: Cannot find name 'T'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(46,15): error TS2304: Cannot find name 'T'. + + ==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts (5 errors) ==== // all expected to be errors @@ -10,7 +17,7 @@ module clodule1 { function f(x: T) { } ~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. } class clodule2{ @@ -22,11 +29,11 @@ module clodule2 { var x: T; ~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. class D{ ~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. id: string; value: U; } @@ -41,7 +48,7 @@ module clodule3 { export var y = { id: T }; ~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. } class clodule4{ @@ -54,7 +61,7 @@ class D { name: T; ~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. } } \ No newline at end of file diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.errors.txt index dad412363f7..d200258fdb1 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.errors.txt +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.errors.txt @@ -1,16 +1,22 @@ -==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts (1 errors) ==== +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts(5,12): error TS2300: Duplicate identifier 'fn'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts(10,21): error TS2300: Duplicate identifier 'fn'. + + +==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts (2 errors) ==== class clodule { id: string; value: T; static fn(id: U) { } + ~~ +!!! error TS2300: Duplicate identifier 'fn'. } module clodule { // error: duplicate identifier expected export function fn(x: T, y: T): T { ~~ -!!! Duplicate identifier 'fn'. +!!! error TS2300: Duplicate identifier 'fn'. return x; } } diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.errors.txt index c45ffab4156..474613e283f 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.errors.txt +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.errors.txt @@ -1,16 +1,22 @@ -==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts (1 errors) ==== +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts(5,12): error TS2300: Duplicate identifier 'fn'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts(10,21): error TS2300: Duplicate identifier 'fn'. + + +==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts (2 errors) ==== class clodule { id: string; value: T; static fn(id: string) { } + ~~ +!!! error TS2300: Duplicate identifier 'fn'. } module clodule { // error: duplicate identifier expected export function fn(x: T, y: T): T { ~~ -!!! Duplicate identifier 'fn'. +!!! error TS2300: Duplicate identifier 'fn'. return x; } } diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt index c38333f9732..3feee7069d0 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts(11,16): error TS2341: Property 'sfn' is private and only accessible within class 'clodule'. + + ==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts (1 errors) ==== class clodule { id: string; @@ -11,7 +14,7 @@ export function fn(x: T, y: T): number { return clodule.sfn('a'); ~~~~~~~~~~~ -!!! Property 'clodule.sfn' is inaccessible. +!!! error TS2341: Property 'sfn' is private and only accessible within class 'clodule'. } } diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.errors.txt index eb2ef95f795..a59953e7fb2 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.errors.txt +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.errors.txt @@ -1,14 +1,22 @@ -==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts (2 errors) ==== +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts(4,12): error TS2300: Duplicate identifier 'Origin'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts(8,21): error TS2300: Duplicate identifier 'Origin'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts(16,16): error TS2300: Duplicate identifier 'Origin'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts(20,25): error TS2300: Duplicate identifier 'Origin'. + + +==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts (4 errors) ==== class Point { constructor(public x: number, public y: number) { } static Origin(): Point { return { x: 0, y: 0 }; } // unexpected error here bug 840246 + ~~~~~~ +!!! error TS2300: Duplicate identifier 'Origin'. } module Point { export function Origin() { return null; } //expected duplicate identifier error ~~~~~~ -!!! Duplicate identifier 'Origin'. +!!! error TS2300: Duplicate identifier 'Origin'. } @@ -17,11 +25,13 @@ constructor(public x: number, public y: number) { } static Origin(): Point { return { x: 0, y: 0 }; } // unexpected error here bug 840246 + ~~~~~~ +!!! error TS2300: Duplicate identifier 'Origin'. } export module Point { export function Origin() { return ""; }//expected duplicate identifier error ~~~~~~ -!!! Duplicate identifier 'Origin'. +!!! error TS2300: Duplicate identifier 'Origin'. } } \ No newline at end of file diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.errors.txt index ad395751ebf..88ad9f358be 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.errors.txt +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.errors.txt @@ -1,14 +1,22 @@ -==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts (2 errors) ==== +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts(4,12): error TS2300: Duplicate identifier 'Origin'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts(8,16): error TS2300: Duplicate identifier 'Origin'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts(16,16): error TS2300: Duplicate identifier 'Origin'. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts(20,20): error TS2300: Duplicate identifier 'Origin'. + + +==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts (4 errors) ==== class Point { constructor(public x: number, public y: number) { } static Origin: Point = { x: 0, y: 0 }; + ~~~~~~ +!!! error TS2300: Duplicate identifier 'Origin'. } module Point { export var Origin = ""; //expected duplicate identifier error ~~~~~~ -!!! Duplicate identifier 'Origin'. +!!! error TS2300: Duplicate identifier 'Origin'. } @@ -17,11 +25,13 @@ constructor(public x: number, public y: number) { } static Origin: Point = { x: 0, y: 0 }; + ~~~~~~ +!!! error TS2300: Duplicate identifier 'Origin'. } export module Point { export var Origin = ""; //expected duplicate identifier error ~~~~~~ -!!! Duplicate identifier 'Origin'. +!!! error TS2300: Duplicate identifier 'Origin'. } } \ No newline at end of file diff --git a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.errors.txt index d47fc51f4e8..4c707dfd861 100644 --- a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged + + ==== tests/cases/conformance/internalModules/DeclarationMerging/class.ts (0 errors) ==== module X.Y { export class Point { @@ -14,7 +17,7 @@ module X.Y { export module Point { ~~~~~ -!!! A module declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged export var Origin = new Point(0, 0); } } diff --git a/tests/baselines/reference/ClassDeclaration10.errors.txt b/tests/baselines/reference/ClassDeclaration10.errors.txt index be26c1d5b47..4d195961f81 100644 --- a/tests/baselines/reference/ClassDeclaration10.errors.txt +++ b/tests/baselines/reference/ClassDeclaration10.errors.txt @@ -1,9 +1,13 @@ +tests/cases/compiler/ClassDeclaration10.ts(2,4): error TS2390: Constructor implementation is missing. +tests/cases/compiler/ClassDeclaration10.ts(3,4): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/ClassDeclaration10.ts (2 errors) ==== class C { constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation is missing. +!!! error TS2390: Constructor implementation is missing. foo(); ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration11.errors.txt b/tests/baselines/reference/ClassDeclaration11.errors.txt index b92a04cec6c..518e62803ea 100644 --- a/tests/baselines/reference/ClassDeclaration11.errors.txt +++ b/tests/baselines/reference/ClassDeclaration11.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/ClassDeclaration11.ts(2,4): error TS2390: Constructor implementation is missing. + + ==== tests/cases/compiler/ClassDeclaration11.ts (1 errors) ==== class C { constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation is missing. +!!! error TS2390: Constructor implementation is missing. foo() { } } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration13.errors.txt b/tests/baselines/reference/ClassDeclaration13.errors.txt index 406d41c20de..7b001022d9d 100644 --- a/tests/baselines/reference/ClassDeclaration13.errors.txt +++ b/tests/baselines/reference/ClassDeclaration13.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/ClassDeclaration13.ts(3,4): error TS2389: Function implementation name must be 'foo'. + + ==== tests/cases/compiler/ClassDeclaration13.ts (1 errors) ==== class C { foo(); bar() { } ~~~ -!!! Function implementation name must be 'foo'. +!!! error TS2389: Function implementation name must be 'foo'. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration14.errors.txt b/tests/baselines/reference/ClassDeclaration14.errors.txt index cf181a7eb8b..af87daef997 100644 --- a/tests/baselines/reference/ClassDeclaration14.errors.txt +++ b/tests/baselines/reference/ClassDeclaration14.errors.txt @@ -1,9 +1,13 @@ +tests/cases/compiler/ClassDeclaration14.ts(2,4): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/ClassDeclaration14.ts(3,4): error TS2390: Constructor implementation is missing. + + ==== tests/cases/compiler/ClassDeclaration14.ts (2 errors) ==== class C { foo(); ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation is missing. +!!! error TS2390: Constructor implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration15.errors.txt b/tests/baselines/reference/ClassDeclaration15.errors.txt index 08c33f18758..27cd8f9aa4d 100644 --- a/tests/baselines/reference/ClassDeclaration15.errors.txt +++ b/tests/baselines/reference/ClassDeclaration15.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/ClassDeclaration15.ts(2,4): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/ClassDeclaration15.ts (1 errors) ==== class C { foo(); ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. constructor() { } } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration21.errors.txt b/tests/baselines/reference/ClassDeclaration21.errors.txt index 8b49f1df543..36dc01d75d0 100644 --- a/tests/baselines/reference/ClassDeclaration21.errors.txt +++ b/tests/baselines/reference/ClassDeclaration21.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/ClassDeclaration21.ts(3,5): error TS2389: Function implementation name must be '0'. + + ==== tests/cases/compiler/ClassDeclaration21.ts (1 errors) ==== class C { 0(); 1() { } ~ -!!! Function implementation name must be '0'. +!!! error TS2389: Function implementation name must be '0'. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration22.errors.txt b/tests/baselines/reference/ClassDeclaration22.errors.txt index 34832185e12..a297ae82596 100644 --- a/tests/baselines/reference/ClassDeclaration22.errors.txt +++ b/tests/baselines/reference/ClassDeclaration22.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/ClassDeclaration22.ts(3,5): error TS2389: Function implementation name must be '"foo"'. + + ==== tests/cases/compiler/ClassDeclaration22.ts (1 errors) ==== class C { "foo"(); "bar"() { } ~~~~~ -!!! Function implementation name must be '"foo"'. +!!! error TS2389: Function implementation name must be '"foo"'. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration24.errors.txt b/tests/baselines/reference/ClassDeclaration24.errors.txt index a64ad658991..62d26eb792a 100644 --- a/tests/baselines/reference/ClassDeclaration24.errors.txt +++ b/tests/baselines/reference/ClassDeclaration24.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/ClassDeclaration24.ts(1,7): error TS2414: Class name cannot be 'any' + + ==== tests/cases/compiler/ClassDeclaration24.ts (1 errors) ==== class any { ~~~ -!!! Class name cannot be 'any' +!!! error TS2414: Class name cannot be 'any' } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration25.errors.txt b/tests/baselines/reference/ClassDeclaration25.errors.txt index 3a73349506e..964974481d6 100644 --- a/tests/baselines/reference/ClassDeclaration25.errors.txt +++ b/tests/baselines/reference/ClassDeclaration25.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/ClassDeclaration25.ts(6,5): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/ClassDeclaration25.ts(7,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/ClassDeclaration25.ts (2 errors) ==== interface IList { data(): T; @@ -6,9 +10,9 @@ class List implements IList { data(): U; ~~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. next(): string; ~~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration8.errors.txt b/tests/baselines/reference/ClassDeclaration8.errors.txt index ebf1cadd764..3894c91bdc8 100644 --- a/tests/baselines/reference/ClassDeclaration8.errors.txt +++ b/tests/baselines/reference/ClassDeclaration8.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/ClassDeclaration8.ts(2,3): error TS2390: Constructor implementation is missing. + + ==== tests/cases/compiler/ClassDeclaration8.ts (1 errors) ==== class C { constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation is missing. +!!! error TS2390: Constructor implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration9.errors.txt b/tests/baselines/reference/ClassDeclaration9.errors.txt index 03813d14683..7f13d41001a 100644 --- a/tests/baselines/reference/ClassDeclaration9.errors.txt +++ b/tests/baselines/reference/ClassDeclaration9.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/ClassDeclaration9.ts(2,4): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/ClassDeclaration9.ts (1 errors) ==== class C { foo(); ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/ExportAssignment7.errors.txt b/tests/baselines/reference/ExportAssignment7.errors.txt index ff05fb7eda0..6ba0f480e7f 100644 --- a/tests/baselines/reference/ExportAssignment7.errors.txt +++ b/tests/baselines/reference/ExportAssignment7.errors.txt @@ -1,11 +1,16 @@ +tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/ExportAssignment7.ts(4,1): error TS2304: Cannot find name 'B'. +tests/cases/compiler/ExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + ==== tests/cases/compiler/ExportAssignment7.ts (3 errors) ==== export class C { ~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. } export = B; ~~~~~~~~~~~ -!!! Cannot find name 'B'. +!!! error TS2304: Cannot find name 'B'. ~~~~~~~~~~~ -!!! An export assignment cannot be used in a module with other exported elements. \ No newline at end of file +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/tests/baselines/reference/ExportAssignment8.errors.txt b/tests/baselines/reference/ExportAssignment8.errors.txt index 2f1d1f5b960..4dc35a9f0b7 100644 --- a/tests/baselines/reference/ExportAssignment8.errors.txt +++ b/tests/baselines/reference/ExportAssignment8.errors.txt @@ -1,11 +1,16 @@ +tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/ExportAssignment8.ts(1,1): error TS2304: Cannot find name 'B'. +tests/cases/compiler/ExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + ==== tests/cases/compiler/ExportAssignment8.ts (3 errors) ==== export = B; ~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ~~~~~~~~~~~ -!!! Cannot find name 'B'. +!!! error TS2304: Cannot find name 'B'. ~~~~~~~~~~~ -!!! An export assignment cannot be used in a module with other exported elements. +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. export class C { } \ No newline at end of file diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt index b56c3a9fe93..81798538bb7 100644 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(8,27): error TS1005: ';' expected. +tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(8,43): error TS1005: ';' expected. +tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(9,30): error TS1005: ';' expected. + + ==== tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts (3 errors) ==== module A { @@ -8,11 +13,11 @@ export var UnitSquare : { top: { left: Point, right: Point }, ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. bottom: { left: Point, right: Point } ~ -!!! ';' expected. +!!! error TS1005: ';' expected. } = null; } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt index 1a9ea82a006..df266681812 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged +tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. +tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. + + ==== tests/cases/conformance/internalModules/DeclarationMerging/function.ts (0 errors) ==== module A { export function Point() { @@ -9,7 +14,7 @@ module A { export module Point { ~~~~~ -!!! A module declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged export var Origin = { x: 0, y: 0 }; } } @@ -18,7 +23,7 @@ var fn: () => { x: number; y: number }; var fn = A.Point; ~~ -!!! Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. var cl: { x: number; y: number; } var cl = A.Point(); @@ -40,7 +45,7 @@ var fn: () => { x: number; y: number }; var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected ~~ -!!! Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. var cl: { x: number; y: number; } var cl = B.Point(); diff --git a/tests/baselines/reference/FunctionDeclaration3.errors.txt b/tests/baselines/reference/FunctionDeclaration3.errors.txt index 40a51283449..648d2a7ff79 100644 --- a/tests/baselines/reference/FunctionDeclaration3.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration3.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/FunctionDeclaration3.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/FunctionDeclaration3.ts (1 errors) ==== function foo(); ~~~ -!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file +!!! error TS2391: Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration4.errors.txt b/tests/baselines/reference/FunctionDeclaration4.errors.txt index da15ad0efa4..a744ac9bfd5 100644 --- a/tests/baselines/reference/FunctionDeclaration4.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration4.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/FunctionDeclaration4.ts(2,10): error TS2389: Function implementation name must be 'foo'. + + ==== tests/cases/compiler/FunctionDeclaration4.ts (1 errors) ==== function foo(); function bar() { } ~~~ -!!! Function implementation name must be 'foo'. \ No newline at end of file +!!! error TS2389: Function implementation name must be 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration6.errors.txt b/tests/baselines/reference/FunctionDeclaration6.errors.txt index c7e039cac13..89f9aff9ca7 100644 --- a/tests/baselines/reference/FunctionDeclaration6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration6.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/FunctionDeclaration6.ts(3,14): error TS2389: Function implementation name must be 'foo'. + + ==== tests/cases/compiler/FunctionDeclaration6.ts (1 errors) ==== { function foo(); function bar() { } ~~~ -!!! Function implementation name must be 'foo'. +!!! error TS2389: Function implementation name must be 'foo'. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration7.errors.txt b/tests/baselines/reference/FunctionDeclaration7.errors.txt index fcc48feb2d8..8f8230fe73e 100644 --- a/tests/baselines/reference/FunctionDeclaration7.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration7.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/FunctionDeclaration7.ts(2,13): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/FunctionDeclaration7.ts (1 errors) ==== module M { function foo(); ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/InterfaceDeclaration8.errors.txt b/tests/baselines/reference/InterfaceDeclaration8.errors.txt index eba4ccd7023..e916947d2bd 100644 --- a/tests/baselines/reference/InterfaceDeclaration8.errors.txt +++ b/tests/baselines/reference/InterfaceDeclaration8.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/InterfaceDeclaration8.ts(1,11): error TS2427: Interface name cannot be 'string' + + ==== tests/cases/compiler/InterfaceDeclaration8.ts (1 errors) ==== interface string { ~~~~~~ -!!! Interface name cannot be 'string' +!!! error TS2427: Interface name cannot be 'string' } \ No newline at end of file diff --git a/tests/baselines/reference/InvalidNonInstantiatedModule.errors.txt b/tests/baselines/reference/InvalidNonInstantiatedModule.errors.txt index c32511eba0d..9fd7043faa6 100644 --- a/tests/baselines/reference/InvalidNonInstantiatedModule.errors.txt +++ b/tests/baselines/reference/InvalidNonInstantiatedModule.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts(5,9): error TS2304: Cannot find name 'M'. +tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts(7,15): error TS2304: Cannot find name 'M'. + + ==== tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts (2 errors) ==== module M { export interface Point { x: number; y: number } @@ -5,9 +9,9 @@ var m = M; // Error, not instantiated can not be used as var ~ -!!! Cannot find name 'M'. +!!! error TS2304: Cannot find name 'M'. var x: typeof M; // Error only a namespace ~ -!!! Cannot find name 'M'. +!!! error TS2304: Cannot find name 'M'. \ No newline at end of file diff --git a/tests/baselines/reference/MemberAccessorDeclaration15.errors.txt b/tests/baselines/reference/MemberAccessorDeclaration15.errors.txt index c96547e0aa7..6ed8a2d29cd 100644 --- a/tests/baselines/reference/MemberAccessorDeclaration15.errors.txt +++ b/tests/baselines/reference/MemberAccessorDeclaration15.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/MemberAccessorDeclaration15.ts(2,8): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/MemberAccessorDeclaration15.ts(2,12): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/MemberAccessorDeclaration15.ts (2 errors) ==== class C { set Foo(public a: number) { } ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt index f8e4561e9a7..15a0e5b4334 100644 --- a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt @@ -1,8 +1,12 @@ +tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged +tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged + + ==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ==== module X.Y { export module Point { ~~~~~ -!!! A module declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged export var Origin = new Point(0, 0); } } @@ -23,7 +27,7 @@ ==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (1 errors) ==== module A { ~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged export var Instance = new A(); } diff --git a/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.errors.txt index 707e0dec513..7c521c8be95 100644 --- a/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.errors.txt @@ -1,8 +1,12 @@ +tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged +tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged + + ==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ==== module A { export module Point { ~~~~~ -!!! A module declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged export var Origin = { x: 0, y: 0 }; } } @@ -20,7 +24,7 @@ export module Point { ~~~~~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged export var Origin = { x: 0, y: 0 }; } diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.errors.txt b/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.errors.txt index d87dbe1a163..8f9bfe03ecd 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.errors.txt +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses.ts(30,16): error TS2339: Property 'A2' does not exist on type 'typeof A'. +tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses.ts(31,17): error TS2339: Property 'A2' does not exist on type 'typeof A'. + + ==== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses.ts (2 errors) ==== module A { export class A { @@ -30,9 +34,9 @@ // errors expected, these are not exported var a2 = new A.A2(); ~~ -!!! Property 'A2' does not exist on type 'typeof A'. +!!! error TS2339: Property 'A2' does not exist on type 'typeof A'. var ag2 = new A.A2(); ~~ -!!! Property 'A2' does not exist on type 'typeof A'. +!!! error TS2339: Property 'A2' does not exist on type 'typeof A'. \ No newline at end of file diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.errors.txt b/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.errors.txt index 59cbd67c916..3484d426d2f 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.errors.txt +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums.ts(10,11): error TS2339: Property 'Day' does not exist on type 'typeof A'. + + ==== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums.ts (1 errors) ==== module A { export enum Color { Red, Blue } @@ -10,5 +13,5 @@ // error not exported var b = A.Day.Monday; ~~~ -!!! Property 'Day' does not exist on type 'typeof A'. +!!! error TS2339: Property 'Day' does not exist on type 'typeof A'. \ No newline at end of file diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt b/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt index dc3b4833463..96528577cbc 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts(28,13): error TS2339: Property 'fn2' does not exist on type 'typeof A'. +tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts(29,14): error TS2339: Property 'fng2' does not exist on type 'typeof A'. + + ==== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts (2 errors) ==== module A { @@ -28,7 +32,7 @@ // these should be errors since the functions are not exported var fn2 = A.fn2; ~~~ -!!! Property 'fn2' does not exist on type 'typeof A'. +!!! error TS2339: Property 'fn2' does not exist on type 'typeof A'. var fng2 = A.fng2; ~~~~ -!!! Property 'fng2' does not exist on type 'typeof A'. \ No newline at end of file +!!! error TS2339: Property 'fng2' does not exist on type 'typeof A'. \ No newline at end of file diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.errors.txt b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.errors.txt index 07233c96782..b6454411858 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.errors.txt +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedImportAlias.ts(37,21): error TS2339: Property 'Lines' does not exist on type 'typeof Geometry'. + + ==== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedImportAlias.ts (1 errors) ==== module A { export interface Point { @@ -37,6 +40,6 @@ // not expected to work since non are exported var line = Geometry.Lines.Line; ~~~~~ -!!! Property 'Lines' does not exist on type 'typeof Geometry'. +!!! error TS2339: Property 'Lines' does not exist on type 'typeof Geometry'. \ No newline at end of file diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedVariables.errors.txt b/tests/baselines/reference/ModuleWithExportedAndNonExportedVariables.errors.txt index 737ec677339..fa4c9e57c08 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedVariables.errors.txt +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedVariables.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedVariables.ts(11,11): error TS2339: Property 'y' does not exist on type 'typeof A'. + + ==== tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedVariables.ts (1 errors) ==== module A { export var x = 'hello world' @@ -11,5 +14,5 @@ // Error, since y is not exported var y = A.y; ~ -!!! Property 'y' does not exist on type 'typeof A'. +!!! error TS2339: Property 'y' does not exist on type 'typeof A'. \ No newline at end of file diff --git a/tests/baselines/reference/ParameterList13.errors.txt b/tests/baselines/reference/ParameterList13.errors.txt index 63f41b0e230..13bffe4328f 100644 --- a/tests/baselines/reference/ParameterList13.errors.txt +++ b/tests/baselines/reference/ParameterList13.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/ParameterList13.ts(2,10): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/ParameterList13.ts (1 errors) ==== interface I { new (public x); ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/ParameterList4.errors.txt b/tests/baselines/reference/ParameterList4.errors.txt index e669cbfec68..1d1b0092674 100644 --- a/tests/baselines/reference/ParameterList4.errors.txt +++ b/tests/baselines/reference/ParameterList4.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/ParameterList4.ts(1,12): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/ParameterList4.ts (1 errors) ==== function F(public A) { ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/ParameterList5.errors.txt b/tests/baselines/reference/ParameterList5.errors.txt index 412fb71eb14..02b86633b95 100644 --- a/tests/baselines/reference/ParameterList5.errors.txt +++ b/tests/baselines/reference/ParameterList5.errors.txt @@ -1,9 +1,14 @@ +tests/cases/compiler/ParameterList5.ts(1,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +tests/cases/compiler/ParameterList5.ts(1,16): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/ParameterList5.ts(1,29): error TS2304: Cannot find name 'C'. + + ==== tests/cases/compiler/ParameterList5.ts (3 errors) ==== function A(): (public B) => C { ~~~~~~~~~~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~ -!!! Cannot find name 'C'. +!!! error TS2304: Cannot find name 'C'. } \ No newline at end of file diff --git a/tests/baselines/reference/ParameterList6.errors.txt b/tests/baselines/reference/ParameterList6.errors.txt index c7037a3bb9a..b938b7cb52f 100644 --- a/tests/baselines/reference/ParameterList6.errors.txt +++ b/tests/baselines/reference/ParameterList6.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/ParameterList6.ts(2,19): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/ParameterList6.ts (1 errors) ==== class C { constructor(C: (public A) => any) { ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } } \ No newline at end of file diff --git a/tests/baselines/reference/ParameterList7.errors.txt b/tests/baselines/reference/ParameterList7.errors.txt index 6179eff50c7..a2b28391a67 100644 --- a/tests/baselines/reference/ParameterList7.errors.txt +++ b/tests/baselines/reference/ParameterList7.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/ParameterList7.ts(2,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/ParameterList7.ts(3,14): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/ParameterList7.ts (2 errors) ==== class C1 { constructor(public p1:string); // ERROR ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. constructor(private p2:number); // ERROR ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. constructor(public p3:any) {} // OK } \ No newline at end of file diff --git a/tests/baselines/reference/ParameterList8.errors.txt b/tests/baselines/reference/ParameterList8.errors.txt index 950dfaaffa4..f49a1359992 100644 --- a/tests/baselines/reference/ParameterList8.errors.txt +++ b/tests/baselines/reference/ParameterList8.errors.txt @@ -1,12 +1,17 @@ +tests/cases/compiler/ParameterList8.ts(2,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/ParameterList8.ts(3,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/ParameterList8.ts(4,14): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/ParameterList8.ts (3 errors) ==== declare class C2 { constructor(public p1:string); // ERROR ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. constructor(private p2:number); // ERROR ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. constructor(public p3:any); // ERROR ~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/Protected1.errors.txt b/tests/baselines/reference/Protected1.errors.txt new file mode 100644 index 00000000000..561e4cfd001 --- /dev/null +++ b/tests/baselines/reference/Protected1.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts (1 errors) ==== + protected class C { + ~~~~~~~~~ +!!! error TS1044: 'protected' modifier cannot appear on a module element. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected2.errors.txt b/tests/baselines/reference/Protected2.errors.txt new file mode 100644 index 00000000000..0f6de4d49ed --- /dev/null +++ b/tests/baselines/reference/Protected2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts (1 errors) ==== + protected module M { + ~~~~~~~~~ +!!! error TS1044: 'protected' modifier cannot appear on a module element. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected3.errors.txt b/tests/baselines/reference/Protected3.errors.txt new file mode 100644 index 00000000000..688422a1e0f --- /dev/null +++ b/tests/baselines/reference/Protected3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,3): error TS1089: 'protected' modifier cannot appear on a constructor declaration. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts (1 errors) ==== + class C { + protected constructor() { } + ~~~~~~~~~ +!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected4.errors.txt b/tests/baselines/reference/Protected4.errors.txt new file mode 100644 index 00000000000..fa4f410ab6b --- /dev/null +++ b/tests/baselines/reference/Protected4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,13): error TS1028: Accessibility modifier already seen. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts (1 errors) ==== + class C { + protected public m() { } + ~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected5.js b/tests/baselines/reference/Protected5.js new file mode 100644 index 00000000000..8834cc488cb --- /dev/null +++ b/tests/baselines/reference/Protected5.js @@ -0,0 +1,13 @@ +//// [Protected5.ts] +class C { + protected static m() { } +} + +//// [Protected5.js] +var C = (function () { + function C() { + } + C.m = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/Protected5.types b/tests/baselines/reference/Protected5.types new file mode 100644 index 00000000000..7ef0be949a7 --- /dev/null +++ b/tests/baselines/reference/Protected5.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts === +class C { +>C : C + + protected static m() { } +>m : () => void +} diff --git a/tests/baselines/reference/Protected6.errors.txt b/tests/baselines/reference/Protected6.errors.txt new file mode 100644 index 00000000000..3b3804b0fb1 --- /dev/null +++ b/tests/baselines/reference/Protected6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,10): error TS1029: 'protected' modifier must precede 'static' modifier. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts (1 errors) ==== + class C { + static protected m() { } + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'static' modifier. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected7.errors.txt b/tests/baselines/reference/Protected7.errors.txt new file mode 100644 index 00000000000..e95f39eb1b2 --- /dev/null +++ b/tests/baselines/reference/Protected7.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,13): error TS1028: Accessibility modifier already seen. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts (1 errors) ==== + class C { + protected private m() { } + ~~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected8.js b/tests/baselines/reference/Protected8.js new file mode 100644 index 00000000000..4a24f98dc5f --- /dev/null +++ b/tests/baselines/reference/Protected8.js @@ -0,0 +1,7 @@ +//// [Protected8.ts] +interface I { + protected + p +} + +//// [Protected8.js] diff --git a/tests/baselines/reference/Protected8.types b/tests/baselines/reference/Protected8.types new file mode 100644 index 00000000000..f29be486eec --- /dev/null +++ b/tests/baselines/reference/Protected8.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/Protected/Protected8.ts === +interface I { +>I : I + + protected +>protected : any + + p +>p : any +} diff --git a/tests/baselines/reference/Protected9.js b/tests/baselines/reference/Protected9.js new file mode 100644 index 00000000000..f747f18e8e8 --- /dev/null +++ b/tests/baselines/reference/Protected9.js @@ -0,0 +1,12 @@ +//// [Protected9.ts] +class C { + constructor(protected p) { } +} + +//// [Protected9.js] +var C = (function () { + function C(p) { + this.p = p; + } + return C; +})(); diff --git a/tests/baselines/reference/Protected9.types b/tests/baselines/reference/Protected9.types new file mode 100644 index 00000000000..d4b6e2fff82 --- /dev/null +++ b/tests/baselines/reference/Protected9.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts === +class C { +>C : C + + constructor(protected p) { } +>p : any +} diff --git a/tests/baselines/reference/TupleType1.js b/tests/baselines/reference/TupleType1.js new file mode 100644 index 00000000000..96a1db46548 --- /dev/null +++ b/tests/baselines/reference/TupleType1.js @@ -0,0 +1,5 @@ +//// [TupleType1.ts] +var v: [number] + +//// [TupleType1.js] +var v; diff --git a/tests/baselines/reference/TupleType1.types b/tests/baselines/reference/TupleType1.types new file mode 100644 index 00000000000..39fa32d5dca --- /dev/null +++ b/tests/baselines/reference/TupleType1.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType1.ts === +var v: [number] +>v : [number] + diff --git a/tests/baselines/reference/TupleType2.js b/tests/baselines/reference/TupleType2.js new file mode 100644 index 00000000000..e74db6f031a --- /dev/null +++ b/tests/baselines/reference/TupleType2.js @@ -0,0 +1,5 @@ +//// [TupleType2.ts] +var v: [number, string] + +//// [TupleType2.js] +var v; diff --git a/tests/baselines/reference/TupleType2.types b/tests/baselines/reference/TupleType2.types new file mode 100644 index 00000000000..0f35f60786c --- /dev/null +++ b/tests/baselines/reference/TupleType2.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType2.ts === +var v: [number, string] +>v : [number, string] + diff --git a/tests/baselines/reference/TupleType3.errors.txt b/tests/baselines/reference/TupleType3.errors.txt new file mode 100644 index 00000000000..a7f5b117325 --- /dev/null +++ b/tests/baselines/reference/TupleType3.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts(1,8): error TS1122: A tuple type element list cannot be empty. + + +==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts (1 errors) ==== + var v: [] + ~~ +!!! error TS1122: A tuple type element list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/TupleType4.errors.txt b/tests/baselines/reference/TupleType4.errors.txt new file mode 100644 index 00000000000..987f40b7aed --- /dev/null +++ b/tests/baselines/reference/TupleType4.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts(1,9): error TS1005: ']' expected. + + +==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts (1 errors) ==== + var v: [ + +!!! error TS1005: ']' expected. \ No newline at end of file diff --git a/tests/baselines/reference/TupleType5.errors.txt b/tests/baselines/reference/TupleType5.errors.txt new file mode 100644 index 00000000000..1a6ca7f99b3 --- /dev/null +++ b/tests/baselines/reference/TupleType5.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts(1,15): error TS1009: Trailing comma not allowed. + + +==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts (1 errors) ==== + var v: [number,] + ~ +!!! error TS1009: Trailing comma not allowed. \ No newline at end of file diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt index 2540e2a071f..39e5278041d 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt @@ -1,6 +1,14 @@ -==== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts (2 errors) ==== +tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(2,18): error TS2300: Duplicate identifier 'Point'. +tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(10,18): error TS2300: Duplicate identifier 'Point'. +tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(17,18): error TS2300: Duplicate identifier 'Line'. +tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(26,26): error TS2300: Duplicate identifier 'Line'. + + +==== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts (4 errors) ==== module A { export class Point { + ~~~~~ +!!! error TS2300: Duplicate identifier 'Point'. x: number; y: number; } @@ -10,7 +18,7 @@ // expected error export class Point { ~~~~~ -!!! Duplicate identifier 'Point'. +!!! error TS2300: Duplicate identifier 'Point'. origin: number; angle: number; } @@ -18,6 +26,8 @@ module X.Y.Z { export class Line { + ~~~~ +!!! error TS2300: Duplicate identifier 'Line'. length: number; } } @@ -28,7 +38,7 @@ // expected error export class Line { ~~~~ -!!! Duplicate identifier 'Line'. +!!! error TS2300: Duplicate identifier 'Line'. name: string; } } diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt index 659efa3ecda..8a4962c23c7 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt @@ -1,7 +1,13 @@ +tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(3,24): error TS2304: Cannot find name 'Point'. +tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,36): error TS2304: Cannot find name 'Point'. +tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error TS2304: Cannot find name 'Point'. + + ==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (1 errors) ==== export module A { ~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. export interface Point { x: number; y: number; @@ -21,15 +27,15 @@ // collision with 'Origin' var in other part of merged module export var Origin: Point = { x: 0, y: 0 }; ~~~~~ -!!! Cannot find name 'Point'. +!!! error TS2304: Cannot find name 'Point'. export module Utils { export class Plane { constructor(public tl: Point, public br: Point) { } ~~~~~ -!!! Cannot find name 'Point'. +!!! error TS2304: Cannot find name 'Point'. ~~~~~ -!!! Cannot find name 'Point'. +!!! error TS2304: Cannot find name 'Point'. } } } diff --git a/tests/baselines/reference/TypeArgumentList1.errors.txt b/tests/baselines/reference/TypeArgumentList1.errors.txt index 6c1a300f5a5..4337f520c6d 100644 --- a/tests/baselines/reference/TypeArgumentList1.errors.txt +++ b/tests/baselines/reference/TypeArgumentList1.errors.txt @@ -1,12 +1,19 @@ +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,9): error TS1127: Invalid character. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,1): error TS2304: Cannot find name 'Foo'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,5): error TS2304: Cannot find name 'A'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,7): error TS2304: Cannot find name 'B'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,11): error TS2304: Cannot find name 'C'. + + ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts (5 errors) ==== Foo(4, 5, 6); -!!! Invalid character. +!!! error TS1127: Invalid character. ~~~ -!!! Cannot find name 'Foo'. +!!! error TS2304: Cannot find name 'Foo'. ~ -!!! Cannot find name 'A'. +!!! error TS2304: Cannot find name 'A'. ~ -!!! Cannot find name 'B'. +!!! error TS2304: Cannot find name 'B'. ~ -!!! Cannot find name 'C'. \ No newline at end of file +!!! error TS2304: Cannot find name 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/accessibilityModifiers.errors.txt b/tests/baselines/reference/accessibilityModifiers.errors.txt new file mode 100644 index 00000000000..137da7f982c --- /dev/null +++ b/tests/baselines/reference/accessibilityModifiers.errors.txt @@ -0,0 +1,99 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(22,12): error TS1029: 'private' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(23,12): error TS1029: 'private' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(24,12): error TS1029: 'private' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(25,12): error TS1029: 'private' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(27,12): error TS1029: 'protected' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(28,12): error TS1029: 'protected' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(29,12): error TS1029: 'protected' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(30,12): error TS1029: 'protected' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(32,12): error TS1029: 'public' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(33,12): error TS1029: 'public' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(34,12): error TS1029: 'public' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(35,12): error TS1029: 'public' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(40,13): error TS1028: Accessibility modifier already seen. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(40,20): error TS1028: Accessibility modifier already seen. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(41,12): error TS1028: Accessibility modifier already seen. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(42,13): error TS1028: Accessibility modifier already seen. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(43,12): error TS1028: Accessibility modifier already seen. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts (17 errors) ==== + + // No errors + class C { + private static privateProperty; + private static privateMethod() { } + private static get privateGetter() { return 0; } + private static set privateSetter(a: number) { } + + protected static protectedProperty; + protected static protectedMethod() { } + protected static get protectedGetter() { return 0; } + protected static set protectedSetter(a: number) { } + + public static publicProperty; + public static publicMethod() { } + public static get publicGetter() { return 0; } + public static set publicSetter(a: number) { } + } + + // Errors, accessibility modifiers must precede static + class D { + static private privateProperty; + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'static' modifier. + static private privateMethod() { } + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'static' modifier. + static private get privateGetter() { return 0; } + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'static' modifier. + static private set privateSetter(a: number) { } + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'static' modifier. + + static protected protectedProperty; + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'static' modifier. + static protected protectedMethod() { } + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'static' modifier. + static protected get protectedGetter() { return 0; } + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'static' modifier. + static protected set protectedSetter(a: number) { } + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'static' modifier. + + static public publicProperty; + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'static' modifier. + static public publicMethod() { } + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'static' modifier. + static public get publicGetter() { return 0; } + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'static' modifier. + static public set publicSetter(a: number) { } + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'static' modifier. + } + + // Errors, multiple accessibility modifier + class E { + private public protected property; + ~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + ~~~~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + public protected method() { } + ~~~~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + private protected get getter() { return 0; } + ~~~~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + public public set setter(a: number) { } + ~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt b/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt index df4fe1ecf9e..401a0107d89 100644 --- a/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt +++ b/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt @@ -1,14 +1,20 @@ +tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,9): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,16): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,11): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,18): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/accessorParameterAccessibilityModifier.ts (4 errors) ==== class C { set X(public v) { } ~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. static set X(public v2) { } ~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/accessorWithES3.errors.txt b/tests/baselines/reference/accessorWithES3.errors.txt index a16d23d28c2..0b4510a12ca 100644 --- a/tests/baselines/reference/accessorWithES3.errors.txt +++ b/tests/baselines/reference/accessorWithES3.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(20,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts (4 errors) ==== // error to use accessors in ES3 mode @@ -5,7 +11,7 @@ class C { get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 1; } } @@ -13,18 +19,18 @@ class D { set x(v) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } var x = { get a() { return 1 } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } var y = { set b(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/accessorWithInitializer.errors.txt b/tests/baselines/reference/accessorWithInitializer.errors.txt index 127bfdc8d82..338d9559e4c 100644 --- a/tests/baselines/reference/accessorWithInitializer.errors.txt +++ b/tests/baselines/reference/accessorWithInitializer.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/accessorWithInitializer.ts(3,9): error TS1052: A 'set' accessor parameter cannot have an initializer. +tests/cases/compiler/accessorWithInitializer.ts(4,16): error TS1052: A 'set' accessor parameter cannot have an initializer. + + ==== tests/cases/compiler/accessorWithInitializer.ts (2 errors) ==== class C { set X(v = 0) { } ~ -!!! A 'set' accessor parameter cannot have an initializer. +!!! error TS1052: A 'set' accessor parameter cannot have an initializer. static set X(v2 = 0) { } ~ -!!! A 'set' accessor parameter cannot have an initializer. +!!! error TS1052: A 'set' accessor parameter cannot have an initializer. } \ No newline at end of file diff --git a/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.errors.txt b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.errors.txt new file mode 100644 index 00000000000..6c12df93dd1 --- /dev/null +++ b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.errors.txt @@ -0,0 +1,59 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(3,9): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(6,17): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(11,19): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(14,17): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(19,19): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(21,9): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(27,26): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(29,16): error TS2379: Getter and setter accessors do not agree in visibility. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts (8 errors) ==== + + class C { + get x() { + ~ +!!! error TS2379: Getter and setter accessors do not agree in visibility. + return 1; + } + private set x(v) { + ~ +!!! error TS2379: Getter and setter accessors do not agree in visibility. + } + } + + class D { + protected get x() { + ~ +!!! error TS2379: Getter and setter accessors do not agree in visibility. + return 1; + } + private set x(v) { + ~ +!!! error TS2379: Getter and setter accessors do not agree in visibility. + } + } + + class E { + protected set x(v) { + ~ +!!! error TS2379: Getter and setter accessors do not agree in visibility. + } + get x() { + ~ +!!! error TS2379: Getter and setter accessors do not agree in visibility. + return 1; + } + } + + class F { + protected static set x(v) { + ~ +!!! error TS2379: Getter and setter accessors do not agree in visibility. + } + static get x() { + ~ +!!! error TS2379: Getter and setter accessors do not agree in visibility. + return 1; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.js b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.js new file mode 100644 index 00000000000..548d679776e --- /dev/null +++ b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.js @@ -0,0 +1,91 @@ +//// [accessorWithMismatchedAccessibilityModifiers.ts] + +class C { + get x() { + return 1; + } + private set x(v) { + } +} + +class D { + protected get x() { + return 1; + } + private set x(v) { + } +} + +class E { + protected set x(v) { + } + get x() { + return 1; + } +} + +class F { + protected static set x(v) { + } + static get x() { + return 1; + } +} + +//// [accessorWithMismatchedAccessibilityModifiers.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function () { + function D() { + } + Object.defineProperty(D.prototype, "x", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return D; +})(); +var E = (function () { + function E() { + } + Object.defineProperty(E.prototype, "x", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return E; +})(); +var F = (function () { + function F() { + } + Object.defineProperty(F, "x", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return F; +})(); diff --git a/tests/baselines/reference/accessorWithRestParam.errors.txt b/tests/baselines/reference/accessorWithRestParam.errors.txt index 10f4633805f..6162d5a8238 100644 --- a/tests/baselines/reference/accessorWithRestParam.errors.txt +++ b/tests/baselines/reference/accessorWithRestParam.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/accessorWithRestParam.ts(3,9): error TS1053: A 'set' accessor cannot have rest parameter. +tests/cases/compiler/accessorWithRestParam.ts(4,16): error TS1053: A 'set' accessor cannot have rest parameter. + + ==== tests/cases/compiler/accessorWithRestParam.ts (2 errors) ==== class C { set X(...v) { } ~ -!!! A 'set' accessor cannot have rest parameter. +!!! error TS1053: A 'set' accessor cannot have rest parameter. static set X(...v2) { } ~ -!!! A 'set' accessor cannot have rest parameter. +!!! error TS1053: A 'set' accessor cannot have rest parameter. } \ No newline at end of file diff --git a/tests/baselines/reference/accessorsAreNotContextuallyTyped.errors.txt b/tests/baselines/reference/accessorsAreNotContextuallyTyped.errors.txt index b108ea940a3..725ad30bd61 100644 --- a/tests/baselines/reference/accessorsAreNotContextuallyTyped.errors.txt +++ b/tests/baselines/reference/accessorsAreNotContextuallyTyped.errors.txt @@ -1,15 +1,19 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorsAreNotContextuallyTyped.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorsAreNotContextuallyTyped.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorsAreNotContextuallyTyped.ts (2 errors) ==== // accessors are not contextually typed class C { set x(v: (a: string) => string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return (x: string) => ""; } } diff --git a/tests/baselines/reference/accessorsEmit.errors.txt b/tests/baselines/reference/accessorsEmit.errors.txt index 54bfafec648..4d620f8cd8b 100644 --- a/tests/baselines/reference/accessorsEmit.errors.txt +++ b/tests/baselines/reference/accessorsEmit.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/accessorsEmit.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessorsEmit.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/accessorsEmit.ts (2 errors) ==== class Result { } class Test { get Property(): Result { ~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = 1; return null; } @@ -13,7 +17,7 @@ class Test2 { get Property() { ~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = 1; return null; } diff --git a/tests/baselines/reference/accessorsInAmbientContext.errors.txt b/tests/baselines/reference/accessorsInAmbientContext.errors.txt index fe7dfb361f9..ada59f21f65 100644 --- a/tests/baselines/reference/accessorsInAmbientContext.errors.txt +++ b/tests/baselines/reference/accessorsInAmbientContext.errors.txt @@ -1,35 +1,45 @@ +tests/cases/compiler/accessorsInAmbientContext.ts(4,13): error TS1086: An accessor cannot be declared in an ambient context. +tests/cases/compiler/accessorsInAmbientContext.ts(5,13): error TS1086: An accessor cannot be declared in an ambient context. +tests/cases/compiler/accessorsInAmbientContext.ts(7,20): error TS1086: An accessor cannot be declared in an ambient context. +tests/cases/compiler/accessorsInAmbientContext.ts(8,20): error TS1086: An accessor cannot be declared in an ambient context. +tests/cases/compiler/accessorsInAmbientContext.ts(13,9): error TS1086: An accessor cannot be declared in an ambient context. +tests/cases/compiler/accessorsInAmbientContext.ts(14,9): error TS1086: An accessor cannot be declared in an ambient context. +tests/cases/compiler/accessorsInAmbientContext.ts(16,16): error TS1086: An accessor cannot be declared in an ambient context. +tests/cases/compiler/accessorsInAmbientContext.ts(17,16): error TS1086: An accessor cannot be declared in an ambient context. + + ==== tests/cases/compiler/accessorsInAmbientContext.ts (8 errors) ==== declare module M { class C { get X() { return 1; } ~ -!!! An accessor cannot be declared in an ambient context. +!!! error TS1086: An accessor cannot be declared in an ambient context. set X(v) { } ~ -!!! An accessor cannot be declared in an ambient context. +!!! error TS1086: An accessor cannot be declared in an ambient context. static get Y() { return 1; } ~ -!!! An accessor cannot be declared in an ambient context. +!!! error TS1086: An accessor cannot be declared in an ambient context. static set Y(v) { } ~ -!!! An accessor cannot be declared in an ambient context. +!!! error TS1086: An accessor cannot be declared in an ambient context. } } declare class C { get X() { return 1; } ~ -!!! An accessor cannot be declared in an ambient context. +!!! error TS1086: An accessor cannot be declared in an ambient context. set X(v) { } ~ -!!! An accessor cannot be declared in an ambient context. +!!! error TS1086: An accessor cannot be declared in an ambient context. static get Y() { return 1; } ~ -!!! An accessor cannot be declared in an ambient context. +!!! error TS1086: An accessor cannot be declared in an ambient context. static set Y(v) { } ~ -!!! An accessor cannot be declared in an ambient context. +!!! error TS1086: An accessor cannot be declared in an ambient context. } \ No newline at end of file diff --git a/tests/baselines/reference/accessorsNotAllowedInES3.errors.txt b/tests/baselines/reference/accessorsNotAllowedInES3.errors.txt index 3233ba9b5ee..f7d7b146ee3 100644 --- a/tests/baselines/reference/accessorsNotAllowedInES3.errors.txt +++ b/tests/baselines/reference/accessorsNotAllowedInES3.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/accessorsNotAllowedInES3.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessorsNotAllowedInES3.ts(5,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/accessorsNotAllowedInES3.ts (2 errors) ==== class C { get x(): number { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } var y = { get foo() { return 3; } }; ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt index be2d5d10ef3..a3e8acd7d17 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt @@ -1,38 +1,52 @@ +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,55): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,54): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,52): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,51): error TS2323: Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts (12 errors) ==== class LanguageSpec_section_4_5_error_cases { public set AnnotatedSetter_SetterFirst(a: number) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get AnnotatedSetter_SetterFirst() { return ""; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. public get AnnotatedSetter_SetterLast() { return ""; } ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. public set AnnotatedSetter_SetterLast(a: number) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get AnnotatedGetter_GetterFirst(): string { return ""; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set AnnotatedGetter_GetterFirst(aStr) { aStr = 0; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. public set AnnotatedGetter_GetterLast(aStr) { aStr = 0; } ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. public get AnnotatedGetter_GetterLast(): string { return ""; } ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.errors.txt b/tests/baselines/reference/accessors_spec_section-4.5_inference.errors.txt index 6f30cec38e4..9e7db776ff5 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.errors.txt +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.errors.txt @@ -1,3 +1,17 @@ +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(13,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(14,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(16,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(17,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(20,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(22,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_inference.ts(23,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/accessors_spec_section-4.5_inference.ts (12 errors) ==== class A { } class B extends A { } @@ -6,44 +20,44 @@ public set InferredGetterFromSetterAnnotation(a: A) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get InferredGetterFromSetterAnnotation() { return new B(); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get InferredGetterFromSetterAnnotation_GetterFirst() { return new B(); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set InferredGetterFromSetterAnnotation_GetterFirst(a: A) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get InferredFromGetter() { return new B(); } ~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set InferredFromGetter(a) { } ~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set InferredFromGetter_SetterFirst(a) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get InferredFromGetter_SetterFirst() { return new B(); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set InferredSetterFromGetterAnnotation(a) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get InferredSetterFromGetterAnnotation() : A { return new B(); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get InferredSetterFromGetterAnnotation_GetterFirst() : A { return new B(); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set InferredSetterFromGetterAnnotation_GetterFirst(a) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/addMoreOverloadsToBaseSignature.errors.txt b/tests/baselines/reference/addMoreOverloadsToBaseSignature.errors.txt index 36b45612631..6fca82a677f 100644 --- a/tests/baselines/reference/addMoreOverloadsToBaseSignature.errors.txt +++ b/tests/baselines/reference/addMoreOverloadsToBaseSignature.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/addMoreOverloadsToBaseSignature.ts(5,11): error TS2429: Interface 'Bar' incorrectly extends interface 'Foo': + Types of property 'f' are incompatible: + Type '(key: string) => string' is not assignable to type '() => string'. + + ==== tests/cases/compiler/addMoreOverloadsToBaseSignature.ts (1 errors) ==== interface Foo { f(): string; @@ -5,9 +10,9 @@ interface Bar extends Foo { ~~~ -!!! Interface 'Bar' incorrectly extends interface 'Foo': -!!! Types of property 'f' are incompatible: -!!! Type '(key: string) => string' is not assignable to type '() => string'. +!!! error TS2429: Interface 'Bar' incorrectly extends interface 'Foo': +!!! error TS2429: Types of property 'f' are incompatible: +!!! error TS2429: Type '(key: string) => string' is not assignable to type '() => string'. f(key: string): string; } \ No newline at end of file diff --git a/tests/baselines/reference/additionOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/additionOperatorWithInvalidOperands.errors.txt index 607a76b1034..bd71b64b501 100644 --- a/tests/baselines/reference/additionOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/additionOperatorWithInvalidOperands.errors.txt @@ -1,3 +1,24 @@ +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(17,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'Object'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(22,10): error TS2365: Operator '+' cannot be applied to types 'number' and 'Object'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(25,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(26,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'number'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(27,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(30,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(31,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(32,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(33,11): error TS2365: Operator '+' cannot be applied to types '{}' and '{}'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(34,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'Number'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(35,11): error TS2365: Operator '+' cannot be applied to types 'number' and '() => void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(36,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(37,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'typeof C'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(38,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'C'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(39,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(40,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'typeof M'. + + ==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts (19 errors) ==== function foo() { } class C { @@ -15,65 +36,65 @@ // boolean + every type except any and string var r1 = a + a; ~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. var r2 = a + b; ~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'. var r3 = a + c; ~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'Object'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'Object'. // number + every type except any and string var r4 = b + a; ~~~~~ -!!! Operator '+' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. var r5 = b + b; // number + number is valid var r6 = b + c; ~~~~~ -!!! Operator '+' cannot be applied to types 'number' and 'Object'. +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'Object'. // object + every type except any and string var r7 = c + a; ~~~~~ -!!! Operator '+' cannot be applied to types 'Object' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'boolean'. var r8 = c + b; ~~~~~ -!!! Operator '+' cannot be applied to types 'Object' and 'number'. +!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'number'. var r9 = c + c; ~~~~~ -!!! Operator '+' cannot be applied to types 'Object' and 'Object'. +!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. // other cases var r10 = a + true; ~~~~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. var r11 = true + false; ~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. var r12 = true + 123; ~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'. var r13 = {} + {}; ~~~~~~~ -!!! Operator '+' cannot be applied to types '{}' and '{}'. +!!! error TS2365: Operator '+' cannot be applied to types '{}' and '{}'. var r14 = b + d; ~~~~~ -!!! Operator '+' cannot be applied to types 'number' and 'Number'. +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'Number'. var r15 = b + foo; ~~~~~~~ -!!! Operator '+' cannot be applied to types 'number' and '() => void'. +!!! error TS2365: Operator '+' cannot be applied to types 'number' and '() => void'. var r16 = b + foo(); ~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'number' and 'void'. +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'void'. var r17 = b + C; ~~~~~ -!!! Operator '+' cannot be applied to types 'number' and 'typeof C'. +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'typeof C'. var r18 = E.a + new C(); ~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'E' and 'C'. +!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'C'. var r19 = E.a + C.foo(); ~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'E' and 'void'. +!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'void'. var r20 = E.a + M; ~~~~~~~ -!!! Operator '+' cannot be applied to types 'E' and 'typeof M'. \ No newline at end of file +!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'typeof M'. \ No newline at end of file diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.errors.txt b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.errors.txt index 230210c2586..566fb241bf8 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.errors.txt +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.errors.txt @@ -1,3 +1,16 @@ +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(11,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(12,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(13,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(14,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(19,10): error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(21,10): error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(22,11): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(23,11): error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'. + + ==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts (11 errors) ==== // If one operand is the null or undefined value, it is treated as having the type of the other operand. @@ -11,36 +24,36 @@ // null + boolean/Object var r1 = null + a; ~~~~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. var r2 = null + b; ~~~~~~~~ -!!! Operator '+' cannot be applied to types 'Object' and 'Object'. +!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. var r3 = null + c; ~~~~~~~~ -!!! Operator '+' cannot be applied to types 'void' and 'void'. +!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. var r4 = a + null; ~~~~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. var r5 = b + null; ~~~~~~~~ -!!! Operator '+' cannot be applied to types 'Object' and 'Object'. +!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. var r6 = null + c; ~~~~~~~~ -!!! Operator '+' cannot be applied to types 'void' and 'void'. +!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. // other cases var r7 = null + d; ~~~~~~~~ -!!! Operator '+' cannot be applied to types 'Number' and 'Number'. +!!! error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'. var r8 = null + true; ~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. var r9 = null + { a: '' }; ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'. +!!! error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'. var r10 = null + foo(); ~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'void' and 'void'. +!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. var r11 = null + (() => { }); ~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types '() => void' and '() => void'. \ No newline at end of file +!!! error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'. \ No newline at end of file diff --git a/tests/baselines/reference/additionOperatorWithOnlyNullValueOrUndefinedValue.errors.txt b/tests/baselines/reference/additionOperatorWithOnlyNullValueOrUndefinedValue.errors.txt index fad515948be..9e7e4c01ad2 100644 --- a/tests/baselines/reference/additionOperatorWithOnlyNullValueOrUndefinedValue.errors.txt +++ b/tests/baselines/reference/additionOperatorWithOnlyNullValueOrUndefinedValue.errors.txt @@ -1,14 +1,20 @@ +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(2,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(3,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(4,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(5,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + + ==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts (4 errors) ==== // bug 819721 var r1 = null + null; ~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var r2 = null + undefined; ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var r3 = undefined + null; ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var r4 = undefined + undefined; ~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. \ No newline at end of file +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/additionOperatorWithTypeParameter.errors.txt b/tests/baselines/reference/additionOperatorWithTypeParameter.errors.txt index 5b084477241..ff7120c145d 100644 --- a/tests/baselines/reference/additionOperatorWithTypeParameter.errors.txt +++ b/tests/baselines/reference/additionOperatorWithTypeParameter.errors.txt @@ -1,3 +1,21 @@ +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(15,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(16,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'number'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(18,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'Object'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(19,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'E'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(20,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(24,14): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'T'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(25,15): error TS2365: Operator '+' cannot be applied to types 'number' and 'T'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(27,15): error TS2365: Operator '+' cannot be applied to types 'Object' and 'T'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(28,15): error TS2365: Operator '+' cannot be applied to types 'E' and 'T'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(29,15): error TS2365: Operator '+' cannot be applied to types 'void' and 'T'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(32,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(33,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(34,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(35,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(36,15): error TS2365: Operator '+' cannot be applied to types 'T' and '() => void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(37,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'undefined[]'. + + ==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts (16 errors) ==== // type parameter type is not a valid operand of addition operator enum E { a, b } @@ -15,57 +33,57 @@ var r1: any = t + a; // ok, one operand is any var r2 = t + b; ~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'boolean'. var r3 = t + c; ~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'number'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'number'. var r4 = t + d; // ok, one operand is string var r5 = t + e; ~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'Object'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'Object'. var r6 = t + g; ~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'E'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'E'. var r7 = t + f; ~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'void'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'void'. // type parameter as right operand var r8 = a + t; // ok, one operand is any var r9 = b + t; ~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'T'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'T'. var r10 = c + t; ~~~~~ -!!! Operator '+' cannot be applied to types 'number' and 'T'. +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'T'. var r11 = d + t; // ok, one operand is string var r12 = e + t; ~~~~~ -!!! Operator '+' cannot be applied to types 'Object' and 'T'. +!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'T'. var r13 = g + t; ~~~~~ -!!! Operator '+' cannot be applied to types 'E' and 'T'. +!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'T'. var r14 = f + t; ~~~~~ -!!! Operator '+' cannot be applied to types 'void' and 'T'. +!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'T'. // other cases var r15 = t + null; ~~~~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'T'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. var r16 = t + undefined; ~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'T'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. var r17 = t + t; ~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'T'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. var r18 = t + u; ~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'U'. var r19 = t + (() => { }); ~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'T' and '() => void'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and '() => void'. var r20 = t + []; ~~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'undefined[]'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'undefined[]'. } \ No newline at end of file diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.errors.txt b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.errors.txt index 95b1f4055a7..36233e9e9fe 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.errors.txt +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.errors.txt @@ -1,3 +1,16 @@ +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(11,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(12,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(13,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(14,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(19,10): error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(21,10): error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(22,11): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(23,11): error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'. + + ==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts (11 errors) ==== // If one operand is the null or undefined value, it is treated as having the type of the other operand. @@ -11,36 +24,36 @@ // undefined + boolean/Object var r1 = undefined + a; ~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. var r2 = undefined + b; ~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'Object' and 'Object'. +!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. var r3 = undefined + c; ~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'void' and 'void'. +!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. var r4 = a + undefined; ~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. var r5 = b + undefined; ~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'Object' and 'Object'. +!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. var r6 = undefined + c; ~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'void' and 'void'. +!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. // other cases var r7 = undefined + d; ~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'Number' and 'Number'. +!!! error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'. var r8 = undefined + true; ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. var r9 = undefined + { a: '' }; ~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'. +!!! error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'. var r10 = undefined + foo(); ~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'void' and 'void'. +!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. var r11 = undefined + (() => { }); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types '() => void' and '() => void'. \ No newline at end of file +!!! error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'. \ No newline at end of file diff --git a/tests/baselines/reference/aliasAssignments.errors.txt b/tests/baselines/reference/aliasAssignments.errors.txt index d75b8d51451..1c49a377356 100644 --- a/tests/baselines/reference/aliasAssignments.errors.txt +++ b/tests/baselines/reference/aliasAssignments.errors.txt @@ -1,14 +1,19 @@ +tests/cases/compiler/aliasAssignments_1.ts(3,1): error TS2322: Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"': + Property 'someClass' is missing in type 'Number'. +tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2323: Type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"' is not assignable to type 'number'. + + ==== tests/cases/compiler/aliasAssignments_1.ts (2 errors) ==== import moduleA = require("aliasAssignments_moduleA"); var x = moduleA; x = 1; // Should be error ~ -!!! Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"': -!!! Property 'someClass' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"': +!!! error TS2322: Property 'someClass' is missing in type 'Number'. var y = 1; y = moduleA; // should be error ~ -!!! Type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"' is not assignable to type 'number'. +!!! error TS2323: Type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"' is not assignable to type 'number'. ==== tests/cases/compiler/aliasAssignments_moduleA.ts (0 errors) ==== export class someClass { diff --git a/tests/baselines/reference/aliasBug.errors.txt b/tests/baselines/reference/aliasBug.errors.txt index 1e7434c19b6..92b63e41b68 100644 --- a/tests/baselines/reference/aliasBug.errors.txt +++ b/tests/baselines/reference/aliasBug.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/aliasBug.ts(17,10): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'. + + ==== tests/cases/compiler/aliasBug.ts (1 errors) ==== module foo { @@ -17,7 +20,7 @@ var p2: foo.Provide; var p3:booz.bar; ~~~~~~~~ -!!! Module 'foo.bar.baz' has no exported member 'bar'. +!!! error TS2305: Module 'foo.bar.baz' has no exported member 'bar'. var p22 = new provide.Provide(); } \ No newline at end of file diff --git a/tests/baselines/reference/aliasErrors.errors.txt b/tests/baselines/reference/aliasErrors.errors.txt index 4407771ce56..20e68c5f800 100644 --- a/tests/baselines/reference/aliasErrors.errors.txt +++ b/tests/baselines/reference/aliasErrors.errors.txt @@ -1,3 +1,12 @@ +tests/cases/compiler/aliasErrors.ts(13,12): error TS1003: Identifier expected. +tests/cases/compiler/aliasErrors.ts(14,12): error TS1003: Identifier expected. +tests/cases/compiler/aliasErrors.ts(15,12): error TS1003: Identifier expected. +tests/cases/compiler/aliasErrors.ts(11,1): error TS2304: Cannot find name 'no'. +tests/cases/compiler/aliasErrors.ts(12,1): error TS2304: Cannot find name 'no'. +tests/cases/compiler/aliasErrors.ts(16,1): error TS2304: Cannot find name 'undefined'. +tests/cases/compiler/aliasErrors.ts(26,10): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'. + + ==== tests/cases/compiler/aliasErrors.ts (7 errors) ==== module foo { export class Provide { @@ -11,22 +20,22 @@ import m = no; ~~~~~~~~~~~~~~ -!!! Cannot find name 'no'. +!!! error TS2304: Cannot find name 'no'. import m2 = no.mod; ~~~~~~~~~~~~~~~~~~~ -!!! Cannot find name 'no'. +!!! error TS2304: Cannot find name 'no'. import n = 5; ~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. import o = "s"; ~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. import q = null; ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. import r = undefined; ~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot find name 'undefined'. +!!! error TS2304: Cannot find name 'undefined'. var p = new provide.Provide(); @@ -38,7 +47,7 @@ var p2: foo.Provide; var p3:booz.bar; ~~~~~~~~ -!!! Module 'foo.bar.baz' has no exported member 'bar'. +!!! error TS2305: Module 'foo.bar.baz' has no exported member 'bar'. var p22 = new provide.Provide(); } diff --git a/tests/baselines/reference/aliasInaccessibleModule.errors.txt b/tests/baselines/reference/aliasInaccessibleModule.errors.txt index 839ea965b02..9967979442a 100644 --- a/tests/baselines/reference/aliasInaccessibleModule.errors.txt +++ b/tests/baselines/reference/aliasInaccessibleModule.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/aliasInaccessibleModule.ts(4,5): error TS4000: Import declaration 'X' is using private name 'N'. + + ==== tests/cases/compiler/aliasInaccessibleModule.ts (1 errors) ==== module M { module N { } export import X = N; ~~~~~~~~~~~~~~~~~~~~ -!!! Import declaration 'X' is using private name 'N'. +!!! error TS4000: Import declaration 'X' is using private name 'N'. } \ No newline at end of file diff --git a/tests/baselines/reference/aliasInaccessibleModule2.errors.txt b/tests/baselines/reference/aliasInaccessibleModule2.errors.txt index 149410acb10..ffeb4ff86dd 100644 --- a/tests/baselines/reference/aliasInaccessibleModule2.errors.txt +++ b/tests/baselines/reference/aliasInaccessibleModule2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/aliasInaccessibleModule2.ts(7,5): error TS4000: Import declaration 'R' is using private name 'N'. + + ==== tests/cases/compiler/aliasInaccessibleModule2.ts (1 errors) ==== module M { module N { @@ -7,6 +10,6 @@ } import R = N; ~~~~~~~~~~~~~ -!!! Import declaration 'R' is using private name 'N'. +!!! error TS4000: Import declaration 'R' is using private name 'N'. export import X = R; } \ No newline at end of file diff --git a/tests/baselines/reference/aliasOnMergedModuleInterface.errors.txt b/tests/baselines/reference/aliasOnMergedModuleInterface.errors.txt index 8736a2e7ae7..009d405c0f5 100644 --- a/tests/baselines/reference/aliasOnMergedModuleInterface.errors.txt +++ b/tests/baselines/reference/aliasOnMergedModuleInterface.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/aliasOnMergedModuleInterface_1.ts(5,16): error TS2304: Cannot find name 'foo'. + + ==== tests/cases/compiler/aliasOnMergedModuleInterface_1.ts (1 errors) ==== /// import foo = require("foo") @@ -5,7 +8,7 @@ z.bar("hello"); // This should be ok var x: foo.A = foo.bar("hello"); // foo.A should be ok but foo.bar should be error ~~~ -!!! Cannot find name 'foo'. +!!! error TS2304: Cannot find name 'foo'. ==== tests/cases/compiler/aliasOnMergedModuleInterface_0.ts (0 errors) ==== declare module "foo" diff --git a/tests/baselines/reference/aliasUsageInArray.types b/tests/baselines/reference/aliasUsageInArray.types index df657233f90..2e792d39603 100644 --- a/tests/baselines/reference/aliasUsageInArray.types +++ b/tests/baselines/reference/aliasUsageInArray.types @@ -17,7 +17,7 @@ interface IHasVisualizationModel { var xs: IHasVisualizationModel[] = [moduleA]; >xs : IHasVisualizationModel[] >IHasVisualizationModel : IHasVisualizationModel ->[moduleA] : IHasVisualizationModel[] +>[moduleA] : typeof moduleA[] >moduleA : typeof moduleA var xs2: typeof moduleA[] = [moduleA]; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.types b/tests/baselines/reference/aliasUsageInOrExpression.types index fdcf0be4479..c937187f049 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.types +++ b/tests/baselines/reference/aliasUsageInOrExpression.types @@ -53,7 +53,7 @@ var f: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null ? { x >f : { x: IHasVisualizationModel; } >x : IHasVisualizationModel >IHasVisualizationModel : IHasVisualizationModel -><{ x: IHasVisualizationModel }>null ? { x: moduleA } : null : { x: IHasVisualizationModel; } +><{ x: IHasVisualizationModel }>null ? { x: moduleA } : null : { x: typeof moduleA; } ><{ x: IHasVisualizationModel }>null : { x: IHasVisualizationModel; } >x : IHasVisualizationModel >IHasVisualizationModel : IHasVisualizationModel diff --git a/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.errors.txt b/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.errors.txt index 3185336f8f7..a2532be9344 100644 --- a/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.errors.txt +++ b/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts(2,9): error TS2304: Cannot find name 'b'. + + ==== tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts (1 errors) ==== import moduleA = require("aliasWithInterfaceExportAssignmentUsedInVarInitializer_0"); var d = b.q3; ~ -!!! Cannot find name 'b'. +!!! error TS2304: Cannot find name 'b'. ==== tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_0.ts (0 errors) ==== interface c { q3: number; diff --git a/tests/baselines/reference/ambientClassOverloadForFunction.errors.txt b/tests/baselines/reference/ambientClassOverloadForFunction.errors.txt index ed00c2a4a16..16df32bb2c5 100644 --- a/tests/baselines/reference/ambientClassOverloadForFunction.errors.txt +++ b/tests/baselines/reference/ambientClassOverloadForFunction.errors.txt @@ -1,6 +1,12 @@ -==== tests/cases/compiler/ambientClassOverloadForFunction.ts (1 errors) ==== +tests/cases/compiler/ambientClassOverloadForFunction.ts(1,15): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/ambientClassOverloadForFunction.ts(2,10): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/compiler/ambientClassOverloadForFunction.ts (2 errors) ==== declare class foo{}; + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. function foo() { return null; } ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/ambientDeclarationsExternal.errors.txt b/tests/baselines/reference/ambientDeclarationsExternal.errors.txt index 94b3c770d60..124bf928699 100644 --- a/tests/baselines/reference/ambientDeclarationsExternal.errors.txt +++ b/tests/baselines/reference/ambientDeclarationsExternal.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/conformance/ambient/consumer.ts (1 errors) ==== /// import imp1 = require('equ'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. // Ambient external module members are always exported with or without export keyword when module lacks export assignment diff --git a/tests/baselines/reference/ambientEnumElementInitializer3.errors.txt b/tests/baselines/reference/ambientEnumElementInitializer3.errors.txt index 159204675e9..56058210c16 100644 --- a/tests/baselines/reference/ambientEnumElementInitializer3.errors.txt +++ b/tests/baselines/reference/ambientEnumElementInitializer3.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/ambientEnumElementInitializer3.ts(2,2): error TS1066: Ambient enum elements can only have integer literal initializers. + + ==== tests/cases/compiler/ambientEnumElementInitializer3.ts (1 errors) ==== declare enum E { e = 3.3 // Decimal ~ -!!! Ambient enum elements can only have integer literal initializers. +!!! error TS1066: Ambient enum elements can only have integer literal initializers. } \ No newline at end of file diff --git a/tests/baselines/reference/ambientErrors.errors.txt b/tests/baselines/reference/ambientErrors.errors.txt index 146f9322100..975dc9ad63a 100644 --- a/tests/baselines/reference/ambientErrors.errors.txt +++ b/tests/baselines/reference/ambientErrors.errors.txt @@ -1,14 +1,32 @@ +tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/ambient/ambientErrors.ts(24,5): error TS1066: Ambient enum elements can only have integer literal initializers. +tests/cases/conformance/ambient/ambientErrors.ts(29,5): error TS1066: Ambient enum elements can only have integer literal initializers. +tests/cases/conformance/ambient/ambientErrors.ts(34,11): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(35,19): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/ambient/ambientErrors.ts(37,18): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(38,11): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1111: A constructor implementation cannot be declared in an ambient context. +tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/ambient/ambientErrors.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient external modules cannot be nested in other modules. +tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient external module declaration cannot specify relative module name. +tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements. + + ==== tests/cases/conformance/ambient/ambientErrors.ts (16 errors) ==== // Ambient variable with an initializer declare var x = 4; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. // Ambient functions with invalid overloads declare function fn(x: number): string; declare function fn(x: 'foo'): number; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. // Ambient functions with duplicate signatures declare function fn1(x: number): string; @@ -21,51 +39,51 @@ // Ambient function with default parameter values declare function fn3(x = 3); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. // Ambient function with function body declare function fn4() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. // Ambient enum with non - integer literal constant member declare enum E1 { y = 4.23 ~ -!!! Ambient enum elements can only have integer literal initializers. +!!! error TS1066: Ambient enum elements can only have integer literal initializers. } // Ambient enum with computer member declare enum E2 { x = 'foo'.length ~ -!!! Ambient enum elements can only have integer literal initializers. +!!! error TS1066: Ambient enum elements can only have integer literal initializers. } // Ambient module with initializers for values, bodies for functions / classes declare module M1 { var x = 3; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. function fn() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. class C { static x = 3; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. y = 4; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. constructor() { } ~ -!!! A constructor implementation cannot be declared in an ambient context. +!!! error TS1111: A constructor implementation cannot be declared in an ambient context. fn() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. static sfn() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. } } @@ -73,13 +91,13 @@ module M2 { declare module 'nope' { } ~~~~~~ -!!! Ambient external modules cannot be nested in other modules. +!!! error TS2435: Ambient external modules cannot be nested in other modules. } // Ambient external module with a string literal name that isn't a top level external module name declare module '../foo' { } ~~~~~~~~ -!!! Ambient external module declaration cannot specify relative module name. +!!! error TS2436: Ambient external module declaration cannot specify relative module name. // Ambient external module with export assignment and other exported members declare module 'bar' { @@ -87,6 +105,6 @@ export var q; export = n; ~~~~~~~~~~~ -!!! An export assignment cannot be used in a module with other exported elements. +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. } \ No newline at end of file diff --git a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt index d5fd7ed2296..fb988131df0 100644 --- a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt +++ b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient external modules cannot be nested in other modules. +tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): error TS2307: Cannot find external module 'ext'. + + ==== tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts (2 errors) ==== class D { } @@ -5,12 +9,12 @@ declare module "ext" { ~~~~~ -!!! Ambient external modules cannot be nested in other modules. +!!! error TS2435: Ambient external modules cannot be nested in other modules. export class C { } } // Cannot resolve this ext module reference import ext = require("ext"); ~~~~~ -!!! Cannot find external module 'ext'. +!!! error TS2307: Cannot find external module 'ext'. var x = ext; \ No newline at end of file diff --git a/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt b/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt index ca8ceb6d3ec..e23f96803ba 100644 --- a/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt +++ b/tests/baselines/reference/ambientExternalModuleInsideNonAmbient.errors.txt @@ -1,6 +1,9 @@ +tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient external modules cannot be nested in other modules. + + ==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (1 errors) ==== module M { export declare module "M" { } ~~~ -!!! Ambient external modules cannot be nested in other modules. +!!! error TS2435: Ambient external modules cannot be nested in other modules. } \ No newline at end of file diff --git a/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt b/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt index 44731cf6250..92f01832926 100644 --- a/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt +++ b/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.errors.txt @@ -1,4 +1,7 @@ +tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient external modules cannot be nested in other modules. + + ==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (1 errors) ==== export declare module "M" { } ~~~ -!!! Ambient external modules cannot be nested in other modules. \ No newline at end of file +!!! error TS2435: Ambient external modules cannot be nested in other modules. \ No newline at end of file diff --git a/tests/baselines/reference/ambientExternalModuleWithRelativeExternalImportDeclaration.errors.txt b/tests/baselines/reference/ambientExternalModuleWithRelativeExternalImportDeclaration.errors.txt index 2f4779ebfac..4ebae64b0b8 100644 --- a/tests/baselines/reference/ambientExternalModuleWithRelativeExternalImportDeclaration.errors.txt +++ b/tests/baselines/reference/ambientExternalModuleWithRelativeExternalImportDeclaration.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,5): error TS2439: Import declaration in an ambient external module declaration cannot reference external module through relative external module name. +tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,25): error TS2307: Cannot find external module './SubModule'. + + ==== tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts (2 errors) ==== declare module "OuterModule" { import m2 = require("./SubModule"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Import declaration in an ambient external module declaration cannot reference external module through relative external module name. +!!! error TS2439: Import declaration in an ambient external module declaration cannot reference external module through relative external module name. ~~~~~~~~~~~~~ -!!! Cannot find external module './SubModule'. +!!! error TS2307: Cannot find external module './SubModule'. class SubModule { public static StaticVar: number; public InstanceVar: number; diff --git a/tests/baselines/reference/ambientExternalModuleWithRelativeModuleName.errors.txt b/tests/baselines/reference/ambientExternalModuleWithRelativeModuleName.errors.txt index fba44282cc3..7f6c0ff5b14 100644 --- a/tests/baselines/reference/ambientExternalModuleWithRelativeModuleName.errors.txt +++ b/tests/baselines/reference/ambientExternalModuleWithRelativeModuleName.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(1,16): error TS2436: Ambient external module declaration cannot specify relative module name. +tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(5,16): error TS2436: Ambient external module declaration cannot specify relative module name. + + ==== tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts (2 errors) ==== declare module "./relativeModule" { ~~~~~~~~~~~~~~~~~~ -!!! Ambient external module declaration cannot specify relative module name. +!!! error TS2436: Ambient external module declaration cannot specify relative module name. var x: string; } declare module ".\\relativeModule" { ~~~~~~~~~~~~~~~~~~~ -!!! Ambient external module declaration cannot specify relative module name. +!!! error TS2436: Ambient external module declaration cannot specify relative module name. var x: string; } \ No newline at end of file diff --git a/tests/baselines/reference/ambientGetters.errors.txt b/tests/baselines/reference/ambientGetters.errors.txt index a01c146d977..a56020c41fb 100644 --- a/tests/baselines/reference/ambientGetters.errors.txt +++ b/tests/baselines/reference/ambientGetters.errors.txt @@ -1,13 +1,17 @@ +tests/cases/compiler/ambientGetters.ts(3,9): error TS1086: An accessor cannot be declared in an ambient context. +tests/cases/compiler/ambientGetters.ts(7,9): error TS1086: An accessor cannot be declared in an ambient context. + + ==== tests/cases/compiler/ambientGetters.ts (2 errors) ==== declare class A { get length() : number; ~~~~~~ -!!! An accessor cannot be declared in an ambient context. +!!! error TS1086: An accessor cannot be declared in an ambient context. } declare class B { get length() { return 0; } ~~~~~~ -!!! An accessor cannot be declared in an ambient context. +!!! error TS1086: An accessor cannot be declared in an ambient context. } \ No newline at end of file diff --git a/tests/baselines/reference/ambientWithStatements.errors.txt b/tests/baselines/reference/ambientWithStatements.errors.txt index 9f0927d0765..4eef608bbec 100644 --- a/tests/baselines/reference/ambientWithStatements.errors.txt +++ b/tests/baselines/reference/ambientWithStatements.errors.txt @@ -1,38 +1,55 @@ +tests/cases/compiler/ambientWithStatements.ts(2,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(3,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(4,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(5,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(7,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(8,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(9,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(10,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(11,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(12,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(18,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(19,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(25,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(7,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/compiler/ambientWithStatements.ts(25,11): error TS2410: All symbols within a 'with' block will be resolved to 'any'. + + ==== tests/cases/compiler/ambientWithStatements.ts (15 errors) ==== declare module M { break; ~~~~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. continue; ~~~~~~~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. debugger; ~~~~~~~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. do { } while (true); ~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. var x; for (x in null) { } ~~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. ~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. if (true) { } else { } ~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. 1; ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. L: var y; ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. return; ~~~~~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. switch (x) { ~~~~~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. case 1: break; default: @@ -40,10 +57,10 @@ } throw "nooo"; ~~~~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. try { ~~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. } catch (e) { } @@ -51,8 +68,8 @@ } with (x) { ~~~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. ~ -!!! All symbols within a 'with' block will be resolved to 'any'. +!!! error TS2410: All symbols within a 'with' block will be resolved to 'any'. } } \ No newline at end of file diff --git a/tests/baselines/reference/ambiguousGenericAssertion1.errors.txt b/tests/baselines/reference/ambiguousGenericAssertion1.errors.txt index 5547ccb63f7..d97cdc95ac8 100644 --- a/tests/baselines/reference/ambiguousGenericAssertion1.errors.txt +++ b/tests/baselines/reference/ambiguousGenericAssertion1.errors.txt @@ -1,16 +1,23 @@ +tests/cases/compiler/ambiguousGenericAssertion1.ts(4,10): error TS1109: Expression expected. +tests/cases/compiler/ambiguousGenericAssertion1.ts(4,16): error TS1005: ')' expected. +tests/cases/compiler/ambiguousGenericAssertion1.ts(4,19): error TS1005: ',' expected. +tests/cases/compiler/ambiguousGenericAssertion1.ts(4,21): error TS1005: ';' expected. +tests/cases/compiler/ambiguousGenericAssertion1.ts(4,15): error TS2304: Cannot find name 'x'. + + ==== tests/cases/compiler/ambiguousGenericAssertion1.ts (5 errors) ==== function f(x: T): T { return null; } var r = (x: T) => x; var r2 = < (x: T) => T>f; // valid var r3 = <(x: T) => T>f; // ambiguous, appears to the parser as a << operation ~~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~ -!!! ')' expected. +!!! error TS1005: ')' expected. ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. \ No newline at end of file diff --git a/tests/baselines/reference/ambiguousOverload.errors.txt b/tests/baselines/reference/ambiguousOverload.errors.txt index 90e973ffba4..93d2fe848cc 100644 --- a/tests/baselines/reference/ambiguousOverload.errors.txt +++ b/tests/baselines/reference/ambiguousOverload.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/ambiguousOverload.ts(5,5): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/ambiguousOverload.ts(11,5): error TS2323: Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/ambiguousOverload.ts (2 errors) ==== function foof(bar: string, y): number; function foof(bar: string, x): string; @@ -5,7 +9,7 @@ var x: number = foof("s", null); var y: string = foof("s", null); ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. function foof2(bar: string, x): string; function foof2(bar: string, y): number; @@ -13,4 +17,4 @@ var x2: string = foof2("s", null); var y2: number = foof2("s", null); ~~ -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2323: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/amdDependencyComment1.errors.txt b/tests/baselines/reference/amdDependencyComment1.errors.txt index 97ce60ff1b8..8e436a56547 100644 --- a/tests/baselines/reference/amdDependencyComment1.errors.txt +++ b/tests/baselines/reference/amdDependencyComment1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/amdDependencyComment1.ts(3,21): error TS2307: Cannot find external module 'm2'. + + ==== tests/cases/compiler/amdDependencyComment1.ts (1 errors) ==== /// import m1 = require("m2") ~~~~ -!!! Cannot find external module 'm2'. +!!! error TS2307: Cannot find external module 'm2'. m1.f(); \ No newline at end of file diff --git a/tests/baselines/reference/amdDependencyComment2.errors.txt b/tests/baselines/reference/amdDependencyComment2.errors.txt index edab2e9c955..bddd4e334e6 100644 --- a/tests/baselines/reference/amdDependencyComment2.errors.txt +++ b/tests/baselines/reference/amdDependencyComment2.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/amdDependencyComment2.ts(3,21): error TS2307: Cannot find external module 'm2'. + + ==== tests/cases/compiler/amdDependencyComment2.ts (1 errors) ==== /// import m1 = require("m2") ~~~~ -!!! Cannot find external module 'm2'. +!!! error TS2307: Cannot find external module 'm2'. m1.f(); \ No newline at end of file diff --git a/tests/baselines/reference/anonymousModules.errors.txt b/tests/baselines/reference/anonymousModules.errors.txt index b50f7591968..43b3d544a8b 100644 --- a/tests/baselines/reference/anonymousModules.errors.txt +++ b/tests/baselines/reference/anonymousModules.errors.txt @@ -1,40 +1,55 @@ +tests/cases/compiler/anonymousModules.ts(1,8): error TS1005: ';' expected. +tests/cases/compiler/anonymousModules.ts(2,2): error TS1129: Statement expected. +tests/cases/compiler/anonymousModules.ts(2,2): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/anonymousModules.ts(4,9): error TS1005: ';' expected. +tests/cases/compiler/anonymousModules.ts(5,3): error TS1129: Statement expected. +tests/cases/compiler/anonymousModules.ts(6,2): error TS1128: Declaration or statement expected. +tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected. +tests/cases/compiler/anonymousModules.ts(13,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/anonymousModules.ts(1,1): error TS2304: Cannot find name 'module'. +tests/cases/compiler/anonymousModules.ts(4,2): error TS2304: Cannot find name 'module'. +tests/cases/compiler/anonymousModules.ts(5,14): error TS2395: Individual declarations in merged declaration bar must be all exported or all local. +tests/cases/compiler/anonymousModules.ts(8,6): error TS2395: Individual declarations in merged declaration bar must be all exported or all local. +tests/cases/compiler/anonymousModules.ts(10,2): error TS2304: Cannot find name 'module'. + + ==== tests/cases/compiler/anonymousModules.ts (13 errors) ==== module { ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~ -!!! Cannot find name 'module'. +!!! error TS2304: Cannot find name 'module'. export var foo = 1; ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. ~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. module { ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~ -!!! Cannot find name 'module'. +!!! error TS2304: Cannot find name 'module'. export var bar = 1; ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. ~~~ -!!! Individual declarations in merged declaration bar must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration bar must be all exported or all local. } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. var bar = 2; ~~~ -!!! Individual declarations in merged declaration bar must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration bar must be all exported or all local. module { ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~ -!!! Cannot find name 'module'. +!!! error TS2304: Cannot find name 'module'. var x = bar; } } ~ -!!! Declaration or statement expected. \ No newline at end of file +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/anyAsConstructor.errors.txt b/tests/baselines/reference/anyAsConstructor.errors.txt index ffd31da4045..147d7957906 100644 --- a/tests/baselines/reference/anyAsConstructor.errors.txt +++ b/tests/baselines/reference/anyAsConstructor.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/types/any/anyAsConstructor.ts(10,9): error TS2347: Untyped function calls may not accept type arguments. + + ==== tests/cases/conformance/types/any/anyAsConstructor.ts (1 errors) ==== // any is considered an untyped function call // can be called except with type arguments which is an error @@ -10,4 +13,4 @@ // grammar allows this for constructors var d = new x(x); // no error ~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. \ No newline at end of file +!!! error TS2347: Untyped function calls may not accept type arguments. \ No newline at end of file diff --git a/tests/baselines/reference/anyAsGenericFunctionCall.errors.txt b/tests/baselines/reference/anyAsGenericFunctionCall.errors.txt index 7fbe17d0e18..9dbee62e079 100644 --- a/tests/baselines/reference/anyAsGenericFunctionCall.errors.txt +++ b/tests/baselines/reference/anyAsGenericFunctionCall.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts(5,9): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts(6,9): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts(9,9): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts(10,9): error TS2347: Untyped function calls may not accept type arguments. + + ==== tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts (4 errors) ==== // any is considered an untyped function call // can be called except with type arguments which is an error @@ -5,15 +11,15 @@ var x: any; var a = x(); ~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. var b = x('hello'); ~~~~~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. class C { foo: string; } var c = x(x); ~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. var d = x(x); ~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. \ No newline at end of file +!!! error TS2347: Untyped function calls may not accept type arguments. \ No newline at end of file diff --git a/tests/baselines/reference/anyAssignableToEveryType2.errors.txt b/tests/baselines/reference/anyAssignableToEveryType2.errors.txt index 927fe3c6274..e5f9a07476e 100644 --- a/tests/baselines/reference/anyAssignableToEveryType2.errors.txt +++ b/tests/baselines/reference/anyAssignableToEveryType2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts(114,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts (1 errors) ==== // any is not a subtype of any other types, but is assignable, all the below should work @@ -114,7 +117,7 @@ interface I18 { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. [x: string]: U; foo: any; } diff --git a/tests/baselines/reference/anyDeclare.errors.txt b/tests/baselines/reference/anyDeclare.errors.txt index 0bb771b6d91..8eda3672f24 100644 --- a/tests/baselines/reference/anyDeclare.errors.txt +++ b/tests/baselines/reference/anyDeclare.errors.txt @@ -1,9 +1,15 @@ -==== tests/cases/compiler/anyDeclare.ts (1 errors) ==== +tests/cases/compiler/anyDeclare.ts(3,9): error TS2300: Duplicate identifier 'myFn'. +tests/cases/compiler/anyDeclare.ts(4,14): error TS2300: Duplicate identifier 'myFn'. + + +==== tests/cases/compiler/anyDeclare.ts (2 errors) ==== declare var x: any; module myMod { var myFn; + ~~~~ +!!! error TS2300: Duplicate identifier 'myFn'. function myFn() { } ~~~~ -!!! Duplicate identifier 'myFn'. +!!! error TS2300: Duplicate identifier 'myFn'. } \ No newline at end of file diff --git a/tests/baselines/reference/anyIdenticalToItself.errors.txt b/tests/baselines/reference/anyIdenticalToItself.errors.txt index 36c31825cb9..ea8583a6a75 100644 --- a/tests/baselines/reference/anyIdenticalToItself.errors.txt +++ b/tests/baselines/reference/anyIdenticalToItself.errors.txt @@ -1,19 +1,24 @@ +tests/cases/compiler/anyIdenticalToItself.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/anyIdenticalToItself.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/anyIdenticalToItself.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. + + ==== tests/cases/compiler/anyIdenticalToItself.ts (3 errors) ==== function foo(x: any); ~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo(x: any); function foo(x: any, y: number) { } class C { get X(): any { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var y: any; return y; } set X(v: any) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } \ No newline at end of file diff --git a/tests/baselines/reference/apparentTypeSubtyping.errors.txt b/tests/baselines/reference/apparentTypeSubtyping.errors.txt index f5725bd07ff..a9a97c22722 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.errors.txt +++ b/tests/baselines/reference/apparentTypeSubtyping.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSubtyping.ts(9,7): error TS2416: Class 'Derived' incorrectly extends base class 'Base': + Types of property 'x' are incompatible: + Type 'String' is not assignable to type 'string'. + + ==== tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSubtyping.ts (1 errors) ==== // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: @@ -9,9 +14,9 @@ // is String (S) a subtype of U extends String (T)? Would only be true if we used the apparent type of U (T) class Derived extends Base { // error ~~~~~~~ -!!! Class 'Derived' incorrectly extends base class 'Base': -!!! Types of property 'x' are incompatible: -!!! Type 'String' is not assignable to type 'string'. +!!! error TS2416: Class 'Derived' incorrectly extends base class 'Base': +!!! error TS2416: Types of property 'x' are incompatible: +!!! error TS2416: Type 'String' is not assignable to type 'string'. x: String; } diff --git a/tests/baselines/reference/apparentTypeSupertype.errors.txt b/tests/baselines/reference/apparentTypeSupertype.errors.txt index a2442d71222..78c667541d6 100644 --- a/tests/baselines/reference/apparentTypeSupertype.errors.txt +++ b/tests/baselines/reference/apparentTypeSupertype.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSupertype.ts(9,7): error TS2416: Class 'Derived' incorrectly extends base class 'Base': + Types of property 'x' are incompatible: + Type 'U' is not assignable to type 'string'. + + ==== tests/cases/conformance/types/typeRelationships/apparentType/apparentTypeSupertype.ts (1 errors) ==== // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: @@ -9,8 +14,8 @@ // is String (S) a subtype of U extends String (T)? Would only be true if we used the apparent type of U (T) class Derived extends Base { // error ~~~~~~~ -!!! Class 'Derived' incorrectly extends base class 'Base': -!!! Types of property 'x' are incompatible: -!!! Type 'U' is not assignable to type 'string'. +!!! error TS2416: Class 'Derived' incorrectly extends base class 'Base': +!!! error TS2416: Types of property 'x' are incompatible: +!!! error TS2416: Type 'U' is not assignable to type 'string'. x: U; } \ No newline at end of file diff --git a/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt b/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt index b894b6193eb..9d5847a77b0 100644 --- a/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt +++ b/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS2322: Type 'number' is not assignable to type 'IArguments': + Property 'length' is missing in type 'Number'. + + ==== tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts (1 errors) ==== var arguments = 10; function foo(a) { arguments = 10; /// This shouldnt be of type number and result in error. ~~~~~~~~~ -!!! Type 'number' is not assignable to type 'IArguments': -!!! Property 'length' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type 'IArguments': +!!! error TS2322: Property 'length' is missing in type 'Number'. } \ No newline at end of file diff --git a/tests/baselines/reference/arithAssignTyping.errors.txt b/tests/baselines/reference/arithAssignTyping.errors.txt index cdeaf948293..c4cd84639a6 100644 --- a/tests/baselines/reference/arithAssignTyping.errors.txt +++ b/tests/baselines/reference/arithAssignTyping.errors.txt @@ -1,39 +1,53 @@ +tests/cases/compiler/arithAssignTyping.ts(3,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/compiler/arithAssignTyping.ts(4,1): error TS2365: Operator '+=' cannot be applied to types 'typeof f' and 'number'. +tests/cases/compiler/arithAssignTyping.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithAssignTyping.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithAssignTyping.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithAssignTyping.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithAssignTyping.ts(9,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithAssignTyping.ts(10,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithAssignTyping.ts(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithAssignTyping.ts(12,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithAssignTyping.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithAssignTyping.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/compiler/arithAssignTyping.ts (12 errors) ==== class f { } f += ''; // error ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. f += 1; // error ~~~~~~ -!!! Operator '+=' cannot be applied to types 'typeof f' and 'number'. +!!! error TS2365: Operator '+=' cannot be applied to types 'typeof f' and 'number'. f -= 1; // error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. f *= 1; // error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. f /= 1; // error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. f %= 1; // error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. f &= 1; // error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. f |= 1; // error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. f <<= 1; // error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. f >>= 1; // error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. f >>>= 1; // error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. f ^= 1; // error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOnInvalidTypes.errors.txt b/tests/baselines/reference/arithmeticOnInvalidTypes.errors.txt index caa8c959d6f..2c042af6f86 100644 --- a/tests/baselines/reference/arithmeticOnInvalidTypes.errors.txt +++ b/tests/baselines/reference/arithmeticOnInvalidTypes.errors.txt @@ -1,21 +1,30 @@ +tests/cases/compiler/arithmeticOnInvalidTypes.ts(3,9): error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'. +tests/cases/compiler/arithmeticOnInvalidTypes.ts(4,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithmeticOnInvalidTypes.ts(4,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithmeticOnInvalidTypes.ts(5,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithmeticOnInvalidTypes.ts(5,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithmeticOnInvalidTypes.ts(6,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithmeticOnInvalidTypes.ts(6,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/compiler/arithmeticOnInvalidTypes.ts (7 errors) ==== var x: Number; var y: Number; var z = x + y; ~~~~~ -!!! Operator '+' cannot be applied to types 'Number' and 'Number'. +!!! error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'. var z2 = x - y; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var z3 = x * y; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var z4 = x / y; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOnInvalidTypes2.errors.txt b/tests/baselines/reference/arithmeticOnInvalidTypes2.errors.txt index 5cb6824846d..d5b74e5abc7 100644 --- a/tests/baselines/reference/arithmeticOnInvalidTypes2.errors.txt +++ b/tests/baselines/reference/arithmeticOnInvalidTypes2.errors.txt @@ -1,22 +1,31 @@ +tests/cases/compiler/arithmeticOnInvalidTypes2.ts(2,14): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. +tests/cases/compiler/arithmeticOnInvalidTypes2.ts(3,14): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithmeticOnInvalidTypes2.ts(3,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithmeticOnInvalidTypes2.ts(4,14): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithmeticOnInvalidTypes2.ts(4,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithmeticOnInvalidTypes2.ts(5,14): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/arithmeticOnInvalidTypes2.ts(5,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/compiler/arithmeticOnInvalidTypes2.ts (7 errors) ==== var obj = function f(a: T, b: T) { var z1 = a + b; ~~~~~ -!!! Operator '+' cannot be applied to types 'T' and 'T'. +!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. var z2 = a - b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var z3 = a * b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var z4 = a / b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. return a; }; \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.errors.txt index 359d6c8095a..0d376912b8d 100644 --- a/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.errors.txt @@ -1,4 +1,563 @@ -==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts (560 errors) ==== +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(15,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(17,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(18,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(19,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(21,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(22,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(22,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(23,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(24,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(24,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(25,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(25,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(26,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(26,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(29,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(31,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(32,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(33,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(35,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(36,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(36,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(37,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(38,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(38,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(39,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(39,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(40,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(40,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(42,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(43,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(43,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(44,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(45,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(45,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(46,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(46,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(47,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(47,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(49,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(50,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(50,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(51,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(52,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(52,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(53,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(53,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(54,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(54,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(57,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(59,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(60,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(61,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(64,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(66,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(67,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(68,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(72,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(74,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(75,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(76,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(78,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(79,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(79,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(80,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(81,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(81,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(82,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(82,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(83,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(83,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(86,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(88,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(89,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(90,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(92,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(93,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(93,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(94,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(95,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(95,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(96,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(96,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(97,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(97,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(99,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(100,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(100,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(101,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(102,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(102,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(103,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(103,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(104,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(104,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(106,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(107,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(107,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(108,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(109,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(109,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(110,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(110,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(111,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(111,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(114,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(116,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(117,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(118,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(121,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(123,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(124,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(125,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(129,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(131,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(132,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(133,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(135,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(136,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(136,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(137,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(138,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(138,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(139,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(139,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(140,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(140,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(143,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(145,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(146,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(147,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(149,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(150,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(150,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(151,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(152,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(152,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(153,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(153,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(154,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(154,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(156,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(157,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(157,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(158,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(159,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(159,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(160,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(160,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(161,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(161,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(163,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(164,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(164,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(165,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(166,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(166,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(167,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(167,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(168,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(168,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(171,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(173,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(174,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(175,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(178,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(180,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(181,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(182,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(186,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(188,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(189,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(190,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(192,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(193,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(193,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(194,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(195,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(195,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(196,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(196,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(197,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(197,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(200,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(202,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(203,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(204,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(206,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(207,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(207,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(208,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(209,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(209,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(210,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(210,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(211,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(211,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(213,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(214,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(214,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(215,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(216,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(216,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(217,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(217,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(218,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(218,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(220,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(221,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(221,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(222,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(223,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(223,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(224,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(224,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(225,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(225,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(228,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(230,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(231,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(232,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(235,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(237,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(238,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(239,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(243,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(245,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(246,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(247,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(249,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(250,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(250,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(251,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(252,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(252,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(253,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(253,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(254,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(254,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(257,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(259,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(260,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(261,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(263,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(264,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(264,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(265,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(266,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(266,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(267,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(267,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(268,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(268,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(270,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(271,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(271,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(272,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(273,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(273,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(274,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(274,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(275,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(275,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(277,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(278,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(278,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(279,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(280,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(280,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(281,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(281,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(282,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(282,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(285,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(287,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(288,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(289,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(292,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(294,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(295,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(296,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(300,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(302,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(303,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(304,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(306,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(307,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(307,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(308,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(309,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(309,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(310,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(310,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(311,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(311,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(314,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(316,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(317,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(318,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(320,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(321,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(321,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(322,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(323,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(323,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(324,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(324,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(325,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(325,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(327,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(328,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(328,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(329,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(330,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(330,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(331,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(331,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(332,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(332,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(334,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(335,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(335,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(336,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(337,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(337,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(338,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(338,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(339,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(339,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(342,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(344,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(345,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(346,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(349,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(351,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(352,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(353,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(357,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(359,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(360,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(361,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(363,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(364,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(364,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(365,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(366,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(366,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(367,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(367,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(368,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(368,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(371,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(373,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(374,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(375,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(377,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(378,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(378,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(379,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(380,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(380,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(381,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(381,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(382,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(382,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(384,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(385,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(385,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(386,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(387,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(387,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(388,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(388,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(389,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(389,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(391,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(392,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(392,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(393,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(394,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(394,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(395,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(395,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(396,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(396,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(399,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(401,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(402,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(403,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(406,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(408,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(409,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(410,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(414,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(416,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(417,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(418,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(420,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(421,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(422,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(423,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(423,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(424,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(424,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(425,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(425,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(428,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(430,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(431,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(432,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(434,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(435,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(435,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(436,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(437,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(437,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(438,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(438,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(439,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(439,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(441,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(442,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(442,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(443,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(444,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(444,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(445,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(445,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(446,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(446,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(448,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(449,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(449,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(450,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(451,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(451,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(452,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(452,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(453,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(453,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(456,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(458,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(459,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(460,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(463,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(465,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(466,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(467,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(471,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(473,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(474,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(475,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(477,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(478,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(479,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(480,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(480,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(481,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(481,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(482,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(482,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(485,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(487,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(488,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(489,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(491,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(492,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(492,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(493,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(494,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(494,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(495,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(495,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(496,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(496,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(498,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(499,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(499,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(500,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(501,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(501,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(502,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(502,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(503,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(503,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(505,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(506,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(506,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(507,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(508,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(508,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(509,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(509,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(510,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(510,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(513,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(515,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(516,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(517,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(520,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(522,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(523,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(524,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(528,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(530,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(531,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(532,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(534,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(535,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(536,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(537,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(537,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(538,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(538,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(539,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(539,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(542,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(544,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(545,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(546,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(548,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(549,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(549,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(550,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(551,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(551,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(552,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(552,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(553,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(553,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(555,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(556,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(556,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(557,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(558,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(558,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(559,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(559,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(560,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(560,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(562,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(563,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(563,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(564,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(565,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(565,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(566,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(566,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(567,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(567,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(570,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(572,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(573,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(574,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(577,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(579,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(580,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(581,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts (557 errors) ==== // these operators require their operands to be of type Any, the Number primitive type, or // an enum type enum E { a, b, c } @@ -15,1688 +574,1682 @@ var r1a1 = a * a; //ok var r1a2 = a * b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a3 = a * c; //ok var r1a4 = a * d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a5 = a * e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a6 = a * f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b1 = b * a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b2 = b * b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b3 = b * c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b4 = b * d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b5 = b * e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b6 = b * f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c1 = c * a; //ok var r1c2 = c * b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c3 = c * c; //ok var r1c4 = c * d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c5 = c * e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c6 = c * f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d1 = d * a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d2 = d * b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d3 = d * c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d4 = d * d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d5 = d * e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d6 = d * f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e1 = e * a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e2 = e * b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e3 = e * c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e4 = e * d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e5 = e * e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e6 = e * f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f1 = f * a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f2 = f * b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f3 = f * c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f4 = f * d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f5 = f * e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f6 = f * f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1g1 = E.a * a; //ok var r1g2 = E.a * b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1g3 = E.a * c; //ok var r1g4 = E.a * d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1g5 = E.a * e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1g6 = E.a * f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1h1 = a * E.b; //ok var r1h2 = b * E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1h3 = c * E.b; //ok var r1h4 = d * E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1h5 = e * E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1h6 = f * E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator / var r2a1 = a / a; //ok var r2a2 = a / b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a3 = a / c; //ok var r2a4 = a / d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a5 = a / e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a6 = a / f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b1 = b / a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b2 = b / b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b3 = b / c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b4 = b / d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b5 = b / e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b6 = b / f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c1 = c / a; //ok var r2c2 = c / b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c3 = c / c; //ok var r2c4 = c / d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c5 = c / e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c6 = c / f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d1 = d / a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d2 = d / b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d3 = d / c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d4 = d / d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d5 = d / e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d6 = d / f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e1 = e / a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e2 = e / b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e3 = e / c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e4 = e / d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e5 = e / e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e6 = e / f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2f1 = f / a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2f2 = f / b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2f3 = f / c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2f4 = f / d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2f5 = f / e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2f6 = f / f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2g1 = E.a / a; //ok var r2g2 = E.a / b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2g3 = E.a / c; //ok var r2g4 = E.a / d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2g5 = E.a / e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2g6 = E.a / f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2h1 = a / E.b; //ok var r2h2 = b / E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2h3 = c / E.b; //ok var r2h4 = d / E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2h5 = e / E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2h6 = f / E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator % var r3a1 = a % a; //ok var r3a2 = a % b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a3 = a % c; //ok var r3a4 = a % d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a5 = a % e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a6 = a % f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b1 = b % a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b2 = b % b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b3 = b % c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b4 = b % d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b5 = b % e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b6 = b % f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c1 = c % a; //ok var r3c2 = c % b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c3 = c % c; //ok var r3c4 = c % d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c5 = c % e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c6 = c % f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d1 = d % a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d2 = d % b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d3 = d % c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d4 = d % d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d5 = d % e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d6 = d % f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3e1 = e % a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3e2 = e % b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3e3 = e % c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3e4 = e % d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3e5 = e % e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3e6 = e % f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3f1 = f % a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3f2 = f % b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3f3 = f % c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3f4 = f % d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3f5 = f % e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3f6 = f % f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3g1 = E.a % a; //ok var r3g2 = E.a % b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3g3 = E.a % c; //ok var r3g4 = E.a % d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3g5 = E.a % e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3g6 = E.a % f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3h1 = a % E.b; //ok var r3h2 = b % E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3h3 = c % E.b; //ok var r3h4 = d % E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3h5 = e % E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3h6 = f % E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator - var r4a1 = a - a; //ok var r4a2 = a - b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a3 = a - c; //ok var r4a4 = a - d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a5 = a - e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a6 = a - f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b1 = b - a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b2 = b - b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b3 = b - c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b4 = b - d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b5 = b - e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b6 = b - f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c1 = c - a; //ok var r4c2 = c - b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c3 = c - c; //ok var r4c4 = c - d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c5 = c - e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c6 = c - f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d1 = d - a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d2 = d - b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d3 = d - c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d4 = d - d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d5 = d - e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d6 = d - f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4e1 = e - a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4e2 = e - b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4e3 = e - c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4e4 = e - d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4e5 = e - e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4e6 = e - f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4f1 = f - a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4f2 = f - b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4f3 = f - c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4f4 = f - d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4f5 = f - e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4f6 = f - f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4g1 = E.a - a; //ok var r4g2 = E.a - b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4g3 = E.a - c; //ok var r4g4 = E.a - d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4g5 = E.a - e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4g6 = E.a - f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4h1 = a - E.b; //ok var r4h2 = b - E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4h3 = c - E.b; //ok var r4h4 = d - E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4h5 = e - E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4h6 = f - E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator << var r5a1 = a << a; //ok var r5a2 = a << b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a3 = a << c; //ok var r5a4 = a << d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a5 = a << e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a6 = a << f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b1 = b << a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b2 = b << b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b3 = b << c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b4 = b << d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b5 = b << e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b6 = b << f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c1 = c << a; //ok var r5c2 = c << b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c3 = c << c; //ok var r5c4 = c << d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c5 = c << e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c6 = c << f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d1 = d << a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d2 = d << b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d3 = d << c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d4 = d << d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d5 = d << e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d6 = d << f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5e1 = e << a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5e2 = e << b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5e3 = e << c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5e4 = e << d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5e5 = e << e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5e6 = e << f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5f1 = f << a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5f2 = f << b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5f3 = f << c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5f4 = f << d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5f5 = f << e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5f6 = f << f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5g1 = E.a << a; //ok var r5g2 = E.a << b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5g3 = E.a << c; //ok var r5g4 = E.a << d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5g5 = E.a << e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5g6 = E.a << f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5h1 = a << E.b; //ok var r5h2 = b << E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5h3 = c << E.b; //ok var r5h4 = d << E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5h5 = e << E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5h6 = f << E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator >> var r6a1 = a >> a; //ok var r6a2 = a >> b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a3 = a >> c; //ok var r6a4 = a >> d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a5 = a >> e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a6 = a >> f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b1 = b >> a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b2 = b >> b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b3 = b >> c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b4 = b >> d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b5 = b >> e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b6 = b >> f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c1 = c >> a; //ok var r6c2 = c >> b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c3 = c >> c; //ok var r6c4 = c >> d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c5 = c >> e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c6 = c >> f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d1 = d >> a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d2 = d >> b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d3 = d >> c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d4 = d >> d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d5 = d >> e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d6 = d >> f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6e1 = e >> a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6e2 = e >> b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6e3 = e >> c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6e4 = e >> d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6e5 = e >> e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6e6 = e >> f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6f1 = f >> a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6f2 = f >> b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6f3 = f >> c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6f4 = f >> d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6f5 = f >> e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6f6 = f >> f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6g1 = E.a >> a; //ok var r6g2 = E.a >> b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6g3 = E.a >> c; //ok var r6g4 = E.a >> d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6g5 = E.a >> e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6g6 = E.a >> f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6h1 = a >> E.b; //ok var r6h2 = b >> E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6h3 = c >> E.b; //ok var r6h4 = d >> E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6h5 = e >> E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6h6 = f >> E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator >>> var r7a1 = a >>> a; //ok var r7a2 = a >>> b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a3 = a >>> c; //ok var r7a4 = a >>> d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a5 = a >>> e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a6 = a >>> f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b1 = b >>> a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b2 = b >>> b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b3 = b >>> c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b4 = b >>> d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b5 = b >>> e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b6 = b >>> f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c1 = c >>> a; //ok var r7c2 = c >>> b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c3 = c >>> c; //ok var r7c4 = c >>> d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c5 = c >>> e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c6 = c >>> f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d1 = d >>> a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d2 = d >>> b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d3 = d >>> c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d4 = d >>> d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d5 = d >>> e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d6 = d >>> f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7e1 = e >>> a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7e2 = e >>> b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7e3 = e >>> c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7e4 = e >>> d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7e5 = e >>> e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7e6 = e >>> f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7f1 = f >>> a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7f2 = f >>> b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7f3 = f >>> c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7f4 = f >>> d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7f5 = f >>> e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7f6 = f >>> f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7g1 = E.a >>> a; //ok var r7g2 = E.a >>> b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7g3 = E.a >>> c; //ok var r7g4 = E.a >>> d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7g5 = E.a >>> e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7g6 = E.a >>> f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7h1 = a >>> E.b; //ok var r7h2 = b >>> E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7h3 = c >>> E.b; //ok var r7h4 = d >>> E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7h5 = e >>> E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7h6 = f >>> E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator & var r8a1 = a & a; //ok var r8a2 = a & b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8a3 = a & c; //ok var r8a4 = a & d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8a5 = a & e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8a6 = a & f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b1 = b & a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b2 = b & b; - ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. var r8b3 = b & c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b4 = b & d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b5 = b & e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b6 = b & f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c1 = c & a; //ok var r8c2 = c & b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c3 = c & c; //ok var r8c4 = c & d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c5 = c & e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c6 = c & f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d1 = d & a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d2 = d & b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d3 = d & c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d4 = d & d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d5 = d & e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d6 = d & f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8e1 = e & a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8e2 = e & b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8e3 = e & c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8e4 = e & d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8e5 = e & e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8e6 = e & f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8f1 = f & a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8f2 = f & b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8f3 = f & c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8f4 = f & d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8f5 = f & e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8f6 = f & f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8g1 = E.a & a; //ok var r8g2 = E.a & b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8g3 = E.a & c; //ok var r8g4 = E.a & d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8g5 = E.a & e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8g6 = E.a & f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8h1 = a & E.b; //ok var r8h2 = b & E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8h3 = c & E.b; //ok var r8h4 = d & E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8h5 = e & E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8h6 = f & E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator ^ var r9a1 = a ^ a; //ok var r9a2 = a ^ b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9a3 = a ^ c; //ok var r9a4 = a ^ d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9a5 = a ^ e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9a6 = a ^ f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b1 = b ^ a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b2 = b ^ b; - ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. var r9b3 = b ^ c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b4 = b ^ d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b5 = b ^ e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b6 = b ^ f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c1 = c ^ a; //ok var r9c2 = c ^ b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c3 = c ^ c; //ok var r9c4 = c ^ d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c5 = c ^ e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c6 = c ^ f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d1 = d ^ a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d2 = d ^ b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d3 = d ^ c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d4 = d ^ d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d5 = d ^ e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d6 = d ^ f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9e1 = e ^ a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9e2 = e ^ b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9e3 = e ^ c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9e4 = e ^ d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9e5 = e ^ e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9e6 = e ^ f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9f1 = f ^ a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9f2 = f ^ b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9f3 = f ^ c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9f4 = f ^ d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9f5 = f ^ e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9f6 = f ^ f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9g1 = E.a ^ a; //ok var r9g2 = E.a ^ b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9g3 = E.a ^ c; //ok var r9g4 = E.a ^ d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9g5 = E.a ^ e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9g6 = E.a ^ f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9h1 = a ^ E.b; //ok var r9h2 = b ^ E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9h3 = c ^ E.b; //ok var r9h4 = d ^ E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9h5 = e ^ E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9h6 = f ^ E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator | var r10a1 = a | a; //ok var r10a2 = a | b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10a3 = a | c; //ok var r10a4 = a | d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10a5 = a | e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10a6 = a | f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b1 = b | a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b2 = b | b; - ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~ +!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. var r10b3 = b | c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b4 = b | d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b5 = b | e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b6 = b | f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c1 = c | a; //ok var r10c2 = c | b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c3 = c | c; //ok var r10c4 = c | d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c5 = c | e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c6 = c | f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d1 = d | a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d2 = d | b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d3 = d | c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d4 = d | d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d5 = d | e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d6 = d | f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10e1 = e | a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10e2 = e | b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10e3 = e | c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10e4 = e | d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10e5 = e | e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10e6 = e | f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10f1 = f | a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10f2 = f | b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10f3 = f | c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10f4 = f | d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10f5 = f | e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10f6 = f | f; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10g1 = E.a | a; //ok var r10g2 = E.a | b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10g3 = E.a | c; //ok var r10g4 = E.a | d; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10g5 = E.a | e; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10g6 = E.a | f; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10h1 = a | E.b; //ok var r10h2 = b | E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10h3 = c | E.b; //ok var r10h4 = d | E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10h5 = e | E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10h6 = f | E.b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt b/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt index 43c223bcd48..c043cda8e68 100644 --- a/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt +++ b/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt @@ -1,4 +1,234 @@ -==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts (240 errors) ==== +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(9,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(9,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(10,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(10,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(11,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(11,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(13,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(13,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(14,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(14,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(15,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(15,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(17,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(17,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(18,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(18,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(19,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(19,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(21,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(21,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(22,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(22,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(23,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(23,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(26,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(26,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(27,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(27,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(28,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(28,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(30,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(30,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(31,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(31,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(32,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(32,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(34,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(34,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(35,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(35,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(36,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(36,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(38,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(38,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(39,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(39,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(40,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(40,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(43,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(43,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(44,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(44,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(45,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(45,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(47,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(47,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(48,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(48,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(49,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(49,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(51,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(51,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(52,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(52,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(53,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(53,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(55,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(55,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(56,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(56,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(57,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(57,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(60,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(60,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(61,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(61,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(62,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(62,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(64,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(64,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(65,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(65,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(66,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(66,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(68,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(68,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(69,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(69,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(70,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(70,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(72,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(72,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(73,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(73,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(74,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(74,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(77,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(77,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(78,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(78,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(79,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(79,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(81,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(81,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(82,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(82,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(83,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(83,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(85,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(85,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(86,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(86,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(87,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(87,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(89,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(89,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(90,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(90,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(91,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(91,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(94,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(94,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(95,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(95,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(96,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(96,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(98,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(98,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(99,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(99,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(100,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(100,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(102,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(102,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(103,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(103,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(104,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(104,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(106,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(106,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(107,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(107,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(108,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(108,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(111,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(111,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(112,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(112,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(113,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(113,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(115,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(115,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(116,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(116,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(117,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(117,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(119,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(119,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(120,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(120,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(121,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(121,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(123,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(123,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(124,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(124,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(125,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(125,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(128,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(129,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(129,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(130,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(130,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(132,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(133,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(133,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(134,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(134,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(136,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(137,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(137,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(138,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(138,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(140,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(141,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(141,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(142,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(142,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(145,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(146,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(146,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(147,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(147,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(149,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(150,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(150,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(151,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(151,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(153,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(154,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(154,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(155,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(155,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(157,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(158,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(158,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(159,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(159,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(162,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(163,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(163,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(164,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(164,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(166,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(167,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(167,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(168,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(168,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(170,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(171,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(171,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(172,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(172,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(174,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(175,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(175,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(176,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(176,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts (228 errors) ==== // If one operand is the null or undefined value, it is treated as having the type of the // other operand. @@ -9,649 +239,625 @@ // operator * var r1a1 = null * a; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a2 = null * b; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a3 = null * c; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b1 = a * null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b2 = b * null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b3 = c * null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c1 = null * true; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c2 = null * ''; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c3 = null * {}; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d1 = true * null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d2 = '' * null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d3 = {} * null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator / var r2a1 = null / a; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a2 = null / b; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a3 = null / c; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b1 = a / null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b2 = b / null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b3 = c / null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c1 = null / true; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c2 = null / ''; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c3 = null / {}; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d1 = true / null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d2 = '' / null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d3 = {} / null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator % var r3a1 = null % a; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a2 = null % b; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a3 = null % c; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b1 = a % null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b2 = b % null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b3 = c % null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c1 = null % true; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c2 = null % ''; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c3 = null % {}; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d1 = true % null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d2 = '' % null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d3 = {} % null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator - var r4a1 = null - a; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a2 = null - b; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a3 = null - c; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b1 = a - null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b2 = b - null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b3 = c - null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c1 = null - true; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c2 = null - ''; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c3 = null - {}; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d1 = true - null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d2 = '' - null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d3 = {} - null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator << var r5a1 = null << a; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a2 = null << b; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a3 = null << c; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b1 = a << null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b2 = b << null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b3 = c << null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c1 = null << true; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c2 = null << ''; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c3 = null << {}; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d1 = true << null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d2 = '' << null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d3 = {} << null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator >> var r6a1 = null >> a; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a2 = null >> b; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a3 = null >> c; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b1 = a >> null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b2 = b >> null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b3 = c >> null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c1 = null >> true; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c2 = null >> ''; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c3 = null >> {}; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d1 = true >> null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d2 = '' >> null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d3 = {} >> null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator >>> var r7a1 = null >>> a; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a2 = null >>> b; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a3 = null >>> c; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b1 = a >>> null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b2 = b >>> null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b3 = c >>> null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c1 = null >>> true; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c2 = null >>> ''; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c3 = null >>> {}; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d1 = true >>> null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d2 = '' >>> null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d3 = {} >>> null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator & var r8a1 = null & a; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~ +!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. var r8a2 = null & b; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8a3 = null & c; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b1 = a & null; - ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~ +!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. var r8b2 = b & null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b3 = c & null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c1 = null & true; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~ +!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. var r8c2 = null & ''; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c3 = null & {}; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d1 = true & null; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~ +!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. var r8d2 = '' & null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d3 = {} & null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator ^ var r9a1 = null ^ a; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~ +!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. var r9a2 = null ^ b; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9a3 = null ^ c; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b1 = a ^ null; - ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~ +!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. var r9b2 = b ^ null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b3 = c ^ null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c1 = null ^ true; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~ +!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. var r9c2 = null ^ ''; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c3 = null ^ {}; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d1 = true ^ null; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~ +!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. var r9d2 = '' ^ null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d3 = {} ^ null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator | var r10a1 = null | a; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~ +!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. var r10a2 = null | b; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10a3 = null | c; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b1 = a | null; - ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~ +!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. var r10b2 = b | null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b3 = c | null; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c1 = null | true; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~ +!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. var r10c2 = null | ''; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c3 = null | {}; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d1 = true | null; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~ +!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. var r10d2 = '' | null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d3 = {} | null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.errors.txt b/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.errors.txt index dd63c076c71..d00eee1d4dd 100644 --- a/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.errors.txt +++ b/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.errors.txt @@ -1,220 +1,302 @@ +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(2,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(2,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(3,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(3,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(4,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(4,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(5,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(5,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(8,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(8,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(9,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(9,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(10,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(10,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(11,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(11,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(14,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(14,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(15,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(15,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(16,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(16,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(17,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(17,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(20,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(20,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(21,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(21,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(22,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(22,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(23,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(23,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(26,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(26,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(27,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(27,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(28,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(28,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(29,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(29,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(32,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(32,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(33,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(33,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(34,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(34,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(35,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(35,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(38,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(38,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(39,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(39,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(40,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(40,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(41,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(41,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(44,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(44,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(45,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(45,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(46,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(46,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(47,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(47,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(50,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(50,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(51,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(51,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(52,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(52,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(53,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(53,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(56,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(56,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(57,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(57,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(58,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(58,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(59,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(59,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts (80 errors) ==== // operator * var ra1 = null * null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var ra2 = null * undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var ra3 = undefined * null; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var ra4 = undefined * undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator / var rb1 = null / null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rb2 = null / undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rb3 = undefined / null; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rb4 = undefined / undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator % var rc1 = null % null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rc2 = null % undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rc3 = undefined % null; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rc4 = undefined % undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator - var rd1 = null - null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rd2 = null - undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rd3 = undefined - null; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rd4 = undefined - undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator << var re1 = null << null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var re2 = null << undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var re3 = undefined << null; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var re4 = undefined << undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator >> var rf1 = null >> null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rf2 = null >> undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rf3 = undefined >> null; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rf4 = undefined >> undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator >>> var rg1 = null >>> null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rg2 = null >>> undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rg3 = undefined >>> null; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rg4 = undefined >>> undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator & var rh1 = null & null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rh2 = null & undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rh3 = undefined & null; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rh4 = undefined & undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator ^ var ri1 = null ^ null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var ri2 = null ^ undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var ri3 = undefined ^ null; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var ri4 = undefined ^ undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator | var rj1 = null | null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rj2 = null | undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rj3 = undefined | null; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var rj4 = undefined | undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOperatorWithTypeParameter.errors.txt b/tests/baselines/reference/arithmeticOperatorWithTypeParameter.errors.txt index afc7a7ee392..a1de1f0c795 100644 --- a/tests/baselines/reference/arithmeticOperatorWithTypeParameter.errors.txt +++ b/tests/baselines/reference/arithmeticOperatorWithTypeParameter.errors.txt @@ -1,3 +1,185 @@ +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(9,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(10,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(11,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(12,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(13,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(14,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(15,22): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(16,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(17,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(18,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(20,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(21,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(22,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(23,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(24,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(25,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(26,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(27,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(28,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(29,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(31,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(31,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(32,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(32,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(33,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(33,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(34,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(34,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(35,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(35,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(36,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(36,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(37,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(37,22): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(38,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(38,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(39,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(39,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(40,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(40,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(42,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(42,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(43,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(43,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(44,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(44,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(45,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(45,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(46,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(46,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(47,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(47,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(48,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(48,22): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(49,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(49,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(50,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(50,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(51,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(51,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(53,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(54,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(55,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(56,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(57,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(58,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(59,22): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(60,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(61,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(62,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(64,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(65,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(66,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(67,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(68,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(69,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(70,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(71,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(72,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(73,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(75,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(75,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(76,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(76,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(77,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(77,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(78,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(78,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(79,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(79,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(80,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(80,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(81,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(81,22): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(82,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(82,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(83,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(83,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(84,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(84,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(86,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(86,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(87,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(87,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(88,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(88,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(89,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(89,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(90,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(90,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(91,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(91,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(92,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(92,22): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(93,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(93,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(94,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(94,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(95,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(95,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(97,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(97,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(98,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(98,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(99,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(99,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(100,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(100,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(101,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(101,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(102,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(102,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(103,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(103,22): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(104,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(104,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(105,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(105,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(106,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(106,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(108,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(108,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(109,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(109,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(110,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(110,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(111,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(111,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(112,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(112,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(113,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(113,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(114,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(114,22): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(115,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(115,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(116,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(116,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(117,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(117,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(119,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(119,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(120,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(120,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(121,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(121,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(122,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(122,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(123,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(123,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(124,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(124,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(125,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(125,22): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(126,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(126,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(127,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(127,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(128,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts(128,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithTypeParameter.ts (180 errors) ==== // type parameter type is not valid for arithmetic operand function foo(t: T) { @@ -9,482 +191,482 @@ var r1a1 = a * t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a2 = a / t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a3 = a % t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a4 = a - t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a5 = a << t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a6 = a >> t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a7 = a >>> t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a8 = a & t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a9 = a ^ t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a10 = a | t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a1 = t * a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a2 = t / a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a3 = t % a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a4 = t - a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a5 = t << a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a6 = t >> a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a7 = t >>> a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a8 = t & a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a9 = t ^ a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a10 = t | a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b1 = b * t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b2 = b / t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b3 = b % t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b4 = b - t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b5 = b << t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b6 = b >> t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b7 = b >>> t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b8 = b & t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b9 = b ^ t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b10 = b | t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b1 = t * b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b2 = t / b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b3 = t % b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b4 = t - b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b5 = t << b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b6 = t >> b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b7 = t >>> b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b8 = t & b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b9 = t ^ b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b10 = t | b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c1 = c * t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c2 = c / t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c3 = c % t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c4 = c - t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c5 = c << t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c6 = c >> t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c7 = c >>> t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c8 = c & t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c9 = c ^ t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c10 = c | t; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c1 = t * c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c2 = t / c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c3 = t % c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c4 = t - c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c5 = t << c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c6 = t >> c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c7 = t >>> c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c8 = t & c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c9 = t ^ c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c10 = t | c; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d1 = d * t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d2 = d / t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d3 = d % t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d4 = d - t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d5 = d << t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d6 = d >> t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d7 = d >>> t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d8 = d & t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d9 = d ^ t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d10 = d | t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d1 = t * d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d2 = t / d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d3 = t % d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d4 = t - d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d5 = t << d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d6 = t >> d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d7 = t >>> d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d8 = t & d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d9 = t ^ d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d10 = t | d; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e1 = e * t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e2 = e / t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e3 = e % t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e4 = e - t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e5 = e << t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e6 = e >> t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e7 = e >>> t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e8 = e & t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e9 = e ^ t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1e10 = e | t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e1 = t * e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e2 = t / e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e3 = t % e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e4 = t - e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e5 = t << e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e6 = t >> e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e7 = t >>> e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e8 = t & e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e9 = t ^ e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2e10 = t | e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f1 = t * t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f2 = t / t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f3 = t % t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f4 = t - t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f5 = t << t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f6 = t >> t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f7 = t >>> t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f8 = t & t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f9 = t ^ t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1f10 = t | t; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. } \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt index 9552e5400d4..9ee53c2f15c 100644 --- a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt +++ b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt @@ -1,4 +1,234 @@ -==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts (240 errors) ==== +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(9,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(9,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(10,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(10,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(11,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(11,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(13,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(13,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(14,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(14,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(15,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(15,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(17,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(17,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(18,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(18,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(19,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(19,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(21,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(21,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(22,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(22,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(23,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(23,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(26,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(26,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(27,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(27,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(28,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(28,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(30,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(30,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(31,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(31,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(32,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(32,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(34,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(34,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(35,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(35,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(36,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(36,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(38,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(38,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(39,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(39,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(40,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(40,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(43,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(43,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(44,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(44,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(45,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(45,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(47,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(47,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(48,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(48,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(49,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(49,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(51,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(51,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(52,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(52,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(53,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(53,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(55,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(55,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(56,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(56,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(57,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(57,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(60,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(60,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(61,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(61,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(62,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(62,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(64,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(64,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(65,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(65,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(66,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(66,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(68,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(68,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(69,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(69,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(70,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(70,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(72,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(72,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(73,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(73,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(74,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(74,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(77,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(77,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(78,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(78,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(79,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(79,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(81,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(81,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(82,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(82,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(83,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(83,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(85,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(85,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(86,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(86,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(87,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(87,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(89,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(89,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(90,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(90,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(91,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(91,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(94,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(94,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(95,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(95,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(96,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(96,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(98,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(98,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(99,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(99,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(100,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(100,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(102,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(102,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(103,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(103,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(104,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(104,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(106,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(106,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(107,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(107,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(108,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(108,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(111,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(111,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(112,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(112,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(113,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(113,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(115,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(115,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(116,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(116,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(117,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(117,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(119,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(119,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(120,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(120,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(121,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(121,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(123,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(123,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(124,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(124,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(125,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(125,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(128,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(129,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(129,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(130,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(130,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(132,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(133,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(133,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(134,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(134,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(136,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(137,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(137,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(138,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(138,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(140,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(141,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(141,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(142,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(142,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(145,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(146,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(146,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(147,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(147,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(149,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(150,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(150,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(151,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(151,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(153,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(154,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(154,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(155,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(155,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(157,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(158,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(158,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(159,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(159,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(162,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(163,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(163,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(164,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(164,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(166,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(167,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(167,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(168,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(168,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(170,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(171,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(171,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(172,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(172,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(174,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(175,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(175,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(176,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(176,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts (228 errors) ==== // If one operand is the undefined or undefined value, it is treated as having the type of the // other operand. @@ -9,649 +239,625 @@ // operator * var r1a1 = undefined * a; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a2 = undefined * b; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a3 = undefined * c; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b1 = a * undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b2 = b * undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1b3 = c * undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c1 = undefined * true; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c2 = undefined * ''; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c3 = undefined * {}; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d1 = true * undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d2 = '' * undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1d3 = {} * undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator / var r2a1 = undefined / a; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a2 = undefined / b; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a3 = undefined / c; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b1 = a / undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b2 = b / undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2b3 = c / undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c1 = undefined / true; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c2 = undefined / ''; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c3 = undefined / {}; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d1 = true / undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d2 = '' / undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2d3 = {} / undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator % var r3a1 = undefined % a; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a2 = undefined % b; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a3 = undefined % c; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b1 = a % undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b2 = b % undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3b3 = c % undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c1 = undefined % true; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c2 = undefined % ''; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c3 = undefined % {}; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d1 = true % undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d2 = '' % undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3d3 = {} % undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator - var r4a1 = undefined - a; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a2 = undefined - b; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a3 = undefined - c; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b1 = a - undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b2 = b - undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4b3 = c - undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c1 = undefined - true; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c2 = undefined - ''; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c3 = undefined - {}; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d1 = true - undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d2 = '' - undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4d3 = {} - undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator << var r5a1 = undefined << a; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a2 = undefined << b; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a3 = undefined << c; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b1 = a << undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b2 = b << undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5b3 = c << undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c1 = undefined << true; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c2 = undefined << ''; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c3 = undefined << {}; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d1 = true << undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d2 = '' << undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5d3 = {} << undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator >> var r6a1 = undefined >> a; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a2 = undefined >> b; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a3 = undefined >> c; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b1 = a >> undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b2 = b >> undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6b3 = c >> undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c1 = undefined >> true; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c2 = undefined >> ''; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c3 = undefined >> {}; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d1 = true >> undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d2 = '' >> undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6d3 = {} >> undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator >>> var r7a1 = undefined >>> a; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a2 = undefined >>> b; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a3 = undefined >>> c; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b1 = a >>> undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b2 = b >>> undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7b3 = c >>> undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c1 = undefined >>> true; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c2 = undefined >>> ''; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c3 = undefined >>> {}; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d1 = true >>> undefined; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d2 = '' >>> undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7d3 = {} >>> undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator & var r8a1 = undefined & a; - ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~ +!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. var r8a2 = undefined & b; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8a3 = undefined & c; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b1 = a & undefined; - ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~ +!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. var r8b2 = b & undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b3 = c & undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c1 = undefined & true; - ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~~~~ +!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. var r8c2 = undefined & ''; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c3 = undefined & {}; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d1 = true & undefined; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~~~~ +!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. var r8d2 = '' & undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d3 = {} & undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator ^ var r9a1 = undefined ^ a; - ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~ +!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. var r9a2 = undefined ^ b; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9a3 = undefined ^ c; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b1 = a ^ undefined; - ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~ +!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. var r9b2 = b ^ undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b3 = c ^ undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c1 = undefined ^ true; - ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~~~~ +!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. var r9c2 = undefined ^ ''; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c3 = undefined ^ {}; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d1 = true ^ undefined; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~~~~ +!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. var r9d2 = '' ^ undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d3 = {} ^ undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // operator | var r10a1 = undefined | a; - ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~ +!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. var r10a2 = undefined | b; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10a3 = undefined | c; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b1 = a | undefined; - ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~ +!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. var r10b2 = b | undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b3 = c | undefined; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c1 = undefined | true; - ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~~~~ +!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. var r10c2 = undefined | ''; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c3 = undefined | {}; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d1 = true | undefined; - ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~~~~~~~~ +!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. var r10d2 = '' | undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d3 = {} | undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/arrayAssignmentTest1.errors.txt b/tests/baselines/reference/arrayAssignmentTest1.errors.txt index e14bacb3cb4..926bf0d4316 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest1.errors.txt @@ -1,3 +1,52 @@ +tests/cases/compiler/arrayAssignmentTest1.ts(46,5): error TS2322: Type 'undefined[]' is not assignable to type 'I1': + Property 'IM1' is missing in type 'undefined[]'. +tests/cases/compiler/arrayAssignmentTest1.ts(47,5): error TS2322: Type 'undefined[]' is not assignable to type 'C1': + Property 'IM1' is missing in type 'undefined[]'. +tests/cases/compiler/arrayAssignmentTest1.ts(48,5): error TS2322: Type 'undefined[]' is not assignable to type 'C2': + Property 'C2M1' is missing in type 'undefined[]'. +tests/cases/compiler/arrayAssignmentTest1.ts(49,5): error TS2322: Type 'undefined[]' is not assignable to type 'C3': + Property 'CM3M1' is missing in type 'undefined[]'. +tests/cases/compiler/arrayAssignmentTest1.ts(60,1): error TS2322: Type 'C3[]' is not assignable to type 'I1[]': + Type 'C3' is not assignable to type 'I1': + Property 'IM1' is missing in type 'C3'. +tests/cases/compiler/arrayAssignmentTest1.ts(64,1): error TS2322: Type 'I1[]' is not assignable to type 'C1[]': + Type 'I1' is not assignable to type 'C1': + Property 'C1M1' is missing in type 'I1'. +tests/cases/compiler/arrayAssignmentTest1.ts(65,1): error TS2322: Type 'C3[]' is not assignable to type 'C1[]': + Type 'C3' is not assignable to type 'C1': + Property 'IM1' is missing in type 'C3'. +tests/cases/compiler/arrayAssignmentTest1.ts(68,1): error TS2322: Type 'C1[]' is not assignable to type 'C2[]': + Type 'C1' is not assignable to type 'C2': + Property 'C2M1' is missing in type 'C1'. +tests/cases/compiler/arrayAssignmentTest1.ts(69,1): error TS2322: Type 'I1[]' is not assignable to type 'C2[]': + Type 'I1' is not assignable to type 'C2': + Property 'C2M1' is missing in type 'I1'. +tests/cases/compiler/arrayAssignmentTest1.ts(70,1): error TS2322: Type 'C3[]' is not assignable to type 'C2[]': + Type 'C3' is not assignable to type 'C2': + Property 'C2M1' is missing in type 'C3'. +tests/cases/compiler/arrayAssignmentTest1.ts(75,1): error TS2322: Type 'C2[]' is not assignable to type 'C3[]': + Type 'C2' is not assignable to type 'C3': + Property 'CM3M1' is missing in type 'C2'. +tests/cases/compiler/arrayAssignmentTest1.ts(76,1): error TS2322: Type 'C1[]' is not assignable to type 'C3[]': + Type 'C1' is not assignable to type 'C3': + Property 'CM3M1' is missing in type 'C1'. +tests/cases/compiler/arrayAssignmentTest1.ts(77,1): error TS2322: Type 'I1[]' is not assignable to type 'C3[]': + Type 'I1' is not assignable to type 'C3': + Property 'CM3M1' is missing in type 'I1'. +tests/cases/compiler/arrayAssignmentTest1.ts(79,1): error TS2322: Type '() => C1' is not assignable to type 'any[]': + Property 'push' is missing in type '() => C1'. +tests/cases/compiler/arrayAssignmentTest1.ts(80,1): error TS2322: Type '{ one: number; }' is not assignable to type 'any[]': + Property 'length' is missing in type '{ one: number; }'. +tests/cases/compiler/arrayAssignmentTest1.ts(82,1): error TS2322: Type 'C1' is not assignable to type 'any[]': + Property 'length' is missing in type 'C1'. +tests/cases/compiler/arrayAssignmentTest1.ts(83,1): error TS2322: Type 'C2' is not assignable to type 'any[]': + Property 'length' is missing in type 'C2'. +tests/cases/compiler/arrayAssignmentTest1.ts(84,1): error TS2322: Type 'C3' is not assignable to type 'any[]': + Property 'length' is missing in type 'C3'. +tests/cases/compiler/arrayAssignmentTest1.ts(85,1): error TS2322: Type 'I1' is not assignable to type 'any[]': + Property 'length' is missing in type 'I1'. + + ==== tests/cases/compiler/arrayAssignmentTest1.ts (19 errors) ==== interface I1 { IM1():void[]; @@ -46,20 +95,20 @@ var i1_error: I1 = []; // should be an error - is ~~~~~~~~ -!!! Type 'undefined[]' is not assignable to type 'I1': -!!! Property 'IM1' is missing in type 'undefined[]'. +!!! error TS2322: Type 'undefined[]' is not assignable to type 'I1': +!!! error TS2322: Property 'IM1' is missing in type 'undefined[]'. var c1_error: C1 = []; // should be an error - is ~~~~~~~~ -!!! Type 'undefined[]' is not assignable to type 'C1': -!!! Property 'IM1' is missing in type 'undefined[]'. +!!! error TS2322: Type 'undefined[]' is not assignable to type 'C1': +!!! error TS2322: Property 'IM1' is missing in type 'undefined[]'. var c2_error: C2 = []; // should be an error - is ~~~~~~~~ -!!! Type 'undefined[]' is not assignable to type 'C2': -!!! Property 'C2M1' is missing in type 'undefined[]'. +!!! error TS2322: Type 'undefined[]' is not assignable to type 'C2': +!!! error TS2322: Property 'C2M1' is missing in type 'undefined[]'. var c3_error: C3 = []; // should be an error - is ~~~~~~~~ -!!! Type 'undefined[]' is not assignable to type 'C3': -!!! Property 'CM3M1' is missing in type 'undefined[]'. +!!! error TS2322: Type 'undefined[]' is not assignable to type 'C3': +!!! error TS2322: Property 'CM3M1' is missing in type 'undefined[]'. arr_any = arr_i1; // should be ok - is @@ -72,81 +121,81 @@ arr_i1 = arr_c2; // should be ok - subtype relationship - is arr_i1 = arr_c3; // should be an error - is ~~~~~~ -!!! Type 'C3[]' is not assignable to type 'I1[]': -!!! Type 'C3' is not assignable to type 'I1': -!!! Property 'IM1' is missing in type 'C3'. +!!! error TS2322: Type 'C3[]' is not assignable to type 'I1[]': +!!! error TS2322: Type 'C3' is not assignable to type 'I1': +!!! error TS2322: Property 'IM1' is missing in type 'C3'. arr_c1 = arr_c1; // should be ok - subtype relationship - is arr_c1 = arr_c2; // should be ok - subtype relationship - is arr_c1 = arr_i1; // should be an error - is ~~~~~~ -!!! Type 'I1[]' is not assignable to type 'C1[]': -!!! Type 'I1' is not assignable to type 'C1': -!!! Property 'C1M1' is missing in type 'I1'. +!!! error TS2322: Type 'I1[]' is not assignable to type 'C1[]': +!!! error TS2322: Type 'I1' is not assignable to type 'C1': +!!! error TS2322: Property 'C1M1' is missing in type 'I1'. arr_c1 = arr_c3; // should be an error - is ~~~~~~ -!!! Type 'C3[]' is not assignable to type 'C1[]': -!!! Type 'C3' is not assignable to type 'C1': -!!! Property 'IM1' is missing in type 'C3'. +!!! error TS2322: Type 'C3[]' is not assignable to type 'C1[]': +!!! error TS2322: Type 'C3' is not assignable to type 'C1': +!!! error TS2322: Property 'IM1' is missing in type 'C3'. arr_c2 = arr_c2; // should be ok - subtype relationship - is arr_c2 = arr_c1; // should be an error - subtype relationship - is ~~~~~~ -!!! Type 'C1[]' is not assignable to type 'C2[]': -!!! Type 'C1' is not assignable to type 'C2': -!!! Property 'C2M1' is missing in type 'C1'. +!!! error TS2322: Type 'C1[]' is not assignable to type 'C2[]': +!!! error TS2322: Type 'C1' is not assignable to type 'C2': +!!! error TS2322: Property 'C2M1' is missing in type 'C1'. arr_c2 = arr_i1; // should be an error - subtype relationship - is ~~~~~~ -!!! Type 'I1[]' is not assignable to type 'C2[]': -!!! Type 'I1' is not assignable to type 'C2': -!!! Property 'C2M1' is missing in type 'I1'. +!!! error TS2322: Type 'I1[]' is not assignable to type 'C2[]': +!!! error TS2322: Type 'I1' is not assignable to type 'C2': +!!! error TS2322: Property 'C2M1' is missing in type 'I1'. arr_c2 = arr_c3; // should be an error - is ~~~~~~ -!!! Type 'C3[]' is not assignable to type 'C2[]': -!!! Type 'C3' is not assignable to type 'C2': -!!! Property 'C2M1' is missing in type 'C3'. +!!! error TS2322: Type 'C3[]' is not assignable to type 'C2[]': +!!! error TS2322: Type 'C3' is not assignable to type 'C2': +!!! error TS2322: Property 'C2M1' is missing in type 'C3'. // "clean up bug" occurs at this point // if you move these three expressions to another file, they raise an error // something to do with state from the above propagating forward? arr_c3 = arr_c2_2; // should be an error - is ~~~~~~ -!!! Type 'C2[]' is not assignable to type 'C3[]': -!!! Type 'C2' is not assignable to type 'C3': -!!! Property 'CM3M1' is missing in type 'C2'. +!!! error TS2322: Type 'C2[]' is not assignable to type 'C3[]': +!!! error TS2322: Type 'C2' is not assignable to type 'C3': +!!! error TS2322: Property 'CM3M1' is missing in type 'C2'. arr_c3 = arr_c1_2; // should be an error - is ~~~~~~ -!!! Type 'C1[]' is not assignable to type 'C3[]': -!!! Type 'C1' is not assignable to type 'C3': -!!! Property 'CM3M1' is missing in type 'C1'. +!!! error TS2322: Type 'C1[]' is not assignable to type 'C3[]': +!!! error TS2322: Type 'C1' is not assignable to type 'C3': +!!! error TS2322: Property 'CM3M1' is missing in type 'C1'. arr_c3 = arr_i1_2; // should be an error - is ~~~~~~ -!!! Type 'I1[]' is not assignable to type 'C3[]': -!!! Type 'I1' is not assignable to type 'C3': -!!! Property 'CM3M1' is missing in type 'I1'. +!!! error TS2322: Type 'I1[]' is not assignable to type 'C3[]': +!!! error TS2322: Type 'I1' is not assignable to type 'C3': +!!! error TS2322: Property 'CM3M1' is missing in type 'I1'. arr_any = f1; // should be an error - is ~~~~~~~ -!!! Type '() => C1' is not assignable to type 'any[]': -!!! Property 'push' is missing in type '() => C1'. +!!! error TS2322: Type '() => C1' is not assignable to type 'any[]': +!!! error TS2322: Property 'push' is missing in type '() => C1'. arr_any = o1; // should be an error - is ~~~~~~~ -!!! Type '{ one: number; }' is not assignable to type 'any[]': -!!! Property 'length' is missing in type '{ one: number; }'. +!!! error TS2322: Type '{ one: number; }' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type '{ one: number; }'. arr_any = a1; // should be ok - is arr_any = c1; // should be an error - is ~~~~~~~ -!!! Type 'C1' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'C1'. +!!! error TS2322: Type 'C1' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'C1'. arr_any = c2; // should be an error - is ~~~~~~~ -!!! Type 'C2' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'C2'. +!!! error TS2322: Type 'C2' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'C2'. arr_any = c3; // should be an error - is ~~~~~~~ -!!! Type 'C3' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'C3'. +!!! error TS2322: Type 'C3' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'C3'. arr_any = i1; // should be an error - is ~~~~~~~ -!!! Type 'I1' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'I1'. \ No newline at end of file +!!! error TS2322: Type 'I1' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'I1'. \ No newline at end of file diff --git a/tests/baselines/reference/arrayAssignmentTest2.errors.txt b/tests/baselines/reference/arrayAssignmentTest2.errors.txt index 5ecebfe392a..c9364ab555b 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest2.errors.txt @@ -1,3 +1,28 @@ +tests/cases/compiler/arrayAssignmentTest2.ts(47,1): error TS2322: Type 'C2[]' is not assignable to type 'C3[]': + Type 'C2' is not assignable to type 'C3': + Property 'CM3M1' is missing in type 'C2'. +tests/cases/compiler/arrayAssignmentTest2.ts(48,1): error TS2322: Type 'C1[]' is not assignable to type 'C3[]': + Type 'C1' is not assignable to type 'C3': + Property 'CM3M1' is missing in type 'C1'. +tests/cases/compiler/arrayAssignmentTest2.ts(49,1): error TS2322: Type 'I1[]' is not assignable to type 'C3[]': + Type 'I1' is not assignable to type 'C3': + Property 'CM3M1' is missing in type 'I1'. +tests/cases/compiler/arrayAssignmentTest2.ts(51,1): error TS2322: Type '() => C1' is not assignable to type 'any[]': + Property 'push' is missing in type '() => C1'. +tests/cases/compiler/arrayAssignmentTest2.ts(52,1): error TS2322: Type '() => any' is not assignable to type 'any[]': + Property 'push' is missing in type '() => any'. +tests/cases/compiler/arrayAssignmentTest2.ts(53,1): error TS2322: Type '{ one: number; }' is not assignable to type 'any[]': + Property 'length' is missing in type '{ one: number; }'. +tests/cases/compiler/arrayAssignmentTest2.ts(55,1): error TS2322: Type 'C1' is not assignable to type 'any[]': + Property 'length' is missing in type 'C1'. +tests/cases/compiler/arrayAssignmentTest2.ts(56,1): error TS2322: Type 'C2' is not assignable to type 'any[]': + Property 'length' is missing in type 'C2'. +tests/cases/compiler/arrayAssignmentTest2.ts(57,1): error TS2322: Type 'C3' is not assignable to type 'any[]': + Property 'length' is missing in type 'C3'. +tests/cases/compiler/arrayAssignmentTest2.ts(58,1): error TS2322: Type 'I1' is not assignable to type 'any[]': + Property 'length' is missing in type 'I1'. + + ==== tests/cases/compiler/arrayAssignmentTest2.ts (10 errors) ==== interface I1 { IM1():void[]; @@ -47,47 +72,47 @@ // "clean up error" occurs at this point arr_c3 = arr_c2_2; // should be an error - is ~~~~~~ -!!! Type 'C2[]' is not assignable to type 'C3[]': -!!! Type 'C2' is not assignable to type 'C3': -!!! Property 'CM3M1' is missing in type 'C2'. +!!! error TS2322: Type 'C2[]' is not assignable to type 'C3[]': +!!! error TS2322: Type 'C2' is not assignable to type 'C3': +!!! error TS2322: Property 'CM3M1' is missing in type 'C2'. arr_c3 = arr_c1_2; // should be an error - is ~~~~~~ -!!! Type 'C1[]' is not assignable to type 'C3[]': -!!! Type 'C1' is not assignable to type 'C3': -!!! Property 'CM3M1' is missing in type 'C1'. +!!! error TS2322: Type 'C1[]' is not assignable to type 'C3[]': +!!! error TS2322: Type 'C1' is not assignable to type 'C3': +!!! error TS2322: Property 'CM3M1' is missing in type 'C1'. arr_c3 = arr_i1_2; // should be an error - is ~~~~~~ -!!! Type 'I1[]' is not assignable to type 'C3[]': -!!! Type 'I1' is not assignable to type 'C3': -!!! Property 'CM3M1' is missing in type 'I1'. +!!! error TS2322: Type 'I1[]' is not assignable to type 'C3[]': +!!! error TS2322: Type 'I1' is not assignable to type 'C3': +!!! error TS2322: Property 'CM3M1' is missing in type 'I1'. arr_any = f1; // should be an error - is ~~~~~~~ -!!! Type '() => C1' is not assignable to type 'any[]': -!!! Property 'push' is missing in type '() => C1'. +!!! error TS2322: Type '() => C1' is not assignable to type 'any[]': +!!! error TS2322: Property 'push' is missing in type '() => C1'. arr_any = function () { return null;} // should be an error - is ~~~~~~~ -!!! Type '() => any' is not assignable to type 'any[]': -!!! Property 'push' is missing in type '() => any'. +!!! error TS2322: Type '() => any' is not assignable to type 'any[]': +!!! error TS2322: Property 'push' is missing in type '() => any'. arr_any = o1; // should be an error - is ~~~~~~~ -!!! Type '{ one: number; }' is not assignable to type 'any[]': -!!! Property 'length' is missing in type '{ one: number; }'. +!!! error TS2322: Type '{ one: number; }' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type '{ one: number; }'. arr_any = a1; // should be ok - is arr_any = c1; // should be an error - is ~~~~~~~ -!!! Type 'C1' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'C1'. +!!! error TS2322: Type 'C1' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'C1'. arr_any = c2; // should be an error - is ~~~~~~~ -!!! Type 'C2' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'C2'. +!!! error TS2322: Type 'C2' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'C2'. arr_any = c3; // should be an error - is ~~~~~~~ -!!! Type 'C3' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'C3'. +!!! error TS2322: Type 'C3' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'C3'. arr_any = i1; // should be an error - is ~~~~~~~ -!!! Type 'I1' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'I1'. +!!! error TS2322: Type 'I1' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'I1'. \ No newline at end of file diff --git a/tests/baselines/reference/arrayAssignmentTest3.errors.txt b/tests/baselines/reference/arrayAssignmentTest3.errors.txt index 4214ae5ef82..1c88408eb52 100644 --- a/tests/baselines/reference/arrayAssignmentTest3.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest3.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/arrayAssignmentTest3.ts(12,25): error TS2345: Argument of type 'B' is not assignable to parameter of type 'B[]'. + + ==== tests/cases/compiler/arrayAssignmentTest3.ts (1 errors) ==== // The following gives no error // Michal saw no error if he used number instead of B, @@ -12,6 +15,6 @@ var xx = new a(null, 7, new B()); ~~~~~~~ -!!! Argument of type 'B' is not assignable to parameter of type 'B[]'. +!!! error TS2345: Argument of type 'B' is not assignable to parameter of type 'B[]'. \ No newline at end of file diff --git a/tests/baselines/reference/arrayAssignmentTest4.errors.txt b/tests/baselines/reference/arrayAssignmentTest4.errors.txt index 210e18dfe87..0d346e48293 100644 --- a/tests/baselines/reference/arrayAssignmentTest4.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest4.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/arrayAssignmentTest4.ts(24,1): error TS2322: Type '() => any' is not assignable to type 'any[]': + Property 'push' is missing in type '() => any'. +tests/cases/compiler/arrayAssignmentTest4.ts(25,1): error TS2322: Type 'C3' is not assignable to type 'any[]': + Property 'length' is missing in type 'C3'. + + ==== tests/cases/compiler/arrayAssignmentTest4.ts (2 errors) ==== @@ -24,10 +30,10 @@ arr_any = function () { return null;} // should be an error - is ~~~~~~~ -!!! Type '() => any' is not assignable to type 'any[]': -!!! Property 'push' is missing in type '() => any'. +!!! error TS2322: Type '() => any' is not assignable to type 'any[]': +!!! error TS2322: Property 'push' is missing in type '() => any'. arr_any = c3; // should be an error - is ~~~~~~~ -!!! Type 'C3' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'C3'. +!!! error TS2322: Type 'C3' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'C3'. \ No newline at end of file diff --git a/tests/baselines/reference/arrayAssignmentTest5.errors.txt b/tests/baselines/reference/arrayAssignmentTest5.errors.txt index 9c63282d89a..417430b8e43 100644 --- a/tests/baselines/reference/arrayAssignmentTest5.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest5.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/arrayAssignmentTest5.ts(23,17): error TS2322: Type 'IToken[]' is not assignable to type 'IStateToken[]': + Type 'IToken' is not assignable to type 'IStateToken': + Property 'state' is missing in type 'IToken'. + + ==== tests/cases/compiler/arrayAssignmentTest5.ts (1 errors) ==== module Test { interface IState { @@ -23,9 +28,9 @@ var lineTokens:ILineTokens= this.tokenize(line, state, true); var tokens:IStateToken[]= lineTokens.tokens; ~~~~~~ -!!! Type 'IToken[]' is not assignable to type 'IStateToken[]': -!!! Type 'IToken' is not assignable to type 'IStateToken': -!!! Property 'state' is missing in type 'IToken'. +!!! error TS2322: Type 'IToken[]' is not assignable to type 'IStateToken[]': +!!! error TS2322: Type 'IToken' is not assignable to type 'IStateToken': +!!! error TS2322: Property 'state' is missing in type 'IToken'. if (tokens.length === 0) { return this.onEnter(line, tokens, offset); // <== this should produce an error since onEnter can not be called with (string, IStateToken[], offset) } diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index 675d84119c0..f8e158e5b02 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -1,55 +1,109 @@ //// [arrayBestCommonTypes.ts] -interface iface { } -class base implements iface { } -class base2 implements iface { } -class derived extends base { } +module EmptyTypes { + interface iface { } + class base implements iface { } + class base2 implements iface { } + class derived extends base { } -class f { - public voidIfAny(x: boolean, y?: boolean): number; - public voidIfAny(x: string, y?: boolean): number; - public voidIfAny(x: number, y?: boolean): number; - public voidIfAny(x: any, y =false): any { return null; } - - public x() { - (this.voidIfAny([4, 2][0])); - (this.voidIfAny([4, 2, undefined][0])); - (this.voidIfAny([undefined, 2, 4][0])); - (this.voidIfAny([null, 2, 4][0])); - (this.voidIfAny([2, 4, null][0])); - (this.voidIfAny([undefined, 4, null][0])); + class f { + public voidIfAny(x: boolean, y?: boolean): number; + public voidIfAny(x: string, y?: boolean): number; + public voidIfAny(x: number, y?: boolean): number; + public voidIfAny(x: any, y = false): any { return null; } - (this.voidIfAny(['', "q"][0])); - (this.voidIfAny(['', "q", undefined][0])); - (this.voidIfAny([undefined, "q", ''][0])); - (this.voidIfAny([null, "q", ''][0])); - (this.voidIfAny(["q", '', null][0])); - (this.voidIfAny([undefined, '', null][0])); + public x() { + (this.voidIfAny([4, 2][0])); + (this.voidIfAny([4, 2, undefined][0])); + (this.voidIfAny([undefined, 2, 4][0])); + (this.voidIfAny([null, 2, 4][0])); + (this.voidIfAny([2, 4, null][0])); + (this.voidIfAny([undefined, 4, null][0])); - (this.voidIfAny([[3,4],[null]][0][0])); - - - var t1: { x: number; y: base; }[] = [ { x: 7, y: new derived() }, { x: 5, y: new base() } ]; - var t2: { x: boolean; y: base; }[] = [ { x: true, y: new derived() }, { x: false, y: new base() } ]; - var t3: { x: string; y: base; }[] = [ { x: undefined, y: new base() }, { x: '', y: new derived() } ]; + (this.voidIfAny(['', "q"][0])); + (this.voidIfAny(['', "q", undefined][0])); + (this.voidIfAny([undefined, "q", ''][0])); + (this.voidIfAny([null, "q", ''][0])); + (this.voidIfAny(["q", '', null][0])); + (this.voidIfAny([undefined, '', null][0])); - var anyObj: any = null; - // Order matters here so test all the variants - var a1 = [ {x: 0, y: 'a'}, {x: 'a', y: 'a'}, {x: anyObj, y: 'a'} ]; - var a2 = [ {x: anyObj, y: 'a'}, {x: 0, y: 'a'}, {x: 'a', y: 'a'} ]; - var a3 = [ {x: 0, y: 'a'}, {x: anyObj, y: 'a'}, {x: 'a', y: 'a'} ]; - - var ifaceObj: iface = null; - var baseObj = new base(); - var base2Obj = new base2(); + (this.voidIfAny([[3, 4], [null]][0][0])); - var b1 = [ baseObj, base2Obj, ifaceObj ]; - var b2 = [ base2Obj, baseObj, ifaceObj ]; - var b3 = [ baseObj, ifaceObj, base2Obj ]; - var b4 = [ ifaceObj, baseObj, base2Obj ]; + + var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; + var t2: { x: boolean; y: base; }[] = [{ x: true, y: new derived() }, { x: false, y: new base() }]; + var t3: { x: string; y: base; }[] = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; + + var anyObj: any = null; + // Order matters here so test all the variants + var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; + var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; + var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; + + var ifaceObj: iface = null; + var baseObj = new base(); + var base2Obj = new base2(); + + var b1 = [baseObj, base2Obj, ifaceObj]; + var b2 = [base2Obj, baseObj, ifaceObj]; + var b3 = [baseObj, ifaceObj, base2Obj]; + var b4 = [ifaceObj, baseObj, base2Obj]; + } } } +module NonEmptyTypes { + interface iface { x: string; } + class base implements iface { x: string; y: string; } + class base2 implements iface { x: string; z: string; } + class derived extends base { a: string; } + + + class f { + public voidIfAny(x: boolean, y?: boolean): number; + public voidIfAny(x: string, y?: boolean): number; + public voidIfAny(x: number, y?: boolean): number; + public voidIfAny(x: any, y = false): any { return null; } + + public x() { + (this.voidIfAny([4, 2][0])); + (this.voidIfAny([4, 2, undefined][0])); + (this.voidIfAny([undefined, 2, 4][0])); + (this.voidIfAny([null, 2, 4][0])); + (this.voidIfAny([2, 4, null][0])); + (this.voidIfAny([undefined, 4, null][0])); + + (this.voidIfAny(['', "q"][0])); + (this.voidIfAny(['', "q", undefined][0])); + (this.voidIfAny([undefined, "q", ''][0])); + (this.voidIfAny([null, "q", ''][0])); + (this.voidIfAny(["q", '', null][0])); + (this.voidIfAny([undefined, '', null][0])); + + (this.voidIfAny([[3, 4], [null]][0][0])); + + + var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; + var t2: { x: boolean; y: base; }[] = [{ x: true, y: new derived() }, { x: false, y: new base() }]; + var t3: { x: string; y: base; }[] = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; + + var anyObj: any = null; + // Order matters here so test all the variants + var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; + var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; + var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; + + var ifaceObj: iface = null; + var baseObj = new base(); + var base2Obj = new base2(); + + var b1 = [baseObj, base2Obj, ifaceObj]; + var b2 = [base2Obj, baseObj, ifaceObj]; + var b3 = [baseObj, ifaceObj, base2Obj]; + var b4 = [ifaceObj, baseObj, base2Obj]; + } + } +} @@ -60,59 +114,121 @@ var __extends = this.__extends || function (d, b) { __.prototype = b.prototype; d.prototype = new __(); }; -var base = (function () { - function base() { - } - return base; -})(); -var base2 = (function () { - function base2() { - } - return base2; -})(); -var derived = (function (_super) { - __extends(derived, _super); - function derived() { - _super.apply(this, arguments); - } - return derived; -})(base); -var f = (function () { - function f() { - } - f.prototype.voidIfAny = function (x, y) { - if (y === void 0) { y = false; } - return null; - }; - f.prototype.x = function () { - (this.voidIfAny([4, 2][0])); - (this.voidIfAny([4, 2, undefined][0])); - (this.voidIfAny([undefined, 2, 4][0])); - (this.voidIfAny([null, 2, 4][0])); - (this.voidIfAny([2, 4, null][0])); - (this.voidIfAny([undefined, 4, null][0])); - (this.voidIfAny(['', "q"][0])); - (this.voidIfAny(['', "q", undefined][0])); - (this.voidIfAny([undefined, "q", ''][0])); - (this.voidIfAny([null, "q", ''][0])); - (this.voidIfAny(["q", '', null][0])); - (this.voidIfAny([undefined, '', null][0])); - (this.voidIfAny([[3, 4], [null]][0][0])); - var t1 = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; - var t2 = [{ x: true, y: new derived() }, { x: false, y: new base() }]; - var t3 = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; - var anyObj = null; - // Order matters here so test all the variants - var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; - var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; - var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; - var ifaceObj = null; - var baseObj = new base(); - var base2Obj = new base2(); - var b1 = [baseObj, base2Obj, ifaceObj]; - var b2 = [base2Obj, baseObj, ifaceObj]; - var b3 = [baseObj, ifaceObj, base2Obj]; - var b4 = [ifaceObj, baseObj, base2Obj]; - }; - return f; -})(); +var EmptyTypes; +(function (EmptyTypes) { + var base = (function () { + function base() { + } + return base; + })(); + var base2 = (function () { + function base2() { + } + return base2; + })(); + var derived = (function (_super) { + __extends(derived, _super); + function derived() { + _super.apply(this, arguments); + } + return derived; + })(base); + var f = (function () { + function f() { + } + f.prototype.voidIfAny = function (x, y) { + if (y === void 0) { y = false; } + return null; + }; + f.prototype.x = function () { + (this.voidIfAny([4, 2][0])); + (this.voidIfAny([4, 2, undefined][0])); + (this.voidIfAny([undefined, 2, 4][0])); + (this.voidIfAny([null, 2, 4][0])); + (this.voidIfAny([2, 4, null][0])); + (this.voidIfAny([undefined, 4, null][0])); + (this.voidIfAny(['', "q"][0])); + (this.voidIfAny(['', "q", undefined][0])); + (this.voidIfAny([undefined, "q", ''][0])); + (this.voidIfAny([null, "q", ''][0])); + (this.voidIfAny(["q", '', null][0])); + (this.voidIfAny([undefined, '', null][0])); + (this.voidIfAny([[3, 4], [null]][0][0])); + var t1 = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; + var t2 = [{ x: true, y: new derived() }, { x: false, y: new base() }]; + var t3 = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; + var anyObj = null; + // Order matters here so test all the variants + var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; + var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; + var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; + var ifaceObj = null; + var baseObj = new base(); + var base2Obj = new base2(); + var b1 = [baseObj, base2Obj, ifaceObj]; + var b2 = [base2Obj, baseObj, ifaceObj]; + var b3 = [baseObj, ifaceObj, base2Obj]; + var b4 = [ifaceObj, baseObj, base2Obj]; + }; + return f; + })(); +})(EmptyTypes || (EmptyTypes = {})); +var NonEmptyTypes; +(function (NonEmptyTypes) { + var base = (function () { + function base() { + } + return base; + })(); + var base2 = (function () { + function base2() { + } + return base2; + })(); + var derived = (function (_super) { + __extends(derived, _super); + function derived() { + _super.apply(this, arguments); + } + return derived; + })(base); + var f = (function () { + function f() { + } + f.prototype.voidIfAny = function (x, y) { + if (y === void 0) { y = false; } + return null; + }; + f.prototype.x = function () { + (this.voidIfAny([4, 2][0])); + (this.voidIfAny([4, 2, undefined][0])); + (this.voidIfAny([undefined, 2, 4][0])); + (this.voidIfAny([null, 2, 4][0])); + (this.voidIfAny([2, 4, null][0])); + (this.voidIfAny([undefined, 4, null][0])); + (this.voidIfAny(['', "q"][0])); + (this.voidIfAny(['', "q", undefined][0])); + (this.voidIfAny([undefined, "q", ''][0])); + (this.voidIfAny([null, "q", ''][0])); + (this.voidIfAny(["q", '', null][0])); + (this.voidIfAny([undefined, '', null][0])); + (this.voidIfAny([[3, 4], [null]][0][0])); + var t1 = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; + var t2 = [{ x: true, y: new derived() }, { x: false, y: new base() }]; + var t3 = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; + var anyObj = null; + // Order matters here so test all the variants + var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; + var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; + var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; + var ifaceObj = null; + var baseObj = new base(); + var base2Obj = new base2(); + var b1 = [baseObj, base2Obj, ifaceObj]; + var b2 = [base2Obj, baseObj, ifaceObj]; + var b3 = [baseObj, ifaceObj, base2Obj]; + var b4 = [ifaceObj, baseObj, base2Obj]; + }; + return f; + })(); +})(NonEmptyTypes || (NonEmptyTypes = {})); diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types index a0f407358c3..c9d39d5c1e8 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.types +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -1,47 +1,50 @@ === tests/cases/compiler/arrayBestCommonTypes.ts === -interface iface { } +module EmptyTypes { +>EmptyTypes : typeof EmptyTypes + + interface iface { } >iface : iface -class base implements iface { } + class base implements iface { } >base : base >iface : iface -class base2 implements iface { } + class base2 implements iface { } >base2 : base2 >iface : iface -class derived extends base { } + class derived extends base { } >derived : derived >base : base -class f { + class f { >f : f - public voidIfAny(x: boolean, y?: boolean): number; + public voidIfAny(x: boolean, y?: boolean): number; >voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } >x : boolean >y : boolean - public voidIfAny(x: string, y?: boolean): number; + public voidIfAny(x: string, y?: boolean): number; >voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } >x : string >y : boolean - public voidIfAny(x: number, y?: boolean): number; + public voidIfAny(x: number, y?: boolean): number; >voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } >x : number >y : boolean - public voidIfAny(x: any, y =false): any { return null; } + public voidIfAny(x: any, y = false): any { return null; } >voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } >x : any >y : boolean - - public x() { + + public x() { >x : () => void - (this.voidIfAny([4, 2][0])); + (this.voidIfAny([4, 2][0])); >(this.voidIfAny([4, 2][0])) : number >(this.voidIfAny([4, 2][0])) : number >this.voidIfAny([4, 2][0]) : number @@ -51,7 +54,7 @@ class f { >[4, 2][0] : number >[4, 2] : number[] - (this.voidIfAny([4, 2, undefined][0])); + (this.voidIfAny([4, 2, undefined][0])); >(this.voidIfAny([4, 2, undefined][0])) : number >(this.voidIfAny([4, 2, undefined][0])) : number >this.voidIfAny([4, 2, undefined][0]) : number @@ -62,7 +65,7 @@ class f { >[4, 2, undefined] : number[] >undefined : undefined - (this.voidIfAny([undefined, 2, 4][0])); + (this.voidIfAny([undefined, 2, 4][0])); >(this.voidIfAny([undefined, 2, 4][0])) : number >(this.voidIfAny([undefined, 2, 4][0])) : number >this.voidIfAny([undefined, 2, 4][0]) : number @@ -73,7 +76,7 @@ class f { >[undefined, 2, 4] : number[] >undefined : undefined - (this.voidIfAny([null, 2, 4][0])); + (this.voidIfAny([null, 2, 4][0])); >(this.voidIfAny([null, 2, 4][0])) : number >(this.voidIfAny([null, 2, 4][0])) : number >this.voidIfAny([null, 2, 4][0]) : number @@ -83,7 +86,7 @@ class f { >[null, 2, 4][0] : number >[null, 2, 4] : number[] - (this.voidIfAny([2, 4, null][0])); + (this.voidIfAny([2, 4, null][0])); >(this.voidIfAny([2, 4, null][0])) : number >(this.voidIfAny([2, 4, null][0])) : number >this.voidIfAny([2, 4, null][0]) : number @@ -93,7 +96,7 @@ class f { >[2, 4, null][0] : number >[2, 4, null] : number[] - (this.voidIfAny([undefined, 4, null][0])); + (this.voidIfAny([undefined, 4, null][0])); >(this.voidIfAny([undefined, 4, null][0])) : number >(this.voidIfAny([undefined, 4, null][0])) : number >this.voidIfAny([undefined, 4, null][0]) : number @@ -104,7 +107,7 @@ class f { >[undefined, 4, null] : number[] >undefined : undefined - (this.voidIfAny(['', "q"][0])); + (this.voidIfAny(['', "q"][0])); >(this.voidIfAny(['', "q"][0])) : number >(this.voidIfAny(['', "q"][0])) : number >this.voidIfAny(['', "q"][0]) : number @@ -114,7 +117,7 @@ class f { >['', "q"][0] : string >['', "q"] : string[] - (this.voidIfAny(['', "q", undefined][0])); + (this.voidIfAny(['', "q", undefined][0])); >(this.voidIfAny(['', "q", undefined][0])) : number >(this.voidIfAny(['', "q", undefined][0])) : number >this.voidIfAny(['', "q", undefined][0]) : number @@ -125,7 +128,7 @@ class f { >['', "q", undefined] : string[] >undefined : undefined - (this.voidIfAny([undefined, "q", ''][0])); + (this.voidIfAny([undefined, "q", ''][0])); >(this.voidIfAny([undefined, "q", ''][0])) : number >(this.voidIfAny([undefined, "q", ''][0])) : number >this.voidIfAny([undefined, "q", ''][0]) : number @@ -136,7 +139,7 @@ class f { >[undefined, "q", ''] : string[] >undefined : undefined - (this.voidIfAny([null, "q", ''][0])); + (this.voidIfAny([null, "q", ''][0])); >(this.voidIfAny([null, "q", ''][0])) : number >(this.voidIfAny([null, "q", ''][0])) : number >this.voidIfAny([null, "q", ''][0]) : number @@ -146,7 +149,7 @@ class f { >[null, "q", ''][0] : string >[null, "q", ''] : string[] - (this.voidIfAny(["q", '', null][0])); + (this.voidIfAny(["q", '', null][0])); >(this.voidIfAny(["q", '', null][0])) : number >(this.voidIfAny(["q", '', null][0])) : number >this.voidIfAny(["q", '', null][0]) : number @@ -156,7 +159,7 @@ class f { >["q", '', null][0] : string >["q", '', null] : string[] - (this.voidIfAny([undefined, '', null][0])); + (this.voidIfAny([undefined, '', null][0])); >(this.voidIfAny([undefined, '', null][0])) : number >(this.voidIfAny([undefined, '', null][0])) : number >this.voidIfAny([undefined, '', null][0]) : number @@ -167,26 +170,26 @@ class f { >[undefined, '', null] : string[] >undefined : undefined - (this.voidIfAny([[3,4],[null]][0][0])); ->(this.voidIfAny([[3,4],[null]][0][0])) : number ->(this.voidIfAny([[3,4],[null]][0][0])) : number ->this.voidIfAny([[3,4],[null]][0][0]) : number + (this.voidIfAny([[3, 4], [null]][0][0])); +>(this.voidIfAny([[3, 4], [null]][0][0])) : number +>(this.voidIfAny([[3, 4], [null]][0][0])) : number +>this.voidIfAny([[3, 4], [null]][0][0]) : number >this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } >this : f >voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } ->[[3,4],[null]][0][0] : number ->[[3,4],[null]][0] : number[] ->[[3,4],[null]] : number[][] ->[3,4] : number[] +>[[3, 4], [null]][0][0] : number +>[[3, 4], [null]][0] : number[] +>[[3, 4], [null]] : number[][] +>[3, 4] : number[] >[null] : null[] - - - var t1: { x: number; y: base; }[] = [ { x: 7, y: new derived() }, { x: 5, y: new base() } ]; + + + var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; >t1 : { x: number; y: base; }[] >x : number >y : base >base : base ->[ { x: 7, y: new derived() }, { x: 5, y: new base() } ] : { x: number; y: base; }[] +>[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : { x: number; y: derived; }[] >{ x: 7, y: new derived() } : { x: number; y: derived; } >x : number >y : derived @@ -198,12 +201,12 @@ class f { >new base() : base >base : typeof base - var t2: { x: boolean; y: base; }[] = [ { x: true, y: new derived() }, { x: false, y: new base() } ]; + var t2: { x: boolean; y: base; }[] = [{ x: true, y: new derived() }, { x: false, y: new base() }]; >t2 : { x: boolean; y: base; }[] >x : boolean >y : base >base : base ->[ { x: true, y: new derived() }, { x: false, y: new base() } ] : { x: boolean; y: base; }[] +>[{ x: true, y: new derived() }, { x: false, y: new base() }] : { x: boolean; y: derived; }[] >{ x: true, y: new derived() } : { x: boolean; y: derived; } >x : boolean >y : derived @@ -215,12 +218,12 @@ class f { >new base() : base >base : typeof base - var t3: { x: string; y: base; }[] = [ { x: undefined, y: new base() }, { x: '', y: new derived() } ]; + var t3: { x: string; y: base; }[] = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; >t3 : { x: string; y: base; }[] >x : string >y : base >base : base ->[ { x: undefined, y: new base() }, { x: '', y: new derived() } ] : { x: string; y: base; }[] +>[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : { x: string; y: derived; }[] >{ x: undefined, y: new base() } : { x: undefined; y: base; } >x : undefined >undefined : undefined @@ -233,95 +236,429 @@ class f { >new derived() : derived >derived : typeof derived - var anyObj: any = null; + var anyObj: any = null; >anyObj : any - // Order matters here so test all the variants - var a1 = [ {x: 0, y: 'a'}, {x: 'a', y: 'a'}, {x: anyObj, y: 'a'} ]; + // Order matters here so test all the variants + var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; >a1 : { x: any; y: string; }[] ->[ {x: 0, y: 'a'}, {x: 'a', y: 'a'}, {x: anyObj, y: 'a'} ] : { x: any; y: string; }[] ->{x: 0, y: 'a'} : { x: number; y: string; } +>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : { x: any; y: string; }[] +>{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >y : string ->{x: 'a', y: 'a'} : { x: string; y: string; } +>{ x: 'a', y: 'a' } : { x: string; y: string; } >x : string >y : string ->{x: anyObj, y: 'a'} : { x: any; y: string; } +>{ x: anyObj, y: 'a' } : { x: any; y: string; } >x : any >anyObj : any >y : string - var a2 = [ {x: anyObj, y: 'a'}, {x: 0, y: 'a'}, {x: 'a', y: 'a'} ]; + var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; >a2 : { x: any; y: string; }[] ->[ {x: anyObj, y: 'a'}, {x: 0, y: 'a'}, {x: 'a', y: 'a'} ] : { x: any; y: string; }[] ->{x: anyObj, y: 'a'} : { x: any; y: string; } +>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>{ x: anyObj, y: 'a' } : { x: any; y: string; } >x : any >anyObj : any >y : string ->{x: 0, y: 'a'} : { x: number; y: string; } +>{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >y : string ->{x: 'a', y: 'a'} : { x: string; y: string; } +>{ x: 'a', y: 'a' } : { x: string; y: string; } >x : string >y : string - var a3 = [ {x: 0, y: 'a'}, {x: anyObj, y: 'a'}, {x: 'a', y: 'a'} ]; + var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; >a3 : { x: any; y: string; }[] ->[ {x: 0, y: 'a'}, {x: anyObj, y: 'a'}, {x: 'a', y: 'a'} ] : { x: any; y: string; }[] ->{x: 0, y: 'a'} : { x: number; y: string; } +>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >y : string ->{x: anyObj, y: 'a'} : { x: any; y: string; } +>{ x: anyObj, y: 'a' } : { x: any; y: string; } >x : any >anyObj : any >y : string ->{x: 'a', y: 'a'} : { x: string; y: string; } +>{ x: 'a', y: 'a' } : { x: string; y: string; } >x : string >y : string - - var ifaceObj: iface = null; + + var ifaceObj: iface = null; >ifaceObj : iface >iface : iface - var baseObj = new base(); + var baseObj = new base(); >baseObj : base >new base() : base >base : typeof base - var base2Obj = new base2(); + var base2Obj = new base2(); >base2Obj : base2 >new base2() : base2 >base2 : typeof base2 - var b1 = [ baseObj, base2Obj, ifaceObj ]; ->b1 : base[] ->[ baseObj, base2Obj, ifaceObj ] : base[] + var b1 = [baseObj, base2Obj, ifaceObj]; +>b1 : iface[] +>[baseObj, base2Obj, ifaceObj] : iface[] >baseObj : base >base2Obj : base2 >ifaceObj : iface - var b2 = [ base2Obj, baseObj, ifaceObj ]; ->b2 : base2[] ->[ base2Obj, baseObj, ifaceObj ] : base2[] + var b2 = [base2Obj, baseObj, ifaceObj]; +>b2 : iface[] +>[base2Obj, baseObj, ifaceObj] : iface[] >base2Obj : base2 >baseObj : base >ifaceObj : iface - var b3 = [ baseObj, ifaceObj, base2Obj ]; ->b3 : base[] ->[ baseObj, ifaceObj, base2Obj ] : base[] + var b3 = [baseObj, ifaceObj, base2Obj]; +>b3 : iface[] +>[baseObj, ifaceObj, base2Obj] : iface[] >baseObj : base >ifaceObj : iface >base2Obj : base2 - var b4 = [ ifaceObj, baseObj, base2Obj ]; + var b4 = [ifaceObj, baseObj, base2Obj]; >b4 : iface[] ->[ ifaceObj, baseObj, base2Obj ] : iface[] +>[ifaceObj, baseObj, base2Obj] : iface[] >ifaceObj : iface >baseObj : base >base2Obj : base2 + } + } +} + +module NonEmptyTypes { +>NonEmptyTypes : typeof NonEmptyTypes + + interface iface { x: string; } +>iface : iface +>x : string + + class base implements iface { x: string; y: string; } +>base : base +>iface : iface +>x : string +>y : string + + class base2 implements iface { x: string; z: string; } +>base2 : base2 +>iface : iface +>x : string +>z : string + + class derived extends base { a: string; } +>derived : derived +>base : base +>a : string + + + class f { +>f : f + + public voidIfAny(x: boolean, y?: boolean): number; +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>x : boolean +>y : boolean + + public voidIfAny(x: string, y?: boolean): number; +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>x : string +>y : boolean + + public voidIfAny(x: number, y?: boolean): number; +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>x : number +>y : boolean + + public voidIfAny(x: any, y = false): any { return null; } +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>x : any +>y : boolean + + public x() { +>x : () => void + + (this.voidIfAny([4, 2][0])); +>(this.voidIfAny([4, 2][0])) : number +>(this.voidIfAny([4, 2][0])) : number +>this.voidIfAny([4, 2][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[4, 2][0] : number +>[4, 2] : number[] + + (this.voidIfAny([4, 2, undefined][0])); +>(this.voidIfAny([4, 2, undefined][0])) : number +>(this.voidIfAny([4, 2, undefined][0])) : number +>this.voidIfAny([4, 2, undefined][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[4, 2, undefined][0] : number +>[4, 2, undefined] : number[] +>undefined : undefined + + (this.voidIfAny([undefined, 2, 4][0])); +>(this.voidIfAny([undefined, 2, 4][0])) : number +>(this.voidIfAny([undefined, 2, 4][0])) : number +>this.voidIfAny([undefined, 2, 4][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[undefined, 2, 4][0] : number +>[undefined, 2, 4] : number[] +>undefined : undefined + + (this.voidIfAny([null, 2, 4][0])); +>(this.voidIfAny([null, 2, 4][0])) : number +>(this.voidIfAny([null, 2, 4][0])) : number +>this.voidIfAny([null, 2, 4][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[null, 2, 4][0] : number +>[null, 2, 4] : number[] + + (this.voidIfAny([2, 4, null][0])); +>(this.voidIfAny([2, 4, null][0])) : number +>(this.voidIfAny([2, 4, null][0])) : number +>this.voidIfAny([2, 4, null][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[2, 4, null][0] : number +>[2, 4, null] : number[] + + (this.voidIfAny([undefined, 4, null][0])); +>(this.voidIfAny([undefined, 4, null][0])) : number +>(this.voidIfAny([undefined, 4, null][0])) : number +>this.voidIfAny([undefined, 4, null][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[undefined, 4, null][0] : number +>[undefined, 4, null] : number[] +>undefined : undefined + + (this.voidIfAny(['', "q"][0])); +>(this.voidIfAny(['', "q"][0])) : number +>(this.voidIfAny(['', "q"][0])) : number +>this.voidIfAny(['', "q"][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>['', "q"][0] : string +>['', "q"] : string[] + + (this.voidIfAny(['', "q", undefined][0])); +>(this.voidIfAny(['', "q", undefined][0])) : number +>(this.voidIfAny(['', "q", undefined][0])) : number +>this.voidIfAny(['', "q", undefined][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>['', "q", undefined][0] : string +>['', "q", undefined] : string[] +>undefined : undefined + + (this.voidIfAny([undefined, "q", ''][0])); +>(this.voidIfAny([undefined, "q", ''][0])) : number +>(this.voidIfAny([undefined, "q", ''][0])) : number +>this.voidIfAny([undefined, "q", ''][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[undefined, "q", ''][0] : string +>[undefined, "q", ''] : string[] +>undefined : undefined + + (this.voidIfAny([null, "q", ''][0])); +>(this.voidIfAny([null, "q", ''][0])) : number +>(this.voidIfAny([null, "q", ''][0])) : number +>this.voidIfAny([null, "q", ''][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[null, "q", ''][0] : string +>[null, "q", ''] : string[] + + (this.voidIfAny(["q", '', null][0])); +>(this.voidIfAny(["q", '', null][0])) : number +>(this.voidIfAny(["q", '', null][0])) : number +>this.voidIfAny(["q", '', null][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>["q", '', null][0] : string +>["q", '', null] : string[] + + (this.voidIfAny([undefined, '', null][0])); +>(this.voidIfAny([undefined, '', null][0])) : number +>(this.voidIfAny([undefined, '', null][0])) : number +>this.voidIfAny([undefined, '', null][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[undefined, '', null][0] : string +>[undefined, '', null] : string[] +>undefined : undefined + + (this.voidIfAny([[3, 4], [null]][0][0])); +>(this.voidIfAny([[3, 4], [null]][0][0])) : number +>(this.voidIfAny([[3, 4], [null]][0][0])) : number +>this.voidIfAny([[3, 4], [null]][0][0]) : number +>this.voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>this : f +>voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } +>[[3, 4], [null]][0][0] : number +>[[3, 4], [null]][0] : number[] +>[[3, 4], [null]] : number[][] +>[3, 4] : number[] +>[null] : null[] + + + var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; +>t1 : { x: number; y: base; }[] +>x : number +>y : base +>base : base +>[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : { x: number; y: base; }[] +>{ x: 7, y: new derived() } : { x: number; y: derived; } +>x : number +>y : derived +>new derived() : derived +>derived : typeof derived +>{ x: 5, y: new base() } : { x: number; y: base; } +>x : number +>y : base +>new base() : base +>base : typeof base + + var t2: { x: boolean; y: base; }[] = [{ x: true, y: new derived() }, { x: false, y: new base() }]; +>t2 : { x: boolean; y: base; }[] +>x : boolean +>y : base +>base : base +>[{ x: true, y: new derived() }, { x: false, y: new base() }] : { x: boolean; y: base; }[] +>{ x: true, y: new derived() } : { x: boolean; y: derived; } +>x : boolean +>y : derived +>new derived() : derived +>derived : typeof derived +>{ x: false, y: new base() } : { x: boolean; y: base; } +>x : boolean +>y : base +>new base() : base +>base : typeof base + + var t3: { x: string; y: base; }[] = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; +>t3 : { x: string; y: base; }[] +>x : string +>y : base +>base : base +>[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : Array<{ x: undefined; y: base; } | { x: string; y: derived; }> +>{ x: undefined, y: new base() } : { x: undefined; y: base; } +>x : undefined +>undefined : undefined +>y : base +>new base() : base +>base : typeof base +>{ x: '', y: new derived() } : { x: string; y: derived; } +>x : string +>y : derived +>new derived() : derived +>derived : typeof derived + + var anyObj: any = null; +>anyObj : any + + // Order matters here so test all the variants + var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; +>a1 : { x: any; y: string; }[] +>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : { x: any; y: string; }[] +>{ x: 0, y: 'a' } : { x: number; y: string; } +>x : number +>y : string +>{ x: 'a', y: 'a' } : { x: string; y: string; } +>x : string +>y : string +>{ x: anyObj, y: 'a' } : { x: any; y: string; } +>x : any +>anyObj : any +>y : string + + var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; +>a2 : { x: any; y: string; }[] +>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>{ x: anyObj, y: 'a' } : { x: any; y: string; } +>x : any +>anyObj : any +>y : string +>{ x: 0, y: 'a' } : { x: number; y: string; } +>x : number +>y : string +>{ x: 'a', y: 'a' } : { x: string; y: string; } +>x : string +>y : string + + var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; +>a3 : { x: any; y: string; }[] +>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>{ x: 0, y: 'a' } : { x: number; y: string; } +>x : number +>y : string +>{ x: anyObj, y: 'a' } : { x: any; y: string; } +>x : any +>anyObj : any +>y : string +>{ x: 'a', y: 'a' } : { x: string; y: string; } +>x : string +>y : string + + var ifaceObj: iface = null; +>ifaceObj : iface +>iface : iface + + var baseObj = new base(); +>baseObj : base +>new base() : base +>base : typeof base + + var base2Obj = new base2(); +>base2Obj : base2 +>new base2() : base2 +>base2 : typeof base2 + + var b1 = [baseObj, base2Obj, ifaceObj]; +>b1 : iface[] +>[baseObj, base2Obj, ifaceObj] : iface[] +>baseObj : base +>base2Obj : base2 +>ifaceObj : iface + + var b2 = [base2Obj, baseObj, ifaceObj]; +>b2 : iface[] +>[base2Obj, baseObj, ifaceObj] : iface[] +>base2Obj : base2 +>baseObj : base +>ifaceObj : iface + + var b3 = [baseObj, ifaceObj, base2Obj]; +>b3 : iface[] +>[baseObj, ifaceObj, base2Obj] : iface[] +>baseObj : base +>ifaceObj : iface +>base2Obj : base2 + + var b4 = [ifaceObj, baseObj, base2Obj]; +>b4 : iface[] +>[ifaceObj, baseObj, base2Obj] : iface[] +>ifaceObj : iface +>baseObj : base +>base2Obj : base2 + } } } - diff --git a/tests/baselines/reference/arrayCast.errors.txt b/tests/baselines/reference/arrayCast.errors.txt index 509ee2110b7..2218bbf5a75 100644 --- a/tests/baselines/reference/arrayCast.errors.txt +++ b/tests/baselines/reference/arrayCast.errors.txt @@ -1,11 +1,16 @@ +tests/cases/compiler/arrayCast.ts(3,1): error TS2353: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other: + Type '{ foo: string; }' is not assignable to type '{ id: number; }': + Property 'id' is missing in type '{ foo: string; }'. + + ==== tests/cases/compiler/arrayCast.ts (1 errors) ==== // Should fail. Even though the array is contextually typed with { id: number }[], it still // has type { foo: string }[], which is not assignable to { id: number }[]. <{ id: number; }[]>[{ foo: "s" }]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other: -!!! Type '{ foo: string; }' is not assignable to type '{ id: number; }': -!!! Property 'id' is missing in type '{ foo: string; }'. +!!! error TS2353: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other: +!!! error TS2353: Type '{ foo: string; }' is not assignable to type '{ id: number; }': +!!! error TS2353: Property 'id' is missing in type '{ foo: string; }'. // Should succeed, as the {} element causes the type of the array to be {}[] <{ id: number; }[]>[{ foo: "s" }, {}]; \ No newline at end of file diff --git a/tests/baselines/reference/arrayConcat2.types b/tests/baselines/reference/arrayConcat2.types index a4036560305..4cd02d31f9d 100644 --- a/tests/baselines/reference/arrayConcat2.types +++ b/tests/baselines/reference/arrayConcat2.types @@ -1,7 +1,7 @@ === tests/cases/compiler/arrayConcat2.ts === var a: string[] = []; >a : string[] ->[] : string[] +>[] : undefined[] a.concat("hello", 'world'); >a.concat("hello", 'world') : string[] diff --git a/tests/baselines/reference/arrayLiteral.types b/tests/baselines/reference/arrayLiteral.types index 1b356773dc7..9378a508228 100644 --- a/tests/baselines/reference/arrayLiteral.types +++ b/tests/baselines/reference/arrayLiteral.types @@ -25,7 +25,7 @@ var y = new Array(); var x2: number[] = []; >x2 : number[] ->[] : number[] +>[] : undefined[] var x2: number[] = new Array(1); >x2 : number[] diff --git a/tests/baselines/reference/arrayLiteralAndArrayConstructorEquivalence1.errors.txt b/tests/baselines/reference/arrayLiteralAndArrayConstructorEquivalence1.errors.txt index 59137e1c4c1..75a69c09df8 100644 --- a/tests/baselines/reference/arrayLiteralAndArrayConstructorEquivalence1.errors.txt +++ b/tests/baselines/reference/arrayLiteralAndArrayConstructorEquivalence1.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/arrayLiteralAndArrayConstructorEquivalence1.ts(3,14): error TS2314: Generic type 'Array' requires 1 type argument(s). + + ==== tests/cases/compiler/arrayLiteralAndArrayConstructorEquivalence1.ts (1 errors) ==== var myCars=new Array(); var myCars3 = new Array({}); var myCars4: Array; // error ~~~~~ -!!! Generic type 'Array' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). var myCars5: Array[]; myCars = myCars3; diff --git a/tests/baselines/reference/arrayLiteralContextualType.errors.txt b/tests/baselines/reference/arrayLiteralContextualType.errors.txt deleted file mode 100644 index e653cfc303a..00000000000 --- a/tests/baselines/reference/arrayLiteralContextualType.errors.txt +++ /dev/null @@ -1,35 +0,0 @@ -==== tests/cases/compiler/arrayLiteralContextualType.ts (2 errors) ==== - interface IAnimal { - name: string; - } - - class Giraffe { - name = "Giraffe"; - neckLength = "3m"; - } - - class Elephant { - name = "Elephant"; - trunkDiameter = "20cm"; - } - - function foo(animals: IAnimal[]) { } - function bar(animals: { [n: number]: IAnimal }) { } - - foo([ - new Giraffe(), - new Elephant() - ]); // Legal because of the contextual type IAnimal provided by the parameter - bar([ - new Giraffe(), - new Elephant() - ]); // Legal because of the contextual type IAnimal provided by the parameter - - var arr = [new Giraffe(), new Elephant()]; - foo(arr); // Error because of no contextual type - ~~~ -!!! Argument of type '{}[]' is not assignable to parameter of type 'IAnimal[]'. -!!! Type '{}' is not assignable to type 'IAnimal'. - bar(arr); // Error because of no contextual type - ~~~ -!!! Argument of type '{}[]' is not assignable to parameter of type '{ [x: number]: IAnimal; }'. \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiteralContextualType.js b/tests/baselines/reference/arrayLiteralContextualType.js index a551a754204..65e4c135cba 100644 --- a/tests/baselines/reference/arrayLiteralContextualType.js +++ b/tests/baselines/reference/arrayLiteralContextualType.js @@ -26,8 +26,8 @@ bar([ ]); // Legal because of the contextual type IAnimal provided by the parameter var arr = [new Giraffe(), new Elephant()]; -foo(arr); // Error because of no contextual type -bar(arr); // Error because of no contextual type +foo(arr); // ok because arr is Array not {}[] +bar(arr); // ok because arr is Array not {}[] //// [arrayLiteralContextualType.js] var Giraffe = (function () { @@ -57,5 +57,5 @@ bar([ new Elephant() ]); // Legal because of the contextual type IAnimal provided by the parameter var arr = [new Giraffe(), new Elephant()]; -foo(arr); // Error because of no contextual type -bar(arr); // Error because of no contextual type +foo(arr); // ok because arr is Array not {}[] +bar(arr); // ok because arr is Array not {}[] diff --git a/tests/baselines/reference/arrayLiteralContextualType.types b/tests/baselines/reference/arrayLiteralContextualType.types new file mode 100644 index 00000000000..12d08e986f7 --- /dev/null +++ b/tests/baselines/reference/arrayLiteralContextualType.types @@ -0,0 +1,86 @@ +=== tests/cases/compiler/arrayLiteralContextualType.ts === +interface IAnimal { +>IAnimal : IAnimal + + name: string; +>name : string +} + +class Giraffe { +>Giraffe : Giraffe + + name = "Giraffe"; +>name : string + + neckLength = "3m"; +>neckLength : string +} + +class Elephant { +>Elephant : Elephant + + name = "Elephant"; +>name : string + + trunkDiameter = "20cm"; +>trunkDiameter : string +} + +function foo(animals: IAnimal[]) { } +>foo : (animals: IAnimal[]) => void +>animals : IAnimal[] +>IAnimal : IAnimal + +function bar(animals: { [n: number]: IAnimal }) { } +>bar : (animals: { [x: number]: IAnimal; }) => void +>animals : { [x: number]: IAnimal; } +>n : number +>IAnimal : IAnimal + +foo([ +>foo([ new Giraffe(), new Elephant()]) : void +>foo : (animals: IAnimal[]) => void +>[ new Giraffe(), new Elephant()] : Array + + new Giraffe(), +>new Giraffe() : Giraffe +>Giraffe : typeof Giraffe + + new Elephant() +>new Elephant() : Elephant +>Elephant : typeof Elephant + +]); // Legal because of the contextual type IAnimal provided by the parameter +bar([ +>bar([ new Giraffe(), new Elephant()]) : void +>bar : (animals: { [x: number]: IAnimal; }) => void +>[ new Giraffe(), new Elephant()] : Array + + new Giraffe(), +>new Giraffe() : Giraffe +>Giraffe : typeof Giraffe + + new Elephant() +>new Elephant() : Elephant +>Elephant : typeof Elephant + +]); // Legal because of the contextual type IAnimal provided by the parameter + +var arr = [new Giraffe(), new Elephant()]; +>arr : Array +>[new Giraffe(), new Elephant()] : Array +>new Giraffe() : Giraffe +>Giraffe : typeof Giraffe +>new Elephant() : Elephant +>Elephant : typeof Elephant + +foo(arr); // ok because arr is Array not {}[] +>foo(arr) : void +>foo : (animals: IAnimal[]) => void +>arr : Array + +bar(arr); // ok because arr is Array not {}[] +>bar(arr) : void +>bar : (animals: { [x: number]: IAnimal; }) => void +>arr : Array + diff --git a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types index c4889e223bb..4743504c33e 100644 --- a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types +++ b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.types @@ -7,5 +7,5 @@ function panic(val: string[], ...opt: string[]) { } panic([], 'one', 'two'); >panic([], 'one', 'two') : void >panic : (val: string[], ...opt: string[]) => void ->[] : string[] +>[] : undefined[] diff --git a/tests/baselines/reference/arrayLiteralTypeInference.types b/tests/baselines/reference/arrayLiteralTypeInference.types index 5b4d9b7fff8..c80e5e17030 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.types +++ b/tests/baselines/reference/arrayLiteralTypeInference.types @@ -25,7 +25,7 @@ class ActionB extends Action { var x1: Action[] = [ >x1 : Action[] >Action : Action ->[ { id: 2, trueness: false }, { id: 3, name: "three" }] : Action[] +>[ { id: 2, trueness: false }, { id: 3, name: "three" }] : Array<{ id: number; trueness: boolean; } | { id: number; name: string; }> { id: 2, trueness: false }, >{ id: 2, trueness: false } : { id: number; trueness: boolean; } @@ -42,7 +42,7 @@ var x1: Action[] = [ var x2: Action[] = [ >x2 : Action[] >Action : Action ->[ new ActionA(), new ActionB()] : Action[] +>[ new ActionA(), new ActionB()] : Array new ActionA(), >new ActionA() : ActionA @@ -78,7 +78,7 @@ var z1: { id: number }[] = >id : number [ ->[ { id: 2, trueness: false }, { id: 3, name: "three" } ] : { id: number; }[] +>[ { id: 2, trueness: false }, { id: 3, name: "three" } ] : Array<{ id: number; trueness: boolean; } | { id: number; name: string; }> { id: 2, trueness: false }, >{ id: 2, trueness: false } : { id: number; trueness: boolean; } @@ -97,7 +97,7 @@ var z2: { id: number }[] = >id : number [ ->[ new ActionA(), new ActionB() ] : { id: number; }[] +>[ new ActionA(), new ActionB() ] : Array new ActionA(), >new ActionA() : ActionA @@ -114,7 +114,7 @@ var z3: { id: number }[] = >id : number [ ->[ new Action(), new ActionA(), new ActionB() ] : { id: number; }[] +>[ new Action(), new ActionA(), new ActionB() ] : Action[] new Action(), >new Action() : Action diff --git a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types index 7729b280160..49b65a86aa6 100644 --- a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types +++ b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types @@ -23,8 +23,8 @@ var as = [a, b]; // { x: number; y?: number };[] >b : { x: number; z?: number; } var bs = [b, a]; // { x: number; z?: number };[] ->bs : { x: number; z?: number; }[] ->[b, a] : { x: number; z?: number; }[] +>bs : { x: number; y?: number; }[] +>[b, a] : { x: number; y?: number; }[] >b : { x: number; z?: number; } >a : { x: number; y?: number; } diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 800d2a12550..16e5ec7eee4 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -2,28 +2,21 @@ // Empty array literal with no contextual type has type Undefined[] var arr1= [[], [1], ['']]; -var arr1: {}[]; // Bug 825172: Error ({}[] does not match {}[]), but should be OK var arr2 = [[null], [1], ['']]; -var arr2: {}[]; // Bug 825172: Error ({}[] does not match {}[]), but should be OK // Array literal with elements of only EveryType E has type E[] var stringArrArr = [[''], [""]]; -var stringArrArr: string[][]; var stringArr = ['', ""]; -var stringArr: string[]; var numberArr = [0, 0.0, 0x00, 1e1]; -var numberArr: number[]; var boolArr = [false, true, false, true]; -var boolArr: boolean[]; class C { private p; } var classArr = [new C(), new C()]; -var classArr: C[]; // Should be OK var classTypeArray = [C, C, C]; var classTypeArray: Array; // Should OK, not be a parse error @@ -31,7 +24,6 @@ var classTypeArray: Array; // Should OK, not be a parse error // Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; -var context2: Array<{}>; // Should be OK // Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] class Base { private p; } @@ -53,31 +45,23 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; var arr1 = [[], [1], ['']]; -var arr1; // Bug 825172: Error ({}[] does not match {}[]), but should be OK var arr2 = [[null], [1], ['']]; -var arr2; // Bug 825172: Error ({}[] does not match {}[]), but should be OK // Array literal with elements of only EveryType E has type E[] var stringArrArr = [[''], [""]]; -var stringArrArr; var stringArr = ['', ""]; -var stringArr; var numberArr = [0, 0.0, 0x00, 1e1]; -var numberArr; var boolArr = [false, true, false, true]; -var boolArr; var C = (function () { function C() { } return C; })(); var classArr = [new C(), new C()]; -var classArr; // Should be OK var classTypeArray = [C, C, C]; var classTypeArray; // Should OK, not be a parse error // Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] var context1 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; -var context2; // Should be OK // Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] var Base = (function () { function Base() { diff --git a/tests/baselines/reference/arrayLiterals.types b/tests/baselines/reference/arrayLiterals.types index 29dd1b19970..8c2fd942c62 100644 --- a/tests/baselines/reference/arrayLiterals.types +++ b/tests/baselines/reference/arrayLiterals.types @@ -2,25 +2,19 @@ // Empty array literal with no contextual type has type Undefined[] var arr1= [[], [1], ['']]; ->arr1 : {}[] ->[[], [1], ['']] : {}[] +>arr1 : Array +>[[], [1], ['']] : Array >[] : undefined[] >[1] : number[] >[''] : string[] -var arr1: {}[]; // Bug 825172: Error ({}[] does not match {}[]), but should be OK ->arr1 : {}[] - var arr2 = [[null], [1], ['']]; ->arr2 : {}[] ->[[null], [1], ['']] : {}[] +>arr2 : Array +>[[null], [1], ['']] : Array >[null] : null[] >[1] : number[] >[''] : string[] -var arr2: {}[]; // Bug 825172: Error ({}[] does not match {}[]), but should be OK ->arr2 : {}[] - // Array literal with elements of only EveryType E has type E[] var stringArrArr = [[''], [""]]; @@ -29,30 +23,18 @@ var stringArrArr = [[''], [""]]; >[''] : string[] >[""] : string[] -var stringArrArr: string[][]; ->stringArrArr : string[][] - var stringArr = ['', ""]; >stringArr : string[] >['', ""] : string[] -var stringArr: string[]; ->stringArr : string[] - var numberArr = [0, 0.0, 0x00, 1e1]; >numberArr : number[] >[0, 0.0, 0x00, 1e1] : number[] -var numberArr: number[]; ->numberArr : number[] - var boolArr = [false, true, false, true]; >boolArr : boolean[] >[false, true, false, true] : boolean[] -var boolArr: boolean[]; ->boolArr : boolean[] - class C { private p; } >C : C >p : any @@ -65,10 +47,6 @@ var classArr = [new C(), new C()]; >new C() : C >C : typeof C -var classArr: C[]; // Should be OK ->classArr : C[] ->C : C - var classTypeArray = [C, C, C]; >classTypeArray : typeof C[] >[C, C, C] : typeof C[] @@ -87,7 +65,7 @@ var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: ' >n : number >a : string >b : number ->[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : { a: string; b: number; }[] +>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : Array<{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }> >{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; } >a : string >b : number @@ -98,8 +76,8 @@ var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: ' >c : number var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; ->context2 : {}[] ->[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : {}[] +>context2 : Array<{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }> +>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : Array<{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }> >{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; } >a : string >b : number @@ -109,10 +87,6 @@ var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; >b : number >c : number -var context2: Array<{}>; // Should be OK ->context2 : {}[] ->Array : T[] - // Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] class Base { private p; } >Base : Base @@ -131,7 +105,7 @@ class Derived2 extends Base { private n }; var context3: Base[] = [new Derived1(), new Derived2()]; >context3 : Base[] >Base : Base ->[new Derived1(), new Derived2()] : Base[] +>[new Derived1(), new Derived2()] : Array >new Derived1() : Derived1 >Derived1 : typeof Derived1 >new Derived2() : Derived2 @@ -141,7 +115,7 @@ var context3: Base[] = [new Derived1(), new Derived2()]; var context4: Base[] = [new Derived1(), new Derived1()]; >context4 : Base[] >Base : Base ->[new Derived1(), new Derived1()] : Base[] +>[new Derived1(), new Derived1()] : Derived1[] >new Derived1() : Derived1 >Derived1 : typeof Derived1 >new Derived1() : Derived1 diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types index becff7617b7..e99ca18673e 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types @@ -61,8 +61,8 @@ var xs = [list, myList]; // {}[] >myList : MyList var ys = [list, list2]; // {}[] ->ys : {}[] ->[list, list2] : {}[] +>ys : Array | List> +>[list, list2] : Array | List> >list : List >list2 : List diff --git a/tests/baselines/reference/arrayReferenceWithoutTypeArgs.errors.txt b/tests/baselines/reference/arrayReferenceWithoutTypeArgs.errors.txt index 6cffd03f44b..f662bf20af3 100644 --- a/tests/baselines/reference/arrayReferenceWithoutTypeArgs.errors.txt +++ b/tests/baselines/reference/arrayReferenceWithoutTypeArgs.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/arrayReferenceWithoutTypeArgs.ts(2,17): error TS2314: Generic type 'Array' requires 1 type argument(s). + + ==== tests/cases/compiler/arrayReferenceWithoutTypeArgs.ts (1 errors) ==== class X { public f(a: Array) { } ~~~~~ -!!! Generic type 'Array' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). } \ No newline at end of file diff --git a/tests/baselines/reference/arraySigChecking.errors.txt b/tests/baselines/reference/arraySigChecking.errors.txt index 3cb48f7a4e9..055c62c479b 100644 --- a/tests/baselines/reference/arraySigChecking.errors.txt +++ b/tests/baselines/reference/arraySigChecking.errors.txt @@ -1,3 +1,12 @@ +tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/arraySigChecking.ts(18,5): error TS2322: Type 'void[]' is not assignable to type 'string[]': + Type 'void' is not assignable to type 'string'. +tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' is not assignable to type 'number[][][]': + Type 'number[]' is not assignable to type 'number[][]': + Type 'number' is not assignable to type 'number[]': + Property 'length' is missing in type 'Number'. + + ==== tests/cases/compiler/arraySigChecking.ts (3 errors) ==== declare module M { interface iBar { t: any; } @@ -11,7 +20,7 @@ var foo: { [index: any]; }; // expect an error here ~~~~~ -!!! An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. } interface myInt { @@ -20,17 +29,17 @@ var myVar: myInt; var strArray: string[] = [myVar.voidFn()]; ~~~~~~~~ -!!! Type 'void[]' is not assignable to type 'string[]': -!!! Type 'void' is not assignable to type 'string'. +!!! error TS2322: Type 'void[]' is not assignable to type 'string[]': +!!! error TS2322: Type 'void' is not assignable to type 'string'. var myArray: number[][][]; myArray = [[1, 2]]; ~~~~~~~ -!!! Type 'number[][]' is not assignable to type 'number[][][]': -!!! Type 'number[]' is not assignable to type 'number[][]': -!!! Type 'number' is not assignable to type 'number[]': -!!! Property 'length' is missing in type 'Number'. +!!! error TS2322: Type 'number[][]' is not assignable to type 'number[][][]': +!!! error TS2322: Type 'number[]' is not assignable to type 'number[][]': +!!! error TS2322: Type 'number' is not assignable to type 'number[]': +!!! error TS2322: Property 'length' is missing in type 'Number'. function isEmpty(l: { length: number }) { return l.length === 0; diff --git a/tests/baselines/reference/arrayTypeOfFunctionTypes.errors.txt b/tests/baselines/reference/arrayTypeOfFunctionTypes.errors.txt index 58b4345bc02..b040c9eb1c9 100644 --- a/tests/baselines/reference/arrayTypeOfFunctionTypes.errors.txt +++ b/tests/baselines/reference/arrayTypeOfFunctionTypes.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfFunctionTypes.ts(11,11): error TS2350: Only a void function can be called with the 'new' keyword. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfFunctionTypes.ts(16,11): error TS2350: Only a void function can be called with the 'new' keyword. + + ==== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfFunctionTypes.ts (2 errors) ==== // valid uses of arrays of function types @@ -11,11 +15,11 @@ var r4 = r3(); var r4b = new r3(); // error ~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. +!!! error TS2350: Only a void function can be called with the 'new' keyword. var x3: Array<() => string>; var r5 = x2[1]; var r6 = r5(); var r6b = new r5(); // error ~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. \ No newline at end of file +!!! error TS2350: Only a void function can be called with the 'new' keyword. \ No newline at end of file diff --git a/tests/baselines/reference/arrayTypeOfFunctionTypes2.errors.txt b/tests/baselines/reference/arrayTypeOfFunctionTypes2.errors.txt index fc8cd992cfa..7be76cb9c1b 100644 --- a/tests/baselines/reference/arrayTypeOfFunctionTypes2.errors.txt +++ b/tests/baselines/reference/arrayTypeOfFunctionTypes2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfFunctionTypes2.ts(16,11): error TS2348: Value of type 'new () => string' is not callable. Did you mean to include 'new'? + + ==== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfFunctionTypes2.ts (1 errors) ==== // valid uses of arrays of function types @@ -16,4 +19,4 @@ var r6 = new r5(); var r6b = r5(); ~~~~ -!!! Value of type 'new () => string' is not callable. Did you mean to include 'new'? \ No newline at end of file +!!! error TS2348: Value of type 'new () => string' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt b/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt index cb877f5e57b..bb4867702ec 100644 --- a/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt +++ b/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt @@ -1,3 +1,12 @@ +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,22): error TS1005: '=' expected. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,30): error TS1109: Expression expected. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,22): error TS1005: '=' expected. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,32): error TS1109: Expression expected. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,5): error TS2322: Type 'number' is not assignable to type '{ (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }': + Property 'isArray' is missing in type 'Number'. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,5): error TS2323: Type 'number' is not assignable to type '{ (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }'. + + ==== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts (6 errors) ==== // array type cannot use typeof. @@ -6,16 +15,16 @@ var xs2: typeof Array; var xs3: typeof Array; ~ -!!! '=' expected. +!!! error TS1005: '=' expected. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~ -!!! Type 'number' is not assignable to type '{ (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }': -!!! Property 'isArray' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type '{ (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }': +!!! error TS2322: Property 'isArray' is missing in type 'Number'. var xs4: typeof Array; ~ -!!! '=' expected. +!!! error TS1005: '=' expected. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~ -!!! Type 'number' is not assignable to type '{ (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }'. \ No newline at end of file +!!! error TS2323: Type 'number' is not assignable to type '{ (arrayLength?: number): any[]; (arrayLength: number): T[]; (...items: T[]): T[]; new (arrayLength?: number): any[]; new (arrayLength: number): T[]; new (...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }'. \ No newline at end of file diff --git a/tests/baselines/reference/arrowFunctionContexts.errors.txt b/tests/baselines/reference/arrowFunctionContexts.errors.txt index 9a1e3cdb618..2f8a4f1a377 100644 --- a/tests/baselines/reference/arrowFunctionContexts.errors.txt +++ b/tests/baselines/reference/arrowFunctionContexts.errors.txt @@ -1,11 +1,23 @@ +tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(3,7): error TS2304: Cannot find name 'window'. +tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(3,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. +tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(19,1): error TS2304: Cannot find name 'window'. +tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(31,9): error TS2323: Type '() => number' is not assignable to type 'E'. +tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(32,16): error TS2332: 'this' cannot be referenced in current location. +tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(44,11): error TS2304: Cannot find name 'window'. +tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(44,11): error TS2410: All symbols within a 'with' block will be resolved to 'any'. +tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(60,5): error TS2304: Cannot find name 'window'. +tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(72,13): error TS2323: Type '() => number' is not assignable to type 'E'. +tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts(73,20): error TS2332: 'this' cannot be referenced in current location. + + ==== tests/cases/conformance/expressions/functions/arrowFunctionContexts.ts (10 errors) ==== // Arrow function used in with statement with (window) { ~~~~~~ -!!! Cannot find name 'window'. +!!! error TS2304: Cannot find name 'window'. ~~~~~~ -!!! All symbols within a 'with' block will be resolved to 'any'. +!!! error TS2410: All symbols within a 'with' block will be resolved to 'any'. var p = () => this; } @@ -23,7 +35,7 @@ // Arrow function as function argument window.setTimeout(() => null, 100); ~~~~~~ -!!! Cannot find name 'window'. +!!! error TS2304: Cannot find name 'window'. // Arrow function as value in array literal @@ -37,10 +49,10 @@ enum E { x = () => 4, // Error expected ~~~~~~~ -!!! Type '() => number' is not assignable to type 'E'. +!!! error TS2323: Type '() => number' is not assignable to type 'E'. y = (() => this).length // error, can't use this in enum ~~~~ -!!! 'this' cannot be referenced in current location. +!!! error TS2332: 'this' cannot be referenced in current location. } // Arrow function as module variable initializer @@ -54,9 +66,9 @@ // Arrow function used in with statement with (window) { ~~~~~~ -!!! Cannot find name 'window'. +!!! error TS2304: Cannot find name 'window'. ~~~~~~ -!!! All symbols within a 'with' block will be resolved to 'any'. +!!! error TS2410: All symbols within a 'with' block will be resolved to 'any'. var p = () => this; } @@ -74,7 +86,7 @@ // Arrow function as function argument window.setTimeout(() => null, 100); ~~~~~~ -!!! Cannot find name 'window'. +!!! error TS2304: Cannot find name 'window'. // Arrow function as value in array literal @@ -88,10 +100,10 @@ enum E { x = () => 4, // Error expected ~~~~~~~ -!!! Type '() => number' is not assignable to type 'E'. +!!! error TS2323: Type '() => number' is not assignable to type 'E'. y = (() => this).length ~~~~ -!!! 'this' cannot be referenced in current location. +!!! error TS2332: 'this' cannot be referenced in current location. } // Arrow function as module variable initializer diff --git a/tests/baselines/reference/arrowFunctionInConstructorArgument1.errors.txt b/tests/baselines/reference/arrowFunctionInConstructorArgument1.errors.txt index e5f33b3e1eb..0fc1315078e 100644 --- a/tests/baselines/reference/arrowFunctionInConstructorArgument1.errors.txt +++ b/tests/baselines/reference/arrowFunctionInConstructorArgument1.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/arrowFunctionInConstructorArgument1.ts(4,30): error TS2304: Cannot find name 'asdf'. + + ==== tests/cases/compiler/arrowFunctionInConstructorArgument1.ts (1 errors) ==== class C { constructor(x: () => void) { } } var c = new C(() => { return asdf; } ) // should error ~~~~ -!!! Cannot find name 'asdf'. +!!! error TS2304: Cannot find name 'asdf'. \ No newline at end of file diff --git a/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.errors.txt b/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.errors.txt index a0cf2c00518..cdc67fc09af 100644 --- a/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.errors.txt +++ b/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/arrowFunctionMissingCurlyWithSemicolon.ts(2,15): error TS1109: Expression expected. + + ==== tests/cases/compiler/arrowFunctionMissingCurlyWithSemicolon.ts (1 errors) ==== // Should error at semicolon. var f = () => ; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. var b = 1 * 2 * 3 * 4; var square = (x: number) => x * x; \ No newline at end of file diff --git a/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt b/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt index 69b94cd7d46..128e22d119e 100644 --- a/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt @@ -1,105 +1,131 @@ +tests/cases/compiler/arrowFunctionsMissingTokens.ts(3,16): error TS1005: '=>' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(5,22): error TS1005: '=>' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(7,17): error TS1005: '=>' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(9,36): error TS1005: '=>' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(11,42): error TS1005: '=>' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(16,23): error TS1005: '{' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(18,29): error TS1005: '{' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(20,24): error TS1005: '{' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(22,43): error TS1005: '{' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(24,49): error TS1005: '{' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(26,23): error TS1005: '{' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(30,23): error TS1109: Expression expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(32,29): error TS1109: Expression expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(34,24): error TS1109: Expression expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(36,43): error TS1109: Expression expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(38,49): error TS1109: Expression expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(40,23): error TS1109: Expression expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(41,5): error TS1128: Declaration or statement expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(42,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(45,14): error TS1109: Expression expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(47,21): error TS1005: '=>' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(51,35): error TS1005: '=>' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(53,41): error TS1005: '=>' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(49,14): error TS2304: Cannot find name 'x'. + + ==== tests/cases/compiler/arrowFunctionsMissingTokens.ts (24 errors) ==== module missingArrowsWithCurly { var a = () { }; ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. var b = (): void { } ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. var c = (x) { }; ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. var d = (x: number, y: string) { }; ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. var e = (x: number, y: string): void { }; ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. } module missingCurliesWithArrow { module withStatement { var a = () => var k = 10;}; ~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. var b = (): void => var k = 10;} ~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. var c = (x) => var k = 10;}; ~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. var d = (x: number, y: string) => var k = 10;}; ~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. var e = (x: number, y: string): void => var k = 10;}; ~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. var f = () => var k = 10;} ~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. } module withoutStatement { var a = () => }; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. var b = (): void => } ~ -!!! Expression expected. +!!! error TS1109: Expression expected. var c = (x) => }; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. var d = (x: number, y: string) => }; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. var e = (x: number, y: string): void => }; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. var f = () => } ~ -!!! Expression expected. +!!! error TS1109: Expression expected. } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. module ce_nEst_pas_une_arrow_function { var a = (); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. var b = (): void; ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. var c = (x); ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. var d = (x: number, y: string); ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. var e = (x: number, y: string): void; ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. } module okay { diff --git a/tests/baselines/reference/asiReturn.errors.txt b/tests/baselines/reference/asiReturn.errors.txt index 7b7b44655c2..1cc3ec8a3c1 100644 --- a/tests/baselines/reference/asiReturn.errors.txt +++ b/tests/baselines/reference/asiReturn.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/asiReturn.ts(2,1): error TS1108: A 'return' statement can only be used within a function body. + + ==== tests/cases/compiler/asiReturn.ts (1 errors) ==== // This should be an error for using a return outside a function, but ASI should work properly return ~~~~~~ -!!! A 'return' statement can only be used within a function body. \ No newline at end of file +!!! error TS1108: A 'return' statement can only be used within a function body. \ No newline at end of file diff --git a/tests/baselines/reference/assertInWrapSomeTypeParameter.errors.txt b/tests/baselines/reference/assertInWrapSomeTypeParameter.errors.txt index 007b23dc474..f9019661fb5 100644 --- a/tests/baselines/reference/assertInWrapSomeTypeParameter.errors.txt +++ b/tests/baselines/reference/assertInWrapSomeTypeParameter.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/assertInWrapSomeTypeParameter.ts(2,26): error TS1005: '>' expected. +tests/cases/compiler/assertInWrapSomeTypeParameter.ts(1,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/assertInWrapSomeTypeParameter.ts (2 errors) ==== class C> { ~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo>(x: U) { ~ -!!! '>' expected. +!!! error TS1005: '>' expected. return null; } } \ No newline at end of file diff --git a/tests/baselines/reference/assignAnyToEveryType.errors.txt b/tests/baselines/reference/assignAnyToEveryType.errors.txt index a6eadd12038..9aae6efc37e 100644 --- a/tests/baselines/reference/assignAnyToEveryType.errors.txt +++ b/tests/baselines/reference/assignAnyToEveryType.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/types/any/assignAnyToEveryType.ts(41,1): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/conformance/types/any/assignAnyToEveryType.ts (1 errors) ==== // all of these are valid @@ -41,7 +44,7 @@ M = x; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. function k(a: T) { a = x; diff --git a/tests/baselines/reference/assignFromBooleanInterface.errors.txt b/tests/baselines/reference/assignFromBooleanInterface.errors.txt index 679399d4533..48f06b7409e 100644 --- a/tests/baselines/reference/assignFromBooleanInterface.errors.txt +++ b/tests/baselines/reference/assignFromBooleanInterface.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface.ts(3,1): error TS2323: Type 'Boolean' is not assignable to type 'boolean'. + + ==== tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface.ts (1 errors) ==== var x = true; var a: Boolean; x = a; ~ -!!! Type 'Boolean' is not assignable to type 'boolean'. +!!! error TS2323: Type 'Boolean' is not assignable to type 'boolean'. a = x; \ No newline at end of file diff --git a/tests/baselines/reference/assignFromBooleanInterface2.errors.txt b/tests/baselines/reference/assignFromBooleanInterface2.errors.txt index fc1350681f4..495f8cc432d 100644 --- a/tests/baselines/reference/assignFromBooleanInterface2.errors.txt +++ b/tests/baselines/reference/assignFromBooleanInterface2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(19,1): error TS2323: Type 'Boolean' is not assignable to type 'boolean'. +tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(20,1): error TS2323: Type 'NotBoolean' is not assignable to type 'boolean'. + + ==== tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts (2 errors) ==== interface Boolean { doStuff(): string; @@ -19,9 +23,9 @@ x = a; // expected error ~ -!!! Type 'Boolean' is not assignable to type 'boolean'. +!!! error TS2323: Type 'Boolean' is not assignable to type 'boolean'. x = b; // expected error ~ -!!! Type 'NotBoolean' is not assignable to type 'boolean'. +!!! error TS2323: Type 'NotBoolean' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/assignFromNumberInterface.errors.txt b/tests/baselines/reference/assignFromNumberInterface.errors.txt index 845b8cb5b7f..5a65c08de4a 100644 --- a/tests/baselines/reference/assignFromNumberInterface.errors.txt +++ b/tests/baselines/reference/assignFromNumberInterface.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/types/primitives/number/assignFromNumberInterface.ts(3,1): error TS2323: Type 'Number' is not assignable to type 'number'. + + ==== tests/cases/conformance/types/primitives/number/assignFromNumberInterface.ts (1 errors) ==== var x = 1; var a: Number; x = a; ~ -!!! Type 'Number' is not assignable to type 'number'. +!!! error TS2323: Type 'Number' is not assignable to type 'number'. a = x; \ No newline at end of file diff --git a/tests/baselines/reference/assignFromNumberInterface2.errors.txt b/tests/baselines/reference/assignFromNumberInterface2.errors.txt index 331232f6cea..45a600658c2 100644 --- a/tests/baselines/reference/assignFromNumberInterface2.errors.txt +++ b/tests/baselines/reference/assignFromNumberInterface2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/primitives/number/assignFromNumberInterface2.ts(23,1): error TS2323: Type 'Number' is not assignable to type 'number'. +tests/cases/conformance/types/primitives/number/assignFromNumberInterface2.ts(24,1): error TS2323: Type 'NotNumber' is not assignable to type 'number'. + + ==== tests/cases/conformance/types/primitives/number/assignFromNumberInterface2.ts (2 errors) ==== interface Number { doStuff(): string; @@ -23,9 +27,9 @@ x = a; // expected error ~ -!!! Type 'Number' is not assignable to type 'number'. +!!! error TS2323: Type 'Number' is not assignable to type 'number'. x = b; // expected error ~ -!!! Type 'NotNumber' is not assignable to type 'number'. +!!! error TS2323: Type 'NotNumber' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignFromStringInterface.errors.txt b/tests/baselines/reference/assignFromStringInterface.errors.txt index ba8c5fd583c..93f28853c8a 100644 --- a/tests/baselines/reference/assignFromStringInterface.errors.txt +++ b/tests/baselines/reference/assignFromStringInterface.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/types/primitives/string/assignFromStringInterface.ts(3,1): error TS2323: Type 'String' is not assignable to type 'string'. + + ==== tests/cases/conformance/types/primitives/string/assignFromStringInterface.ts (1 errors) ==== var x = ''; var a: String; x = a; ~ -!!! Type 'String' is not assignable to type 'string'. +!!! error TS2323: Type 'String' is not assignable to type 'string'. a = x; \ No newline at end of file diff --git a/tests/baselines/reference/assignFromStringInterface2.errors.txt b/tests/baselines/reference/assignFromStringInterface2.errors.txt index 6a8f5e5f6f0..b34366a7ce7 100644 --- a/tests/baselines/reference/assignFromStringInterface2.errors.txt +++ b/tests/baselines/reference/assignFromStringInterface2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/primitives/string/assignFromStringInterface2.ts(46,1): error TS2323: Type 'String' is not assignable to type 'string'. +tests/cases/conformance/types/primitives/string/assignFromStringInterface2.ts(47,1): error TS2323: Type 'NotString' is not assignable to type 'string'. + + ==== tests/cases/conformance/types/primitives/string/assignFromStringInterface2.ts (2 errors) ==== interface String { doStuff(): string; @@ -46,9 +50,9 @@ x = a; // expected error ~ -!!! Type 'String' is not assignable to type 'string'. +!!! error TS2323: Type 'String' is not assignable to type 'string'. x = b; // expected error ~ -!!! Type 'NotString' is not assignable to type 'string'. +!!! error TS2323: Type 'NotString' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt index 78c710a7d50..580c6fa3c45 100644 --- a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt +++ b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts(7,4): error TS2345: Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. + Property 'x' is missing in type '(a: any, b: any) => boolean'. +tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts(8,4): error TS2345: Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. + Property 'x' is missing in type '(a: any, b: any) => boolean'. + + ==== tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts (2 errors) ==== interface IResultCallback extends Function { x: number; @@ -7,10 +13,10 @@ fn((a, b) => true); ~~~~~~~~~~~~~~ -!!! Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. -!!! Property 'x' is missing in type '(a: any, b: any) => boolean'. +!!! error TS2345: Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. +!!! error TS2345: Property 'x' is missing in type '(a: any, b: any) => boolean'. fn(function (a, b) { return true; }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. -!!! Property 'x' is missing in type '(a: any, b: any) => boolean'. +!!! error TS2345: Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. +!!! error TS2345: Property 'x' is missing in type '(a: any, b: any) => boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/assignToEnum.errors.txt b/tests/baselines/reference/assignToEnum.errors.txt index bc37cc5496d..4846a96dbb7 100644 --- a/tests/baselines/reference/assignToEnum.errors.txt +++ b/tests/baselines/reference/assignToEnum.errors.txt @@ -1,16 +1,22 @@ +tests/cases/compiler/assignToEnum.ts(2,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/compiler/assignToEnum.ts(3,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/compiler/assignToEnum.ts(4,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/compiler/assignToEnum.ts(5,1): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/compiler/assignToEnum.ts (4 errors) ==== enum A { foo, bar } A = undefined; // invalid LHS ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. A = A.bar; // invalid LHS ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. A.foo = 1; // invalid LHS ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. A.foo = A.bar; // invalid LHS ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. \ No newline at end of file diff --git a/tests/baselines/reference/assignToExistingClass.errors.txt b/tests/baselines/reference/assignToExistingClass.errors.txt index 49feb0a76a0..6a377df5b0c 100644 --- a/tests/baselines/reference/assignToExistingClass.errors.txt +++ b/tests/baselines/reference/assignToExistingClass.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/assignToExistingClass.ts(8,13): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/compiler/assignToExistingClass.ts (1 errors) ==== module Test { class Mocked { @@ -8,7 +11,7 @@ willThrowError() { Mocked = Mocked || function () { // => Error: Invalid left-hand side of assignment expression. ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. return { myProp: "test" }; }; } diff --git a/tests/baselines/reference/assignToFn.errors.txt b/tests/baselines/reference/assignToFn.errors.txt index 10af5946425..6b1403b7df1 100644 --- a/tests/baselines/reference/assignToFn.errors.txt +++ b/tests/baselines/reference/assignToFn.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/assignToFn.ts(8,5): error TS2323: Type 'string' is not assignable to type '(n: number) => boolean'. + + ==== tests/cases/compiler/assignToFn.ts (1 errors) ==== module M { interface I { @@ -8,6 +11,6 @@ x.f="hello"; ~~~ -!!! Type 'string' is not assignable to type '(n: number) => boolean'. +!!! error TS2323: Type 'string' is not assignable to type '(n: number) => boolean'. } \ No newline at end of file diff --git a/tests/baselines/reference/assignToInvalidLHS.errors.txt b/tests/baselines/reference/assignToInvalidLHS.errors.txt index dd183cf6391..a39756d15f7 100644 --- a/tests/baselines/reference/assignToInvalidLHS.errors.txt +++ b/tests/baselines/reference/assignToInvalidLHS.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/assignToInvalidLHS.ts(4,9): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/compiler/assignToInvalidLHS.ts (1 errors) ==== declare var y:any; // Below is actually valid JavaScript (see http://es5.github.com/#x8.7 ), even though will always fail at runtime with 'invalid left-hand side' var x = new y = 5; ~~~~~ -!!! Invalid left-hand side of assignment expression. \ No newline at end of file +!!! error TS2364: Invalid left-hand side of assignment expression. \ No newline at end of file diff --git a/tests/baselines/reference/assignToModule.errors.txt b/tests/baselines/reference/assignToModule.errors.txt index ba284a32fa6..26121d72a05 100644 --- a/tests/baselines/reference/assignToModule.errors.txt +++ b/tests/baselines/reference/assignToModule.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/assignToModule.ts(2,1): error TS2304: Cannot find name 'A'. + + ==== tests/cases/compiler/assignToModule.ts (1 errors) ==== module A {} A = undefined; // invalid LHS ~ -!!! Cannot find name 'A'. \ No newline at end of file +!!! error TS2304: Cannot find name 'A'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompat1.errors.txt b/tests/baselines/reference/assignmentCompat1.errors.txt index 540bb044f6a..0e22bd1b391 100644 --- a/tests/baselines/reference/assignmentCompat1.errors.txt +++ b/tests/baselines/reference/assignmentCompat1.errors.txt @@ -1,12 +1,18 @@ +tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2322: Type '{ [x: string]: any; }' is not assignable to type '{ one: number; }': + Property 'one' is missing in type '{ [x: string]: any; }'. +tests/cases/compiler/assignmentCompat1.ts(5,1): error TS2322: Type '{ one: number; }' is not assignable to type '{ [x: string]: any; }': + Index signature is missing in type '{ one: number; }'. + + ==== tests/cases/compiler/assignmentCompat1.ts (2 errors) ==== var x = {one: 1}; var y: {[index:string]: any}; x = y; ~ -!!! Type '{ [x: string]: any; }' is not assignable to type '{ one: number; }': -!!! Property 'one' is missing in type '{ [x: string]: any; }'. +!!! error TS2322: Type '{ [x: string]: any; }' is not assignable to type '{ one: number; }': +!!! error TS2322: Property 'one' is missing in type '{ [x: string]: any; }'. y = x; ~ -!!! Type '{ one: number; }' is not assignable to type '{ [x: string]: any; }': -!!! Index signature is missing in type '{ one: number; }'. \ No newline at end of file +!!! error TS2322: Type '{ one: number; }' is not assignable to type '{ [x: string]: any; }': +!!! error TS2322: Index signature is missing in type '{ one: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt new file mode 100644 index 00000000000..2395f2bf364 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt @@ -0,0 +1,38 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(17,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]': + Types of property 'pop' are incompatible: + Type '() => string | number' is not assignable to type '() => number': + Type 'string | number' is not assignable to type 'number': + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2322: Type '{}[]' is not assignable to type '[{}]': + Property '0' is missing in type '{}[]'. + + +==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts (2 errors) ==== + var numStrTuple: [number, string]; + var numNumTuple: [number, number]; + var numEmptyObjTuple: [number, {}]; + var emptyObjTuple: [{}]; + + var numArray: number[]; + var emptyObjArray: {}[]; + + // no error + numArray = numNumTuple; + emptyObjArray = emptyObjTuple; + emptyObjArray = numStrTuple; + emptyObjArray = numNumTuple; + emptyObjArray = numEmptyObjTuple; + + // error + numArray = numStrTuple; + ~~~~~~~~ +!!! error TS2322: Type '[number, string]' is not assignable to type 'number[]': +!!! error TS2322: Types of property 'pop' are incompatible: +!!! error TS2322: Type '() => string | number' is not assignable to type '() => number': +!!! error TS2322: Type 'string | number' is not assignable to type 'number': +!!! error TS2322: Type 'string' is not assignable to type 'number'. + emptyObjTuple = emptyObjArray; + ~~~~~~~~~~~~~ +!!! error TS2322: Type '{}[]' is not assignable to type '[{}]': +!!! error TS2322: Property '0' is missing in type '{}[]'. + \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js new file mode 100644 index 00000000000..fd3ac1d46f1 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js @@ -0,0 +1,37 @@ +//// [assignmentCompatBetweenTupleAndArray.ts] +var numStrTuple: [number, string]; +var numNumTuple: [number, number]; +var numEmptyObjTuple: [number, {}]; +var emptyObjTuple: [{}]; + +var numArray: number[]; +var emptyObjArray: {}[]; + +// no error +numArray = numNumTuple; +emptyObjArray = emptyObjTuple; +emptyObjArray = numStrTuple; +emptyObjArray = numNumTuple; +emptyObjArray = numEmptyObjTuple; + +// error +numArray = numStrTuple; +emptyObjTuple = emptyObjArray; + + +//// [assignmentCompatBetweenTupleAndArray.js] +var numStrTuple; +var numNumTuple; +var numEmptyObjTuple; +var emptyObjTuple; +var numArray; +var emptyObjArray; +// no error +numArray = numNumTuple; +emptyObjArray = emptyObjTuple; +emptyObjArray = numStrTuple; +emptyObjArray = numNumTuple; +emptyObjArray = numEmptyObjTuple; +// error +numArray = numStrTuple; +emptyObjTuple = emptyObjArray; diff --git a/tests/baselines/reference/assignmentCompatBug2.errors.txt b/tests/baselines/reference/assignmentCompatBug2.errors.txt index ddbc1706930..260aa868dfd 100644 --- a/tests/baselines/reference/assignmentCompatBug2.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug2.errors.txt @@ -1,13 +1,25 @@ +tests/cases/compiler/assignmentCompatBug2.ts(1,5): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }': + Property 'b' is missing in type '{ a: number; }'. +tests/cases/compiler/assignmentCompatBug2.ts(3,1): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }': + Property 'b' is missing in type '{ a: number; }'. +tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }': + Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'. +tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }': + Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'. +tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }': + Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'. + + ==== tests/cases/compiler/assignmentCompatBug2.ts (5 errors) ==== var b2: { b: number;} = { a: 0 }; // error ~~ -!!! Type '{ a: number; }' is not assignable to type '{ b: number; }': -!!! Property 'b' is missing in type '{ a: number; }'. +!!! error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }': +!!! error TS2322: Property 'b' is missing in type '{ a: number; }'. b2 = { a: 0 }; // error ~~ -!!! Type '{ a: number; }' is not assignable to type '{ b: number; }': -!!! Property 'b' is missing in type '{ a: number; }'. +!!! error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }': +!!! error TS2322: Property 'b' is missing in type '{ a: number; }'. b2 = {b: 0, a: 0 }; @@ -21,16 +33,16 @@ b3 = { ~~ -!!! Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }': -!!! Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'. +!!! error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }': +!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'. f: (n) => { return 0; }, g: (s) => { return 0; }, }; // error b3 = { ~~ -!!! Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }': -!!! Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'. +!!! error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }': +!!! error TS2322: Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'. f: (n) => { return 0; }, m: 0, }; // error @@ -45,8 +57,8 @@ b3 = { ~~ -!!! Type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }': -!!! Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'. +!!! error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }': +!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'. f: (n) => { return 0; }, g: (s) => { return 0; }, n: 0, diff --git a/tests/baselines/reference/assignmentCompatBug3.errors.txt b/tests/baselines/reference/assignmentCompatBug3.errors.txt index f2cb650567e..fe7ff5bbddc 100644 --- a/tests/baselines/reference/assignmentCompatBug3.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug3.errors.txt @@ -1,12 +1,17 @@ +tests/cases/compiler/assignmentCompatBug3.ts(3,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/assignmentCompatBug3.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/assignmentCompatBug3.ts(14,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/assignmentCompatBug3.ts (3 errors) ==== function makePoint(x: number, y: number) { return { get x() { return x;}, // shouldn't be "void" ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. get y() { return y;}, // shouldn't be "void" ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. //x: "yo", //y: "boo", dist: function () { @@ -18,7 +23,7 @@ class C { get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 0; } } diff --git a/tests/baselines/reference/assignmentCompatBug5.errors.txt b/tests/baselines/reference/assignmentCompatBug5.errors.txt index cd8f24cee3f..a015cc3bbcf 100644 --- a/tests/baselines/reference/assignmentCompatBug5.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug5.errors.txt @@ -1,22 +1,30 @@ +tests/cases/compiler/assignmentCompatBug5.ts(2,6): error TS2345: Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'. + Property 'a' is missing in type '{ b: number; }'. +tests/cases/compiler/assignmentCompatBug5.ts(5,6): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'number[]'. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/assignmentCompatBug5.ts(8,6): error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'. +tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'. + + ==== tests/cases/compiler/assignmentCompatBug5.ts (4 errors) ==== function foo1(x: { a: number; }) { } foo1({ b: 5 }); ~~~~~~~~ -!!! Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'. -!!! Property 'a' is missing in type '{ b: number; }'. +!!! error TS2345: Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'. +!!! error TS2345: Property 'a' is missing in type '{ b: number; }'. function foo2(x: number[]) { } foo2(["s", "t"]); ~~~~~~~~~~ -!!! Argument of type 'string[]' is not assignable to parameter of type 'number[]'. -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. function foo3(x: (n: number) =>number) { }; foo3((s:string) => { }); ~~~~~~~~~~~~~~~~~ -!!! Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'. +!!! error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'. foo3((n) => { return; }); ~~~~~~~~~~~~~~~~~~ -!!! Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'. +!!! error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt b/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt index fda1cca3d8e..a17c09988a3 100644 --- a/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt +++ b/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt @@ -1,15 +1,23 @@ +tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(4,5): error TS2345: Argument of type '{ id: number; name: boolean; }' is not assignable to parameter of type '{ id: number; name?: string; }'. + Types of property 'name' are incompatible: + Type 'boolean' is not assignable to type 'string'. +tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(5,5): error TS2345: Argument of type '{ name: string; }' is not assignable to parameter of type '{ id: number; name?: string; }'. + Property 'id' is missing in type '{ name: string; }'. + + ==== tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts (3 errors) ==== function foo(x: { id: number; name?: string; }): void; ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. foo({ id: 1234 }); // Ok foo({ id: 1234, name: "hello" }); // Ok foo({ id: 1234, name: false }); // Error, name of wrong type ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '{ id: number; name: boolean; }' is not assignable to parameter of type '{ id: number; name?: string; }'. -!!! Types of property 'name' are incompatible: -!!! Type 'boolean' is not assignable to type 'string'. +!!! error TS2345: Argument of type '{ id: number; name: boolean; }' is not assignable to parameter of type '{ id: number; name?: string; }'. +!!! error TS2345: Types of property 'name' are incompatible: +!!! error TS2345: Type 'boolean' is not assignable to type 'string'. foo({ name: "hello" }); // Error, id required but missing ~~~~~~~~~~~~~~~~~ -!!! Argument of type '{ name: string; }' is not assignable to parameter of type '{ id: number; name?: string; }'. -!!! Property 'id' is missing in type '{ name: string; }'. \ No newline at end of file +!!! error TS2345: Argument of type '{ name: string; }' is not assignable to parameter of type '{ id: number; name?: string; }'. +!!! error TS2345: Property 'id' is missing in type '{ name: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.errors.txt b/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.errors.txt index 7d84f69b3d2..f972c9a925e 100644 --- a/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.errors.txt +++ b/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts(15,5): error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'IHandlerMap'. + + ==== tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts (1 errors) ==== interface IHandler { (e): boolean; @@ -15,5 +18,5 @@ Biz(new Foo()); ~~~~~~~~~ -!!! Argument of type 'Foo' is not assignable to parameter of type 'IHandlerMap'. +!!! error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'IHandlerMap'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt index ab314d0a95f..e2016fb7029 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt @@ -1,3 +1,29 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(35,1): error TS2322: Type 'S2' is not assignable to type 'T': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(36,1): error TS2322: Type '(x: string) => void' is not assignable to type 'T': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(37,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(38,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(39,1): error TS2322: Type 'S2' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(40,1): error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(41,1): error TS2322: Type '(x: string) => number' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(42,1): error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts (8 errors) ==== // void returning call signatures can be assigned a non-void returning call signature that otherwise matches @@ -35,42 +61,42 @@ // these are errors t = s2; ~ -!!! Type 'S2' is not assignable to type 'T': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'S2' is not assignable to type 'T': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. t = a3; ~ -!!! Type '(x: string) => void' is not assignable to type 'T': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: string) => void' is not assignable to type 'T': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. t = (x: string) => 1; ~ -!!! Type '(x: string) => number' is not assignable to type 'T': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: string) => number' is not assignable to type 'T': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. t = function (x: string) { return ''; } ~ -!!! Type '(x: string) => string' is not assignable to type 'T': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: string) => string' is not assignable to type 'T': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. a = s2; ~ -!!! Type 'S2' is not assignable to type '(x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'S2' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. a = a3; ~ -!!! Type '(x: string) => void' is not assignable to type '(x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. a = (x: string) => 1; ~ -!!! Type '(x: string) => number' is not assignable to type '(x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: string) => number' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. a = function (x: string) { return ''; } ~ -!!! Type '(x: string) => string' is not assignable to type '(x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt index 2fa4e383e9f..1aed50f25f1 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt @@ -1,3 +1,41 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(31,1): error TS2322: Type '() => number' is not assignable to type 'T': + Property 'f' is missing in type '() => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(32,1): error TS2322: Type '(x: number) => string' is not assignable to type 'T': + Property 'f' is missing in type '(x: number) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(33,1): error TS2322: Type '() => number' is not assignable to type '{ f(x: number): void; }': + Property 'f' is missing in type '() => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(34,1): error TS2322: Type '(x: number) => string' is not assignable to type '{ f(x: number): void; }': + Property 'f' is missing in type '(x: number) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(42,1): error TS2322: Type 'S2' is not assignable to type 'T': + Types of property 'f' are incompatible: + Type '(x: string) => void' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(43,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T': + Types of property 'f' are incompatible: + Type '(x: string) => void' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(44,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T': + Property 'f' is missing in type '(x: string) => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(45,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T': + Property 'f' is missing in type '(x: string) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(46,1): error TS2322: Type 'S2' is not assignable to type '{ f(x: number): void; }': + Types of property 'f' are incompatible: + Type '(x: string) => void' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(47,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f(x: number): void; }': + Types of property 'f' are incompatible: + Type '(x: string) => void' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(48,1): error TS2322: Type '(x: string) => number' is not assignable to type '{ f(x: number): void; }': + Property 'f' is missing in type '(x: string) => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(49,1): error TS2322: Type '(x: string) => string' is not assignable to type '{ f(x: number): void; }': + Property 'f' is missing in type '(x: string) => string'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts (12 errors) ==== // void returning call signatures can be assigned a non-void returning call signature that otherwise matches @@ -31,20 +69,20 @@ // errors t = () => 1; ~ -!!! Type '() => number' is not assignable to type 'T': -!!! Property 'f' is missing in type '() => number'. +!!! error TS2322: Type '() => number' is not assignable to type 'T': +!!! error TS2322: Property 'f' is missing in type '() => number'. t = function (x: number) { return ''; } ~ -!!! Type '(x: number) => string' is not assignable to type 'T': -!!! Property 'f' is missing in type '(x: number) => string'. +!!! error TS2322: Type '(x: number) => string' is not assignable to type 'T': +!!! error TS2322: Property 'f' is missing in type '(x: number) => string'. a = () => 1; ~ -!!! Type '() => number' is not assignable to type '{ f(x: number): void; }': -!!! Property 'f' is missing in type '() => number'. +!!! error TS2322: Type '() => number' is not assignable to type '{ f(x: number): void; }': +!!! error TS2322: Property 'f' is missing in type '() => number'. a = function (x: number) { return ''; } ~ -!!! Type '(x: number) => string' is not assignable to type '{ f(x: number): void; }': -!!! Property 'f' is missing in type '(x: number) => string'. +!!! error TS2322: Type '(x: number) => string' is not assignable to type '{ f(x: number): void; }': +!!! error TS2322: Property 'f' is missing in type '(x: number) => string'. interface S2 { f(x: string): void; @@ -54,46 +92,46 @@ // these are errors t = s2; ~ -!!! Type 'S2' is not assignable to type 'T': -!!! Types of property 'f' are incompatible: -!!! Type '(x: string) => void' is not assignable to type '(x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'S2' is not assignable to type 'T': +!!! error TS2322: Types of property 'f' are incompatible: +!!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. t = a3; ~ -!!! Type '{ f(x: string): void; }' is not assignable to type 'T': -!!! Types of property 'f' are incompatible: -!!! Type '(x: string) => void' is not assignable to type '(x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T': +!!! error TS2322: Types of property 'f' are incompatible: +!!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. t = (x: string) => 1; ~ -!!! Type '(x: string) => number' is not assignable to type 'T': -!!! Property 'f' is missing in type '(x: string) => number'. +!!! error TS2322: Type '(x: string) => number' is not assignable to type 'T': +!!! error TS2322: Property 'f' is missing in type '(x: string) => number'. t = function (x: string) { return ''; } ~ -!!! Type '(x: string) => string' is not assignable to type 'T': -!!! Property 'f' is missing in type '(x: string) => string'. +!!! error TS2322: Type '(x: string) => string' is not assignable to type 'T': +!!! error TS2322: Property 'f' is missing in type '(x: string) => string'. a = s2; ~ -!!! Type 'S2' is not assignable to type '{ f(x: number): void; }': -!!! Types of property 'f' are incompatible: -!!! Type '(x: string) => void' is not assignable to type '(x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'S2' is not assignable to type '{ f(x: number): void; }': +!!! error TS2322: Types of property 'f' are incompatible: +!!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. a = a3; ~ -!!! Type '{ f(x: string): void; }' is not assignable to type '{ f(x: number): void; }': -!!! Types of property 'f' are incompatible: -!!! Type '(x: string) => void' is not assignable to type '(x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f(x: number): void; }': +!!! error TS2322: Types of property 'f' are incompatible: +!!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. a = (x: string) => 1; ~ -!!! Type '(x: string) => number' is not assignable to type '{ f(x: number): void; }': -!!! Property 'f' is missing in type '(x: string) => number'. +!!! error TS2322: Type '(x: string) => number' is not assignable to type '{ f(x: number): void; }': +!!! error TS2322: Property 'f' is missing in type '(x: string) => number'. a = function (x: string) { return ''; } ~ -!!! Type '(x: string) => string' is not assignable to type '{ f(x: number): void; }': -!!! Property 'f' is missing in type '(x: string) => string'. +!!! error TS2322: Type '(x: string) => string' is not assignable to type '{ f(x: number): void; }': +!!! error TS2322: Property 'f' is missing in type '(x: string) => string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt index 973dfe92ca2..92bc30a7144 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt @@ -1,3 +1,19 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(52,9): error TS2322: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': + Types of parameters 'y' and 'y' are incompatible: + Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': + Types of parameters 'arg2' and 'arg2' are incompatible: + Type '{ foo: number; }' is not assignable to type 'Base': + Types of property 'foo' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(53,9): error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U': + Types of parameters 'y' and 'y' are incompatible: + Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any': + Types of parameters 'arg2' and 'arg2' are incompatible: + Type 'Base' is not assignable to type '{ foo: number; }': + Types of property 'foo' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts (2 errors) ==== // These are mostly permitted with the current loose rules. All ok unless otherwise noted. @@ -52,22 +68,22 @@ var b8: (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U; a8 = b8; // error, { foo: number } and Base are incompatible ~~ -!!! Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': -!!! Types of parameters 'arg2' and 'arg2' are incompatible: -!!! Type '{ foo: number; }' is not assignable to type 'Base': -!!! Types of property 'foo' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': +!!! error TS2322: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2322: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': +!!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible: +!!! error TS2322: Type '{ foo: number; }' is not assignable to type 'Base': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. b8 = a8; // error, { foo: number } and Base are incompatible ~~ -!!! Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any': -!!! Types of parameters 'arg2' and 'arg2' are incompatible: -!!! Type 'Base' is not assignable to type '{ foo: number; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U': +!!! error TS2322: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any': +!!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type '{ foo: number; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var b10: (...x: T[]) => T; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.errors.txt index 125def7dc62..2bdd0ef61a9 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.errors.txt @@ -1,3 +1,12 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(16,5): error TS2323: Type '(x: number) => number' is not assignable to type '() => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(19,5): error TS2323: Type '(x: number) => number' is not assignable to type '() => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(20,5): error TS2323: Type '(x: number, y?: number) => number' is not assignable to type '() => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(22,5): error TS2323: Type '(x: number, y: number) => number' is not assignable to type '() => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(33,5): error TS2323: Type '(x: number, y: number) => number' is not assignable to type '(x?: number) => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(39,5): error TS2323: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(45,5): error TS2323: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts (7 errors) ==== // call signatures in derived types must have the same or fewer optional parameters as the base type @@ -16,19 +25,19 @@ a = (x?: number) => 1; // ok, same number of required params a = (x: number) => 1; // error, too many required params ~ -!!! Type '(x: number) => number' is not assignable to type '() => number'. +!!! error TS2323: Type '(x: number) => number' is not assignable to type '() => number'. a = b.a; // ok a = b.a2; // ok a = b.a3; // error ~ -!!! Type '(x: number) => number' is not assignable to type '() => number'. +!!! error TS2323: Type '(x: number) => number' is not assignable to type '() => number'. a = b.a4; // error ~ -!!! Type '(x: number, y?: number) => number' is not assignable to type '() => number'. +!!! error TS2323: Type '(x: number, y?: number) => number' is not assignable to type '() => number'. a = b.a5; // ok a = b.a6; // error ~ -!!! Type '(x: number, y: number) => number' is not assignable to type '() => number'. +!!! error TS2323: Type '(x: number, y: number) => number' is not assignable to type '() => number'. var a2: (x?: number) => number; a2 = () => 1; // ok, same number of required params @@ -41,7 +50,7 @@ a2 = b.a5; // ok a2 = b.a6; // error ~~ -!!! Type '(x: number, y: number) => number' is not assignable to type '(x?: number) => number'. +!!! error TS2323: Type '(x: number, y: number) => number' is not assignable to type '(x?: number) => number'. var a3: (x: number) => number; a3 = () => 1; // ok, fewer required params @@ -49,7 +58,7 @@ a3 = (x: number) => 1; // ok, same number of required params a3 = (x: number, y: number) => 1; // error, too many required params ~~ -!!! Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. +!!! error TS2323: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. a3 = b.a; // ok a3 = b.a2; // ok a3 = b.a3; // ok @@ -57,7 +66,7 @@ a3 = b.a5; // ok a3 = b.a6; // error ~~ -!!! Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. +!!! error TS2323: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. var a4: (x: number, y?: number) => number; a4 = () => 1; // ok, fewer required params diff --git a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt index 7bee15e16b7..117f6cae0e9 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt @@ -1,3 +1,32 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(13,5): error TS2322: Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number': + Types of parameters 'args' and 'args' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(17,5): error TS2322: Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number': + Types of parameters 'x' and 'args' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(26,5): error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number': + Types of parameters 'args' and 'z' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(35,5): error TS2322: Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number': + Types of parameters 'y' and 'y' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(36,5): error TS2322: Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number': + Types of parameters 'z' and 'y' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(37,5): error TS2322: Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(41,5): error TS2322: Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number': + Types of parameters 'y' and 'y' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(43,5): error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number': + Types of parameters 'y' and 'y' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(45,5): error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number': + Types of parameters 'args' and 'z' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts (9 errors) ==== // call signatures in derived types must have the same or fewer optional parameters as the target for assignment @@ -13,17 +42,17 @@ a = (...args: number[]) => 1; // ok, same number of required params a = (...args: string[]) => 1; // error, type mismatch ~ -!!! Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number': -!!! Types of parameters 'args' and 'args' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number': +!!! error TS2322: Types of parameters 'args' and 'args' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. a = (x?: number) => 1; // ok, same number of required params a = (x?: number, y?: number, z?: number) => 1; // ok, same number of required params a = (x: number) => 1; // ok, rest param corresponds to infinite number of params a = (x?: string) => 1; // error, incompatible type ~ -!!! Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number': -!!! Types of parameters 'x' and 'args' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number': +!!! error TS2322: Types of parameters 'x' and 'args' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var a2: (x: number, ...z: number[]) => number; @@ -34,9 +63,9 @@ a2 = (x: number, ...args: number[]) => 1; // ok, same number of required params a2 = (x: number, ...args: string[]) => 1; // should be type mismatch error ~~ -!!! Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number': -!!! Types of parameters 'args' and 'z' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number': +!!! error TS2322: Types of parameters 'args' and 'z' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. a2 = (x: number, y: number) => 1; // ok, rest param corresponds to infinite number of params a2 = (x: number, y?: number) => 1; // ok, same number of required params @@ -47,36 +76,36 @@ a3 = (x: number, y: string) => 1; // ok, all present params match a3 = (x: number, y?: number, z?: number) => 1; // error ~~ -!!! Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number': +!!! error TS2322: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. a3 = (x: number, ...z: number[]) => 1; // error ~~ -!!! Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number': -!!! Types of parameters 'z' and 'y' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number': +!!! error TS2322: Types of parameters 'z' and 'y' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. a3 = (x: string, y?: string, z?: string) => 1; // error ~~ -!!! Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var a4: (x?: number, y?: string, ...z: number[]) => number; a4 = () => 1; // ok, fewer required params a4 = (x?: number, y?: number) => 1; // error, type mismatch ~~ -!!! Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number': +!!! error TS2322: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. a4 = (x: number) => 1; // ok, all present params match a4 = (x: number, y?: number) => 1; // error, second param has type mismatch ~~ -!!! Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number': +!!! error TS2322: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. a4 = (x?: number, y?: string) => 1; // ok, same number of required params with matching types a4 = (x: number, ...args: string[]) => 1; // error, rest params have type mismatch ~~ -!!! Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number': -!!! Types of parameters 'args' and 'z' are incompatible: -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number': +!!! error TS2322: Types of parameters 'args' and 'z' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt index 46c7804b144..f37aca50710 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(28,1): error TS2323: Type 'S2' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(29,1): error TS2323: Type '(x: string) => void' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(30,1): error TS2323: Type '(x: string) => number' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(31,1): error TS2323: Type '(x: string) => string' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(32,1): error TS2323: Type 'S2' is not assignable to type 'new (x: number) => void'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(33,1): error TS2323: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(34,1): error TS2323: Type '(x: string) => number' is not assignable to type 'new (x: number) => void'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(35,1): error TS2323: Type '(x: string) => string' is not assignable to type 'new (x: number) => void'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts (8 errors) ==== // void returning call signatures can be assigned a non-void returning call signature that otherwise matches @@ -28,26 +38,26 @@ // these are errors t = s2; ~ -!!! Type 'S2' is not assignable to type 'T'. +!!! error TS2323: Type 'S2' is not assignable to type 'T'. t = a3; ~ -!!! Type '(x: string) => void' is not assignable to type 'T'. +!!! error TS2323: Type '(x: string) => void' is not assignable to type 'T'. t = (x: string) => 1; ~ -!!! Type '(x: string) => number' is not assignable to type 'T'. +!!! error TS2323: Type '(x: string) => number' is not assignable to type 'T'. t = function (x: string) { return ''; } ~ -!!! Type '(x: string) => string' is not assignable to type 'T'. +!!! error TS2323: Type '(x: string) => string' is not assignable to type 'T'. a = s2; ~ -!!! Type 'S2' is not assignable to type 'new (x: number) => void'. +!!! error TS2323: Type 'S2' is not assignable to type 'new (x: number) => void'. a = a3; ~ -!!! Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +!!! error TS2323: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. a = (x: string) => 1; ~ -!!! Type '(x: string) => number' is not assignable to type 'new (x: number) => void'. +!!! error TS2323: Type '(x: string) => number' is not assignable to type 'new (x: number) => void'. a = function (x: string) { return ''; } ~ -!!! Type '(x: string) => string' is not assignable to type 'new (x: number) => void'. +!!! error TS2323: Type '(x: string) => string' is not assignable to type 'new (x: number) => void'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt index 703bf50d294..6213a2c27ce 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt @@ -1,3 +1,33 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(23,1): error TS2322: Type '() => number' is not assignable to type 'T': + Property 'f' is missing in type '() => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(24,1): error TS2322: Type '(x: number) => string' is not assignable to type 'T': + Property 'f' is missing in type '(x: number) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(25,1): error TS2322: Type '() => number' is not assignable to type '{ f: new (x: number) => void; }': + Property 'f' is missing in type '() => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(26,1): error TS2322: Type '(x: number) => string' is not assignable to type '{ f: new (x: number) => void; }': + Property 'f' is missing in type '(x: number) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(34,1): error TS2322: Type 'S2' is not assignable to type 'T': + Types of property 'f' are incompatible: + Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(35,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T': + Types of property 'f' are incompatible: + Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(36,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T': + Property 'f' is missing in type '(x: string) => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(37,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T': + Property 'f' is missing in type '(x: string) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(38,1): error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }': + Types of property 'f' are incompatible: + Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(39,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }': + Types of property 'f' are incompatible: + Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(40,1): error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }': + Property 'f' is missing in type '(x: string) => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(41,1): error TS2322: Type '(x: string) => string' is not assignable to type '{ f: new (x: number) => void; }': + Property 'f' is missing in type '(x: string) => string'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts (12 errors) ==== // void returning call signatures can be assigned a non-void returning call signature that otherwise matches @@ -23,20 +53,20 @@ // errors t = () => 1; ~ -!!! Type '() => number' is not assignable to type 'T': -!!! Property 'f' is missing in type '() => number'. +!!! error TS2322: Type '() => number' is not assignable to type 'T': +!!! error TS2322: Property 'f' is missing in type '() => number'. t = function (x: number) { return ''; } ~ -!!! Type '(x: number) => string' is not assignable to type 'T': -!!! Property 'f' is missing in type '(x: number) => string'. +!!! error TS2322: Type '(x: number) => string' is not assignable to type 'T': +!!! error TS2322: Property 'f' is missing in type '(x: number) => string'. a = () => 1; ~ -!!! Type '() => number' is not assignable to type '{ f: new (x: number) => void; }': -!!! Property 'f' is missing in type '() => number'. +!!! error TS2322: Type '() => number' is not assignable to type '{ f: new (x: number) => void; }': +!!! error TS2322: Property 'f' is missing in type '() => number'. a = function (x: number) { return ''; } ~ -!!! Type '(x: number) => string' is not assignable to type '{ f: new (x: number) => void; }': -!!! Property 'f' is missing in type '(x: number) => string'. +!!! error TS2322: Type '(x: number) => string' is not assignable to type '{ f: new (x: number) => void; }': +!!! error TS2322: Property 'f' is missing in type '(x: number) => string'. interface S2 { f(x: string): void; @@ -46,38 +76,38 @@ // these are errors t = s2; ~ -!!! Type 'S2' is not assignable to type 'T': -!!! Types of property 'f' are incompatible: -!!! Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type 'S2' is not assignable to type 'T': +!!! error TS2322: Types of property 'f' are incompatible: +!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. t = a3; ~ -!!! Type '{ f(x: string): void; }' is not assignable to type 'T': -!!! Types of property 'f' are incompatible: -!!! Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T': +!!! error TS2322: Types of property 'f' are incompatible: +!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. t = (x: string) => 1; ~ -!!! Type '(x: string) => number' is not assignable to type 'T': -!!! Property 'f' is missing in type '(x: string) => number'. +!!! error TS2322: Type '(x: string) => number' is not assignable to type 'T': +!!! error TS2322: Property 'f' is missing in type '(x: string) => number'. t = function (x: string) { return ''; } ~ -!!! Type '(x: string) => string' is not assignable to type 'T': -!!! Property 'f' is missing in type '(x: string) => string'. +!!! error TS2322: Type '(x: string) => string' is not assignable to type 'T': +!!! error TS2322: Property 'f' is missing in type '(x: string) => string'. a = s2; ~ -!!! Type 'S2' is not assignable to type '{ f: new (x: number) => void; }': -!!! Types of property 'f' are incompatible: -!!! Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }': +!!! error TS2322: Types of property 'f' are incompatible: +!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. a = a3; ~ -!!! Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }': -!!! Types of property 'f' are incompatible: -!!! Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }': +!!! error TS2322: Types of property 'f' are incompatible: +!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. a = (x: string) => 1; ~ -!!! Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }': -!!! Property 'f' is missing in type '(x: string) => number'. +!!! error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }': +!!! error TS2322: Property 'f' is missing in type '(x: string) => number'. a = function (x: string) { return ''; } ~ -!!! Type '(x: string) => string' is not assignable to type '{ f: new (x: number) => void; }': -!!! Property 'f' is missing in type '(x: string) => string'. +!!! error TS2322: Type '(x: string) => string' is not assignable to type '{ f: new (x: number) => void; }': +!!! error TS2322: Property 'f' is missing in type '(x: string) => string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt index c5055b16e89..b88beac6099 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt @@ -1,3 +1,31 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(52,9): error TS2322: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': + Types of parameters 'y' and 'y' are incompatible: + Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': + Types of parameters 'arg2' and 'arg2' are incompatible: + Type '{ foo: number; }' is not assignable to type 'Base': + Types of property 'foo' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(53,9): error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U': + Types of parameters 'y' and 'y' are incompatible: + Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any': + Types of parameters 'arg2' and 'arg2' are incompatible: + Type 'Base' is not assignable to type '{ foo: number; }': + Types of property 'foo' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(77,9): error TS2322: Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }': + Types of parameters 'x' and 'x' are incompatible: + Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]': + Types of parameters 'x' and 'x' are incompatible: + Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(81,9): error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }': + Types of parameters 'x' and 'x' are incompatible: + Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]': + Types of parameters 'x' and 'x' are incompatible: + Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts (6 errors) ==== // checking assignment compatibility relations for function types. @@ -52,22 +80,22 @@ var b8: new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U; a8 = b8; // error, type mismatch ~~ -!!! Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': -!!! Types of parameters 'arg2' and 'arg2' are incompatible: -!!! Type '{ foo: number; }' is not assignable to type 'Base': -!!! Types of property 'foo' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': +!!! error TS2322: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2322: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': +!!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible: +!!! error TS2322: Type '{ foo: number; }' is not assignable to type 'Base': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. b8 = a8; // error ~~ -!!! Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any': -!!! Types of parameters 'arg2' and 'arg2' are incompatible: -!!! Type 'Base' is not assignable to type '{ foo: number; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U': +!!! error TS2322: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any': +!!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type '{ foo: number; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var b10: new (...x: T[]) => T; @@ -93,26 +121,26 @@ var b16: new (x: (a: T) => T) => T[]; a16 = b16; // error ~~~ -!!! Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. +!!! error TS2322: Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. b16 = a16; // error ~~~ -!!! Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. +!!! error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. var b17: new (x: (a: T) => T) => any[]; a17 = b17; // error ~~~ -!!! Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. +!!! error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. b17 = a17; // error ~~~ -!!! Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. +!!! error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. } module WithGenericSignaturesInBaseType { diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.errors.txt index 69098417e53..3a477e0c9ec 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.errors.txt @@ -1,3 +1,10 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts(16,5): error TS2323: Type 'new (x: number) => number' is not assignable to type 'new () => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts(17,5): error TS2323: Type 'new (x: number, y?: number) => number' is not assignable to type 'new () => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts(19,5): error TS2323: Type 'new (x: number, y: number) => number' is not assignable to type 'new () => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts(27,5): error TS2323: Type 'new (x: number, y: number) => number' is not assignable to type 'new (x?: number) => number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts(35,5): error TS2323: Type 'new (x: number, y: number) => number' is not assignable to type 'new (x: number) => number'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts (5 errors) ==== // call signatures in derived types must have the same or fewer optional parameters as the base type @@ -16,14 +23,14 @@ a = b.a2; // ok a = b.a3; // error ~ -!!! Type 'new (x: number) => number' is not assignable to type 'new () => number'. +!!! error TS2323: Type 'new (x: number) => number' is not assignable to type 'new () => number'. a = b.a4; // error ~ -!!! Type 'new (x: number, y?: number) => number' is not assignable to type 'new () => number'. +!!! error TS2323: Type 'new (x: number, y?: number) => number' is not assignable to type 'new () => number'. a = b.a5; // ok a = b.a6; // error ~ -!!! Type 'new (x: number, y: number) => number' is not assignable to type 'new () => number'. +!!! error TS2323: Type 'new (x: number, y: number) => number' is not assignable to type 'new () => number'. var a2: new (x?: number) => number; a2 = b.a; // ok @@ -33,7 +40,7 @@ a2 = b.a5; // ok a2 = b.a6; // error ~~ -!!! Type 'new (x: number, y: number) => number' is not assignable to type 'new (x?: number) => number'. +!!! error TS2323: Type 'new (x: number, y: number) => number' is not assignable to type 'new (x?: number) => number'. var a3: new (x: number) => number; a3 = b.a; // ok @@ -43,7 +50,7 @@ a3 = b.a5; // ok a3 = b.a6; // error ~~ -!!! Type 'new (x: number, y: number) => number' is not assignable to type 'new (x: number) => number'. +!!! error TS2323: Type 'new (x: number, y: number) => number' is not assignable to type 'new (x: number) => number'. var a4: new (x: number, y?: number) => number; a4 = b.a; // ok diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.errors.txt index d5fb8f331fb..bc82b0fa69c 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures4.ts(7,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures4.ts(8,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures4.ts (2 errors) ==== // some complex cases of assignment compat of generic signatures. @@ -7,10 +11,10 @@ var x: >(z: T) => void ~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var y: >>(z: T) => void ~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. // These both do not make sense as we would eventually be comparing I2 to I2>, and they are self referencing anyway x = y diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt index 5807bbb1663..18d853f006f 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(14,13): error TS2323: Type '(x: T) => any' is not assignable to type '() => T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(23,13): error TS2323: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(65,9): error TS2323: Type '(x: T) => T' is not assignable to type '() => T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(66,9): error TS2323: Type '(x: T, y?: T) => T' is not assignable to type '() => T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(107,13): error TS2323: Type '(x: T) => any' is not assignable to type '() => T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(116,13): error TS2323: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts (6 errors) ==== // call signatures in derived types must have the same or fewer optional parameters as the target for assignment @@ -14,7 +22,7 @@ this.a = (x?: T) => null; // ok, same T of required params this.a = (x: T) => null; // error, too many required params ~~~~~~ -!!! Type '(x: T) => any' is not assignable to type '() => T'. +!!! error TS2323: Type '(x: T) => any' is not assignable to type '() => T'. this.a2 = () => null; // ok, same T of required params this.a2 = (x?: T) => null; // ok, same T of required params @@ -25,7 +33,7 @@ this.a3 = (x: T) => null; // ok, same T of required params this.a3 = (x: T, y: T) => null; // error, too many required params ~~~~~~~ -!!! Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. +!!! error TS2323: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. this.a4 = () => null; // ok, fewer required params this.a4 = (x?: T, y?: T) => null; // ok, fewer required params @@ -69,10 +77,10 @@ b.a = t.a2; b.a = t.a3; ~~~ -!!! Type '(x: T) => T' is not assignable to type '() => T'. +!!! error TS2323: Type '(x: T) => T' is not assignable to type '() => T'. b.a = t.a4; ~~~ -!!! Type '(x: T, y?: T) => T' is not assignable to type '() => T'. +!!! error TS2323: Type '(x: T, y?: T) => T' is not assignable to type '() => T'. b.a = t.a5; b.a2 = t.a; @@ -115,7 +123,7 @@ this.a = (x?: T) => null; // ok, same T of required params this.a = (x: T) => null; // error, too many required params ~~~~~~ -!!! Type '(x: T) => any' is not assignable to type '() => T'. +!!! error TS2323: Type '(x: T) => any' is not assignable to type '() => T'. this.a2 = () => null; // ok, same T of required params this.a2 = (x?: T) => null; // ok, same T of required params @@ -126,7 +134,7 @@ this.a3 = (x: T) => null; // ok, same T of required params this.a3 = (x: T, y: T) => null; // error, too many required params ~~~~~~~ -!!! Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. +!!! error TS2323: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. this.a4 = () => null; // ok, fewer required params this.a4 = (x?: T, y?: T) => null; // ok, fewer required params diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt index 0974c579daf..c4111661b14 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt @@ -1,3 +1,27 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(14,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(18,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'Derived' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(33,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }': + Index signatures are incompatible: + Type 'T' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(36,9): error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'Derived2' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }': + Index signatures are incompatible: + Type 'T' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts (6 errors) ==== // Derived type indexer must be subtype of base type indexer @@ -14,19 +38,19 @@ a = b; b = a; // error ~ -!!! Type 'A' is not assignable to type '{ [x: number]: Derived; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. var b2: { [x: number]: Derived2; } a = b2; b2 = a; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: number]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. module Generics { class A { @@ -42,28 +66,28 @@ var b: { [x: number]: Derived; } a = b; // error ~ -!!! Type '{ [x: number]: Derived; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Derived' is not assignable to type 'T'. b = a; // error ~ -!!! Type 'A' is not assignable to type '{ [x: number]: Derived; }': -!!! Index signatures are incompatible: -!!! Type 'T' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'T' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. var b2: { [x: number]: Derived2; } a = b2; // error ~ -!!! Type '{ [x: number]: Derived2; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'Derived2' is not assignable to type 'T'. +!!! error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'T'. b2 = a; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: number]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'T' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'T' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. var b3: { [x: number]: T; } a = b3; // ok diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt index 35a0cf283a5..fcd337ee615 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt @@ -1,3 +1,27 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(14,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(18,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'Derived' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(33,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }': + Index signatures are incompatible: + Type 'T' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(36,9): error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'Derived2' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }': + Index signatures are incompatible: + Type 'T' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts (6 errors) ==== // Derived type indexer must be subtype of base type indexer @@ -14,19 +38,19 @@ a = b; b = a; // error ~ -!!! Type 'A' is not assignable to type '{ [x: number]: Derived; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. var b2: { [x: number]: Derived2; } a = b2; b2 = a; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: number]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. module Generics { interface A { @@ -42,28 +66,28 @@ var b: { [x: number]: Derived; } a = b; // error ~ -!!! Type '{ [x: number]: Derived; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Derived' is not assignable to type 'T'. b = a; // error ~ -!!! Type 'A' is not assignable to type '{ [x: number]: Derived; }': -!!! Index signatures are incompatible: -!!! Type 'T' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'T' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. var b2: { [x: number]: Derived2; } a = b2; // error ~ -!!! Type '{ [x: number]: Derived2; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'Derived2' is not assignable to type 'T'. +!!! error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'T'. b2 = a; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: number]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'T' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'T' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. var b3: { [x: number]: T; } a = b3; // ok diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt index dfc46323757..84b51350785 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt @@ -1,3 +1,16 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts(14,1): error TS2322: Type '{ [x: number]: Base; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts(23,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }': + Index signatures are incompatible: + Type 'Derived' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Derived'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts(33,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'Derived' is not assignable to type 'T'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts (3 errors) ==== // Derived type indexer must be subtype of base type indexer @@ -14,10 +27,10 @@ a = b; // error ~ -!!! Type '{ [x: number]: Base; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type '{ [x: number]: Base; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. b = a; // ok class B2 extends A { @@ -28,10 +41,10 @@ a = b2; // ok b2 = a; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: number]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'Derived' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Derived'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Derived'. module Generics { class A { @@ -43,9 +56,9 @@ var b: { [x: number]: Derived; }; a = b; // error ~ -!!! Type '{ [x: number]: Derived; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Derived' is not assignable to type 'T'. b = a; // ok var b2: { [x: number]: T; }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt index 7b0e088f851..606eef809f0 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt @@ -1,3 +1,73 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(24,5): error TS2322: Type 'T' is not assignable to type 'S': + Types of property 'foo' are incompatible: + Type 'Derived2' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Derived2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(25,5): error TS2322: Type 'S' is not assignable to type 'T': + Types of property 'foo' are incompatible: + Type 'Derived' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Derived'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(29,5): error TS2322: Type 'T2' is not assignable to type 'S2': + Types of property 'foo' are incompatible: + Type 'Derived2' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Derived2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(30,5): error TS2322: Type 'S2' is not assignable to type 'T2': + Types of property 'foo' are incompatible: + Type 'Derived' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Derived'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(31,5): error TS2322: Type 'T' is not assignable to type 'S2': + Types of property 'foo' are incompatible: + Type 'Derived2' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Derived2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(32,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type 'S2': + Types of property 'foo' are incompatible: + Type 'Derived2' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Derived2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(35,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }': + Types of property 'foo' are incompatible: + Type 'Derived2' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Derived2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(36,5): error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }': + Types of property 'foo' are incompatible: + Type 'Derived' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Derived'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(41,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }': + Types of property 'foo' are incompatible: + Type 'Derived2' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Derived2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(42,5): error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }': + Types of property 'foo' are incompatible: + Type 'Derived' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Derived'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(43,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }': + Types of property 'foo' are incompatible: + Type 'Derived2' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Derived2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(44,5): error TS2322: Type 'T2' is not assignable to type '{ foo: Derived; }': + Types of property 'foo' are incompatible: + Type 'Derived2' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Derived2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(45,5): error TS2322: Type 'T' is not assignable to type '{ foo: Derived; }': + Types of property 'foo' are incompatible: + Type 'Derived2' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Derived2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(70,5): error TS2322: Type 'S' is not assignable to type 'T': + Types of property 'foo' are incompatible: + Type 'Base' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(75,5): error TS2322: Type 'S2' is not assignable to type 'T2': + Types of property 'foo' are incompatible: + Type 'Base' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(81,5): error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }': + Types of property 'foo' are incompatible: + Type 'Base' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(87,5): error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }': + Types of property 'foo' are incompatible: + Type 'Base' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts (17 errors) ==== // members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M @@ -24,91 +94,91 @@ s = t; // error ~ -!!! Type 'T' is not assignable to type 'S': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived2' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Type 'T' is not assignable to type 'S': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Derived2'. t = s; // error ~ -!!! Type 'S' is not assignable to type 'T': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Derived'. +!!! error TS2322: Type 'S' is not assignable to type 'T': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Derived'. s = s2; // ok s = a2; // ok s2 = t2; // error ~~ -!!! Type 'T2' is not assignable to type 'S2': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived2' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Type 'T2' is not assignable to type 'S2': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Derived2'. t2 = s2; // error ~~ -!!! Type 'S2' is not assignable to type 'T2': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Derived'. +!!! error TS2322: Type 'S2' is not assignable to type 'T2': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Derived'. s2 = t; // error ~~ -!!! Type 'T' is not assignable to type 'S2': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived2' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Type 'T' is not assignable to type 'S2': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Derived2'. s2 = b; // error ~~ -!!! Type '{ foo: Derived2; }' is not assignable to type 'S2': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived2' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type 'S2': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Derived2'. s2 = a2; // ok a = b; // error ~ -!!! Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived2' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Derived2'. b = a; // error ~ -!!! Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Derived'. +!!! error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Derived'. a = s; // ok a = s2; // ok a = a2; // ok a2 = b2; // error ~~ -!!! Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived2' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Derived2'. b2 = a2; // error ~~ -!!! Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Derived'. +!!! error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Derived'. a2 = b; // error ~~ -!!! Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived2' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Derived2'. a2 = t2; // error ~~ -!!! Type 'T2' is not assignable to type '{ foo: Derived; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived2' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Type 'T2' is not assignable to type '{ foo: Derived; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Derived2'. a2 = t; // error ~~ -!!! Type 'T' is not assignable to type '{ foo: Derived; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'Derived2' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Type 'T' is not assignable to type '{ foo: Derived; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Derived2'. } module WithBase { @@ -135,20 +205,20 @@ s = t; // ok t = s; // error ~ -!!! Type 'S' is not assignable to type 'T': -!!! Types of property 'foo' are incompatible: -!!! Type 'Base' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'S' is not assignable to type 'T': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. s = s2; // ok s = a2; // ok s2 = t2; // ok t2 = s2; // error ~~ -!!! Type 'S2' is not assignable to type 'T2': -!!! Types of property 'foo' are incompatible: -!!! Type 'Base' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'S2' is not assignable to type 'T2': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. s2 = t; // ok s2 = b; // ok s2 = a2; // ok @@ -156,10 +226,10 @@ a = b; // ok b = a; // error ~ -!!! Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'Base' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. a = s; // ok a = s2; // ok a = a2; // ok @@ -167,10 +237,10 @@ a2 = b2; // ok b2 = a2; // error ~~ -!!! Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }': -!!! Types of property 'foo' are incompatible: -!!! Type 'Base' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. a2 = b; // ok a2 = t2; // ok a2 = t; // ok diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers5.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembers5.errors.txt index d3e92899a84..c63813d343d 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers5.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers5.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers5.ts(13,1): error TS2322: Type 'I' is not assignable to type 'C': + Property 'foo' is missing in type 'I'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers5.ts(14,1): error TS2322: Type 'C' is not assignable to type 'I': + Property 'fooo' is missing in type 'C'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers5.ts (2 errors) ==== class C { foo: string; @@ -13,9 +19,9 @@ c = i; // error ~ -!!! Type 'I' is not assignable to type 'C': -!!! Property 'foo' is missing in type 'I'. +!!! error TS2322: Type 'I' is not assignable to type 'C': +!!! error TS2322: Property 'foo' is missing in type 'I'. i = c; // error ~ -!!! Type 'C' is not assignable to type 'I': -!!! Property 'fooo' is missing in type 'C'. \ No newline at end of file +!!! error TS2322: Type 'C' is not assignable to type 'I': +!!! error TS2322: Property 'fooo' is missing in type 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt index 75ba383671c..ab9ddb553d3 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt @@ -1,3 +1,53 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(31,5): error TS2322: Type 'E' is not assignable to type '{ foo: string; }': + Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(36,5): error TS2322: Type 'E' is not assignable to type 'Base': + Property 'foo' is private in type 'E' but not in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(41,5): error TS2322: Type 'E' is not assignable to type 'I': + Property 'foo' is private in type 'E' but not in type 'I'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(46,5): error TS2322: Type 'E' is not assignable to type 'D': + Property 'foo' is private in type 'E' but not in type 'D'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(48,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'E': + Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(49,5): error TS2322: Type 'Base' is not assignable to type 'E': + Property 'foo' is private in type 'E' but not in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(50,5): error TS2322: Type 'I' is not assignable to type 'E': + Property 'foo' is private in type 'E' but not in type 'I'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(51,5): error TS2322: Type 'D' is not assignable to type 'E': + Property 'foo' is private in type 'E' but not in type 'D'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(81,5): error TS2322: Type 'Base' is not assignable to type '{ foo: string; }': + Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(82,5): error TS2322: Type 'I' is not assignable to type '{ foo: string; }': + Property 'foo' is private in type 'I' but not in type '{ foo: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(84,5): error TS2322: Type 'E' is not assignable to type '{ foo: string; }': + Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(86,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'Base': + Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(88,5): error TS2322: Type 'D' is not assignable to type 'Base': + Property 'foo' is private in type 'Base' but not in type 'D'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(89,5): error TS2322: Type 'E' is not assignable to type 'Base': + Types have separate declarations of a private property 'foo'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(92,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'I': + Property 'foo' is private in type 'I' but not in type '{ foo: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(94,5): error TS2322: Type 'D' is not assignable to type 'I': + Property 'foo' is private in type 'I' but not in type 'D'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(95,5): error TS2322: Type 'E' is not assignable to type 'I': + Types have separate declarations of a private property 'foo'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(99,5): error TS2322: Type 'Base' is not assignable to type 'D': + Property 'foo' is private in type 'Base' but not in type 'D'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(100,5): error TS2322: Type 'I' is not assignable to type 'D': + Property 'foo' is private in type 'I' but not in type 'D'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(101,5): error TS2322: Type 'E' is not assignable to type 'D': + Property 'foo' is private in type 'E' but not in type 'D'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(103,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'E': + Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(104,5): error TS2322: Type 'Base' is not assignable to type 'E': + Types have separate declarations of a private property 'foo'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(105,5): error TS2322: Type 'I' is not assignable to type 'E': + Types have separate declarations of a private property 'foo'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(106,5): error TS2322: Type 'D' is not assignable to type 'E': + Property 'foo' is private in type 'E' but not in type 'D'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts (24 errors) ==== // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M @@ -31,49 +81,49 @@ a = d; a = e; // error ~ -!!! Type 'E' is not assignable to type '{ foo: string; }': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'E' is not assignable to type '{ foo: string; }': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. b = a; b = i; b = d; b = e; // error ~ -!!! Type 'E' is not assignable to type 'Base': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'E' is not assignable to type 'Base': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'Base'. i = a; i = b; i = d; i = e; // error ~ -!!! Type 'E' is not assignable to type 'I': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'E' is not assignable to type 'I': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'I'. d = a; d = b; d = i; d = e; // error ~ -!!! Type 'E' is not assignable to type 'D': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'E' is not assignable to type 'D': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'D'. e = a; // errror ~ -!!! Type '{ foo: string; }' is not assignable to type 'E': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type '{ foo: string; }' is not assignable to type 'E': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. e = b; // errror ~ -!!! Type 'Base' is not assignable to type 'E': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'Base' is not assignable to type 'E': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'Base'. e = i; // errror ~ -!!! Type 'I' is not assignable to type 'E': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'I' is not assignable to type 'E': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'I'. e = d; // errror ~ -!!! Type 'D' is not assignable to type 'E': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'D' is not assignable to type 'E': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'D'. e = e; } @@ -105,78 +155,78 @@ a = b; // error ~ -!!! Type 'Base' is not assignable to type '{ foo: string; }': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'Base' is not assignable to type '{ foo: string; }': +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. a = i; // error ~ -!!! Type 'I' is not assignable to type '{ foo: string; }': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'I' is not assignable to type '{ foo: string; }': +!!! error TS2322: Property 'foo' is private in type 'I' but not in type '{ foo: string; }'. a = d; a = e; // error ~ -!!! Type 'E' is not assignable to type '{ foo: string; }': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'E' is not assignable to type '{ foo: string; }': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. b = a; // error ~ -!!! Type '{ foo: string; }' is not assignable to type 'Base': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type '{ foo: string; }' is not assignable to type 'Base': +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. b = i; b = d; // error ~ -!!! Type 'D' is not assignable to type 'Base': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'D' is not assignable to type 'Base': +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type 'D'. b = e; // error ~ -!!! Type 'E' is not assignable to type 'Base': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'E' is not assignable to type 'Base': +!!! error TS2322: Types have separate declarations of a private property 'foo'. b = b; i = a; // error ~ -!!! Type '{ foo: string; }' is not assignable to type 'I': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type '{ foo: string; }' is not assignable to type 'I': +!!! error TS2322: Property 'foo' is private in type 'I' but not in type '{ foo: string; }'. i = b; i = d; // error ~ -!!! Type 'D' is not assignable to type 'I': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'D' is not assignable to type 'I': +!!! error TS2322: Property 'foo' is private in type 'I' but not in type 'D'. i = e; // error ~ -!!! Type 'E' is not assignable to type 'I': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'E' is not assignable to type 'I': +!!! error TS2322: Types have separate declarations of a private property 'foo'. i = i; d = a; d = b; // error ~ -!!! Type 'Base' is not assignable to type 'D': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'Base' is not assignable to type 'D': +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type 'D'. d = i; // error ~ -!!! Type 'I' is not assignable to type 'D': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'I' is not assignable to type 'D': +!!! error TS2322: Property 'foo' is private in type 'I' but not in type 'D'. d = e; // error ~ -!!! Type 'E' is not assignable to type 'D': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'E' is not assignable to type 'D': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'D'. e = a; // errror ~ -!!! Type '{ foo: string; }' is not assignable to type 'E': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type '{ foo: string; }' is not assignable to type 'E': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. e = b; // errror ~ -!!! Type 'Base' is not assignable to type 'E': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'Base' is not assignable to type 'E': +!!! error TS2322: Types have separate declarations of a private property 'foo'. e = i; // errror ~ -!!! Type 'I' is not assignable to type 'E': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'I' is not assignable to type 'E': +!!! error TS2322: Types have separate declarations of a private property 'foo'. e = d; // errror ~ -!!! Type 'D' is not assignable to type 'E': -!!! Private property 'foo' cannot be reimplemented. +!!! error TS2322: Type 'D' is not assignable to type 'E': +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'D'. e = e; } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt index 1e2b287f942..44577bf1c8d 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt @@ -1,3 +1,17 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(73,5): error TS2322: Type 'D' is not assignable to type 'C': + Property 'opt' is optional in type 'D' but required in type 'C'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(74,5): error TS2322: Type 'E' is not assignable to type 'C': + Property 'opt' is optional in type 'E' but required in type 'C'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(78,5): error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': + Property 'opt' is optional in type 'D' but required in type '{ opt: Base; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(79,5): error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': + Property 'opt' is optional in type 'E' but required in type '{ opt: Base; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(83,5): error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': + Property 'opt' is optional in type 'D' but required in type '{ opt: Base; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(84,5): error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': + Property 'opt' is optional in type 'E' but required in type '{ opt: Base; }'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts (6 errors) ==== // Derived member is not optional but base member is, should be ok @@ -73,34 +87,34 @@ c = d; // error ~ -!!! Type 'D' is not assignable to type 'C': -!!! Required property 'opt' cannot be reimplemented with optional property in 'D'. +!!! error TS2322: Type 'D' is not assignable to type 'C': +!!! error TS2322: Property 'opt' is optional in type 'D' but required in type 'C'. c = e; // error ~ -!!! Type 'E' is not assignable to type 'C': -!!! Required property 'opt' cannot be reimplemented with optional property in 'E'. +!!! error TS2322: Type 'E' is not assignable to type 'C': +!!! error TS2322: Property 'opt' is optional in type 'E' but required in type 'C'. c = f; // ok c = a; // ok a = d; // error ~ -!!! Type 'D' is not assignable to type '{ opt: Base; }': -!!! Required property 'opt' cannot be reimplemented with optional property in 'D'. +!!! error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': +!!! error TS2322: Property 'opt' is optional in type 'D' but required in type '{ opt: Base; }'. a = e; // error ~ -!!! Type 'E' is not assignable to type '{ opt: Base; }': -!!! Required property 'opt' cannot be reimplemented with optional property in 'E'. +!!! error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': +!!! error TS2322: Property 'opt' is optional in type 'E' but required in type '{ opt: Base; }'. a = f; // ok a = c; // ok b = d; // error ~ -!!! Type 'D' is not assignable to type '{ opt: Base; }': -!!! Required property 'opt' cannot be reimplemented with optional property in 'D'. +!!! error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': +!!! error TS2322: Property 'opt' is optional in type 'D' but required in type '{ opt: Base; }'. b = e; // error ~ -!!! Type 'E' is not assignable to type '{ opt: Base; }': -!!! Required property 'opt' cannot be reimplemented with optional property in 'E'. +!!! error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': +!!! error TS2322: Property 'opt' is optional in type 'E' but required in type '{ opt: Base; }'. b = f; // ok b = a; // ok b = c; // ok diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt index 4d4344a8af2..e1bf35ef2c2 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt @@ -1,3 +1,23 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(74,5): error TS2322: Type 'D' is not assignable to type 'C': + Property 'opt' is missing in type 'D'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(75,5): error TS2322: Type 'E' is not assignable to type 'C': + Property 'opt' is missing in type 'E'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(76,5): error TS2322: Type 'F' is not assignable to type 'C': + Property 'opt' is missing in type 'F'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(79,5): error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': + Property 'opt' is missing in type 'D'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(80,5): error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': + Property 'opt' is missing in type 'E'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(81,5): error TS2322: Type 'F' is not assignable to type '{ opt: Base; }': + Property 'opt' is missing in type 'F'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(84,5): error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': + Property 'opt' is missing in type 'D'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(85,5): error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': + Property 'opt' is missing in type 'E'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(86,5): error TS2322: Type 'F' is not assignable to type '{ opt: Base; }': + Property 'opt' is missing in type 'F'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts (9 errors) ==== // M is optional and S contains no property with the same name as M // N is optional and T contains no property with the same name as N @@ -74,44 +94,44 @@ c = d; // error ~ -!!! Type 'D' is not assignable to type 'C': -!!! Property 'opt' is missing in type 'D'. +!!! error TS2322: Type 'D' is not assignable to type 'C': +!!! error TS2322: Property 'opt' is missing in type 'D'. c = e; // error ~ -!!! Type 'E' is not assignable to type 'C': -!!! Property 'opt' is missing in type 'E'. +!!! error TS2322: Type 'E' is not assignable to type 'C': +!!! error TS2322: Property 'opt' is missing in type 'E'. c = f; // error ~ -!!! Type 'F' is not assignable to type 'C': -!!! Property 'opt' is missing in type 'F'. +!!! error TS2322: Type 'F' is not assignable to type 'C': +!!! error TS2322: Property 'opt' is missing in type 'F'. c = a; // ok a = d; // error ~ -!!! Type 'D' is not assignable to type '{ opt: Base; }': -!!! Property 'opt' is missing in type 'D'. +!!! error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': +!!! error TS2322: Property 'opt' is missing in type 'D'. a = e; // error ~ -!!! Type 'E' is not assignable to type '{ opt: Base; }': -!!! Property 'opt' is missing in type 'E'. +!!! error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': +!!! error TS2322: Property 'opt' is missing in type 'E'. a = f; // error ~ -!!! Type 'F' is not assignable to type '{ opt: Base; }': -!!! Property 'opt' is missing in type 'F'. +!!! error TS2322: Type 'F' is not assignable to type '{ opt: Base; }': +!!! error TS2322: Property 'opt' is missing in type 'F'. a = c; // ok b = d; // error ~ -!!! Type 'D' is not assignable to type '{ opt: Base; }': -!!! Property 'opt' is missing in type 'D'. +!!! error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': +!!! error TS2322: Property 'opt' is missing in type 'D'. b = e; // error ~ -!!! Type 'E' is not assignable to type '{ opt: Base; }': -!!! Property 'opt' is missing in type 'E'. +!!! error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': +!!! error TS2322: Property 'opt' is missing in type 'E'. b = f; // error ~ -!!! Type 'F' is not assignable to type '{ opt: Base; }': -!!! Property 'opt' is missing in type 'F'. +!!! error TS2322: Type 'F' is not assignable to type '{ opt: Base; }': +!!! error TS2322: Property 'opt' is missing in type 'F'. b = a; // ok b = c; // ok } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt index 954fbfe88e4..370355a7373 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt @@ -1,3 +1,63 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(21,5): error TS2322: Type 'T' is not assignable to type 'S': + Property ''1'' is missing in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(22,5): error TS2322: Type 'S' is not assignable to type 'T': + Property ''1.'' is missing in type 'S'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(24,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S': + Property ''1'' is missing in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(26,5): error TS2322: Type 'T2' is not assignable to type 'S2': + Property ''1'' is missing in type 'T2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(27,5): error TS2322: Type 'S2' is not assignable to type 'T2': + Property ''1.0'' is missing in type 'S2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(28,5): error TS2322: Type 'T' is not assignable to type 'S2': + Property ''1'' is missing in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(29,5): error TS2322: Type '{ '1.0': string; baz?: string; }' is not assignable to type 'S2': + Property ''1'' is missing in type '{ '1.0': string; baz?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(30,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S2': + Property ''1'' is missing in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(32,5): error TS2322: Type '{ '1.0': string; baz?: string; }' is not assignable to type '{ '1.': string; bar?: string; }': + Property ''1.'' is missing in type '{ '1.0': string; baz?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(33,5): error TS2322: Type '{ '1.': string; bar?: string; }' is not assignable to type '{ '1.0': string; baz?: string; }': + Property ''1.0'' is missing in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(34,5): error TS2322: Type 'S' is not assignable to type '{ '1.': string; bar?: string; }': + Property ''1.'' is missing in type 'S'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(35,5): error TS2322: Type 'S2' is not assignable to type '{ '1.': string; bar?: string; }': + Property ''1.'' is missing in type 'S2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(36,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1.': string; bar?: string; }': + Property ''1.'' is missing in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(38,5): error TS2322: Type '{ '1': string; }' is not assignable to type '{ '1.0': string; }': + Property ''1.0'' is missing in type '{ '1': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(39,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1': string; }': + Property ''1'' is missing in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(42,5): error TS2322: Type 'T' is not assignable to type '{ '1.0': string; }': + Property ''1.0'' is missing in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(65,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S': + Property ''1'' is missing in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(71,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S2': + Property ''1'' is missing in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(73,5): error TS2322: Type '{ 1.0: string; baz?: string; }' is not assignable to type '{ '1.': string; bar?: string; }': + Property ''1.'' is missing in type '{ 1.0: string; baz?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(74,5): error TS2322: Type '{ '1.': string; bar?: string; }' is not assignable to type '{ 1.0: string; baz?: string; }': + Property '1.0' is missing in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(75,5): error TS2322: Type 'S' is not assignable to type '{ '1.': string; bar?: string; }': + Property ''1.'' is missing in type 'S'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(76,5): error TS2322: Type 'S2' is not assignable to type '{ '1.': string; bar?: string; }': + Property ''1.'' is missing in type 'S2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(77,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1.': string; bar?: string; }': + Property ''1.'' is missing in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(78,5): error TS2322: Type '{ 1.: string; }' is not assignable to type '{ '1.': string; bar?: string; }': + Property ''1.'' is missing in type '{ 1.: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(80,5): error TS2322: Type '{ 1.: string; }' is not assignable to type '{ '1.0': string; }': + Property ''1.0'' is missing in type '{ 1.: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(81,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ 1.: string; }': + Property '1.' is missing in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(82,5): error TS2322: Type '{ 1.0: string; baz?: string; }' is not assignable to type '{ '1.0': string; }': + Property ''1.0'' is missing in type '{ 1.0: string; baz?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(83,5): error TS2322: Type 'T2' is not assignable to type '{ '1.0': string; }': + Property ''1.0'' is missing in type 'T2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(84,5): error TS2322: Type 'T' is not assignable to type '{ '1.0': string; }': + Property ''1.0'' is missing in type 'T'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts (29 errors) ==== // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // string named numeric properties work correctly, errors below unless otherwise noted @@ -21,74 +81,74 @@ s = t; ~ -!!! Type 'T' is not assignable to type 'S': -!!! Property ''1'' is missing in type 'T'. +!!! error TS2322: Type 'T' is not assignable to type 'S': +!!! error TS2322: Property ''1'' is missing in type 'T'. t = s; ~ -!!! Type 'S' is not assignable to type 'T': -!!! Property ''1.'' is missing in type 'S'. +!!! error TS2322: Type 'S' is not assignable to type 'T': +!!! error TS2322: Property ''1.'' is missing in type 'S'. s = s2; // ok s = a2; ~ -!!! Type '{ '1.0': string; }' is not assignable to type 'S': -!!! Property ''1'' is missing in type '{ '1.0': string; }'. +!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S': +!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; }'. s2 = t2; ~~ -!!! Type 'T2' is not assignable to type 'S2': -!!! Property ''1'' is missing in type 'T2'. +!!! error TS2322: Type 'T2' is not assignable to type 'S2': +!!! error TS2322: Property ''1'' is missing in type 'T2'. t2 = s2; ~~ -!!! Type 'S2' is not assignable to type 'T2': -!!! Property ''1.0'' is missing in type 'S2'. +!!! error TS2322: Type 'S2' is not assignable to type 'T2': +!!! error TS2322: Property ''1.0'' is missing in type 'S2'. s2 = t; ~~ -!!! Type 'T' is not assignable to type 'S2': -!!! Property ''1'' is missing in type 'T'. +!!! error TS2322: Type 'T' is not assignable to type 'S2': +!!! error TS2322: Property ''1'' is missing in type 'T'. s2 = b; ~~ -!!! Type '{ '1.0': string; baz?: string; }' is not assignable to type 'S2': -!!! Property ''1'' is missing in type '{ '1.0': string; baz?: string; }'. +!!! error TS2322: Type '{ '1.0': string; baz?: string; }' is not assignable to type 'S2': +!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; baz?: string; }'. s2 = a2; ~~ -!!! Type '{ '1.0': string; }' is not assignable to type 'S2': -!!! Property ''1'' is missing in type '{ '1.0': string; }'. +!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S2': +!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; }'. a = b; ~ -!!! Type '{ '1.0': string; baz?: string; }' is not assignable to type '{ '1.': string; bar?: string; }': -!!! Property ''1.'' is missing in type '{ '1.0': string; baz?: string; }'. +!!! error TS2322: Type '{ '1.0': string; baz?: string; }' is not assignable to type '{ '1.': string; bar?: string; }': +!!! error TS2322: Property ''1.'' is missing in type '{ '1.0': string; baz?: string; }'. b = a; ~ -!!! Type '{ '1.': string; bar?: string; }' is not assignable to type '{ '1.0': string; baz?: string; }': -!!! Property ''1.0'' is missing in type '{ '1.': string; bar?: string; }'. +!!! error TS2322: Type '{ '1.': string; bar?: string; }' is not assignable to type '{ '1.0': string; baz?: string; }': +!!! error TS2322: Property ''1.0'' is missing in type '{ '1.': string; bar?: string; }'. a = s; ~ -!!! Type 'S' is not assignable to type '{ '1.': string; bar?: string; }': -!!! Property ''1.'' is missing in type 'S'. +!!! error TS2322: Type 'S' is not assignable to type '{ '1.': string; bar?: string; }': +!!! error TS2322: Property ''1.'' is missing in type 'S'. a = s2; ~ -!!! Type 'S2' is not assignable to type '{ '1.': string; bar?: string; }': -!!! Property ''1.'' is missing in type 'S2'. +!!! error TS2322: Type 'S2' is not assignable to type '{ '1.': string; bar?: string; }': +!!! error TS2322: Property ''1.'' is missing in type 'S2'. a = a2; ~ -!!! Type '{ '1.0': string; }' is not assignable to type '{ '1.': string; bar?: string; }': -!!! Property ''1.'' is missing in type '{ '1.0': string; }'. +!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1.': string; bar?: string; }': +!!! error TS2322: Property ''1.'' is missing in type '{ '1.0': string; }'. a2 = b2; ~~ -!!! Type '{ '1': string; }' is not assignable to type '{ '1.0': string; }': -!!! Property ''1.0'' is missing in type '{ '1': string; }'. +!!! error TS2322: Type '{ '1': string; }' is not assignable to type '{ '1.0': string; }': +!!! error TS2322: Property ''1.0'' is missing in type '{ '1': string; }'. b2 = a2; ~~ -!!! Type '{ '1.0': string; }' is not assignable to type '{ '1': string; }': -!!! Property ''1'' is missing in type '{ '1.0': string; }'. +!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1': string; }': +!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; }'. a2 = b; // ok a2 = t2; // ok a2 = t; ~~ -!!! Type 'T' is not assignable to type '{ '1.0': string; }': -!!! Property ''1.0'' is missing in type 'T'. +!!! error TS2322: Type 'T' is not assignable to type '{ '1.0': string; }': +!!! error TS2322: Property ''1.0'' is missing in type 'T'. } module NumbersAndStrings { @@ -113,8 +173,8 @@ s = s2; // ok s = a2; // error ~ -!!! Type '{ '1.0': string; }' is not assignable to type 'S': -!!! Property ''1'' is missing in type '{ '1.0': string; }'. +!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S': +!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; }'. s2 = t2; // ok t2 = s2; // ok @@ -122,52 +182,52 @@ s2 = b; // ok s2 = a2; // error ~~ -!!! Type '{ '1.0': string; }' is not assignable to type 'S2': -!!! Property ''1'' is missing in type '{ '1.0': string; }'. +!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S2': +!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; }'. a = b; // error ~ -!!! Type '{ 1.0: string; baz?: string; }' is not assignable to type '{ '1.': string; bar?: string; }': -!!! Property ''1.'' is missing in type '{ 1.0: string; baz?: string; }'. +!!! error TS2322: Type '{ 1.0: string; baz?: string; }' is not assignable to type '{ '1.': string; bar?: string; }': +!!! error TS2322: Property ''1.'' is missing in type '{ 1.0: string; baz?: string; }'. b = a; // error ~ -!!! Type '{ '1.': string; bar?: string; }' is not assignable to type '{ 1.0: string; baz?: string; }': -!!! Property '1.0' is missing in type '{ '1.': string; bar?: string; }'. +!!! error TS2322: Type '{ '1.': string; bar?: string; }' is not assignable to type '{ 1.0: string; baz?: string; }': +!!! error TS2322: Property '1.0' is missing in type '{ '1.': string; bar?: string; }'. a = s; // error ~ -!!! Type 'S' is not assignable to type '{ '1.': string; bar?: string; }': -!!! Property ''1.'' is missing in type 'S'. +!!! error TS2322: Type 'S' is not assignable to type '{ '1.': string; bar?: string; }': +!!! error TS2322: Property ''1.'' is missing in type 'S'. a = s2; // error ~ -!!! Type 'S2' is not assignable to type '{ '1.': string; bar?: string; }': -!!! Property ''1.'' is missing in type 'S2'. +!!! error TS2322: Type 'S2' is not assignable to type '{ '1.': string; bar?: string; }': +!!! error TS2322: Property ''1.'' is missing in type 'S2'. a = a2; // error ~ -!!! Type '{ '1.0': string; }' is not assignable to type '{ '1.': string; bar?: string; }': -!!! Property ''1.'' is missing in type '{ '1.0': string; }'. +!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1.': string; bar?: string; }': +!!! error TS2322: Property ''1.'' is missing in type '{ '1.0': string; }'. a = b2; // error ~ -!!! Type '{ 1.: string; }' is not assignable to type '{ '1.': string; bar?: string; }': -!!! Property ''1.'' is missing in type '{ 1.: string; }'. +!!! error TS2322: Type '{ 1.: string; }' is not assignable to type '{ '1.': string; bar?: string; }': +!!! error TS2322: Property ''1.'' is missing in type '{ 1.: string; }'. a2 = b2; // error ~~ -!!! Type '{ 1.: string; }' is not assignable to type '{ '1.0': string; }': -!!! Property ''1.0'' is missing in type '{ 1.: string; }'. +!!! error TS2322: Type '{ 1.: string; }' is not assignable to type '{ '1.0': string; }': +!!! error TS2322: Property ''1.0'' is missing in type '{ 1.: string; }'. b2 = a2; // error ~~ -!!! Type '{ '1.0': string; }' is not assignable to type '{ 1.: string; }': -!!! Property '1.' is missing in type '{ '1.0': string; }'. +!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ 1.: string; }': +!!! error TS2322: Property '1.' is missing in type '{ '1.0': string; }'. a2 = b; // error ~~ -!!! Type '{ 1.0: string; baz?: string; }' is not assignable to type '{ '1.0': string; }': -!!! Property ''1.0'' is missing in type '{ 1.0: string; baz?: string; }'. +!!! error TS2322: Type '{ 1.0: string; baz?: string; }' is not assignable to type '{ '1.0': string; }': +!!! error TS2322: Property ''1.0'' is missing in type '{ 1.0: string; baz?: string; }'. a2 = t2; // error ~~ -!!! Type 'T2' is not assignable to type '{ '1.0': string; }': -!!! Property ''1.0'' is missing in type 'T2'. +!!! error TS2322: Type 'T2' is not assignable to type '{ '1.0': string; }': +!!! error TS2322: Property ''1.0'' is missing in type 'T2'. a2 = t; // error ~~ -!!! Type 'T' is not assignable to type '{ '1.0': string; }': -!!! Property ''1.0'' is missing in type 'T'. +!!! error TS2322: Type 'T' is not assignable to type '{ '1.0': string; }': +!!! error TS2322: Property ''1.0'' is missing in type 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt b/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt index 350ff22c18d..55e62ae2266 100644 --- a/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt @@ -1,3 +1,15 @@ +tests/cases/compiler/assignmentCompatWithOverloads.ts(17,1): error TS2322: Type '(x: string) => string' is not assignable to type '(s1: string) => number': + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/assignmentCompatWithOverloads.ts(19,1): error TS2322: Type '(x: number) => number' is not assignable to type '(s1: string) => number': + Types of parameters 'x' and 's1' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/assignmentCompatWithOverloads.ts(21,1): error TS2322: Type '{ (x: string): string; (x: number): number; }' is not assignable to type '(s1: string) => number': + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/assignmentCompatWithOverloads.ts(30,1): error TS2322: Type 'typeof C' is not assignable to type 'new (x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/assignmentCompatWithOverloads.ts (4 errors) ==== function f1(x: string): number { return null; } @@ -17,19 +29,19 @@ g = f2; // Error ~ -!!! Type '(x: string) => string' is not assignable to type '(s1: string) => number': -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: string) => string' is not assignable to type '(s1: string) => number': +!!! error TS2322: Type 'string' is not assignable to type 'number'. g = f3; // Error ~ -!!! Type '(x: number) => number' is not assignable to type '(s1: string) => number': -!!! Types of parameters 'x' and 's1' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '(x: number) => number' is not assignable to type '(s1: string) => number': +!!! error TS2322: Types of parameters 'x' and 's1' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. g = f4; // Error ~ -!!! Type '{ (x: string): string; (x: number): number; }' is not assignable to type '(s1: string) => number': -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '{ (x: string): string; (x: number): number; }' is not assignable to type '(s1: string) => number': +!!! error TS2322: Type 'string' is not assignable to type 'number'. class C { constructor(x: string); @@ -40,6 +52,6 @@ d = C; // Error ~ -!!! Type 'typeof C' is not assignable to type 'new (x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'typeof C' is not assignable to type 'new (x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt index b9e63626e11..630c508fc75 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt @@ -1,3 +1,35 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(15,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(19,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(33,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(41,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'Derived' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(47,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': + Index signatures are incompatible: + Type 'T' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(50,9): error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'Derived2' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': + Index signatures are incompatible: + Type 'T' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts (8 errors) ==== // index signatures must be compatible in assignments @@ -15,19 +47,19 @@ a = b; // ok b = a; // error ~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. var b2: { [x: string]: Derived2; } a = b2; // ok b2 = a; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. module Generics { class A { @@ -43,10 +75,10 @@ a1 = b1; // ok b1 = a1; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. class B2 extends A { [x: string]: Derived2; // ok @@ -56,37 +88,37 @@ a1 = b2; // ok b2 = a1; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. function foo() { var b3: { [x: string]: Derived; }; var a3: A; a3 = b3; // error ~~ -!!! Type '{ [x: string]: Derived; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Derived' is not assignable to type 'T'. b3 = a3; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived; }': -!!! Index signatures are incompatible: -!!! Type 'T' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'T' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. var b4: { [x: string]: Derived2; }; a3 = b4; // error ~~ -!!! Type '{ [x: string]: Derived2; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'Derived2' is not assignable to type 'T'. +!!! error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'T'. b4 = a3; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'T' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'T' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt index e2ab94c037e..de88bc13bad 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt @@ -1,3 +1,35 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(15,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(19,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(33,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(41,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': + Index signatures are incompatible: + Type 'Base' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'Derived' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(47,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': + Index signatures are incompatible: + Type 'T' is not assignable to type 'Derived': + Property 'bar' is missing in type 'Base'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(50,9): error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'Derived2' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': + Index signatures are incompatible: + Type 'T' is not assignable to type 'Derived2': + Property 'baz' is missing in type 'Base'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts (8 errors) ==== // index signatures must be compatible in assignments @@ -15,19 +47,19 @@ a = b; // ok b = a; // error ~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. var b2: { [x: string]: Derived2; } a = b2; // ok b2 = a; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. module Generics { interface A { @@ -43,10 +75,10 @@ a1 = b1; // ok b1 = a1; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. interface B2 extends A { [x: string]: Derived2; // ok @@ -56,37 +88,37 @@ a1 = b2; // ok b2 = a1; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'Base' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Base' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. function foo() { var b3: { [x: string]: Derived; }; var a3: A; a3 = b3; // error ~~ -!!! Type '{ [x: string]: Derived; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Derived' is not assignable to type 'T'. b3 = a3; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived; }': -!!! Index signatures are incompatible: -!!! Type 'T' is not assignable to type 'Derived': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'T' is not assignable to type 'Derived': +!!! error TS2322: Property 'bar' is missing in type 'Base'. var b4: { [x: string]: Derived2; }; a3 = b4; // error ~~ -!!! Type '{ [x: string]: Derived2; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'Derived2' is not assignable to type 'T'. +!!! error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'Derived2' is not assignable to type 'T'. b4 = a3; // error ~~ -!!! Type 'A' is not assignable to type '{ [x: string]: Derived2; }': -!!! Index signatures are incompatible: -!!! Type 'T' is not assignable to type 'Derived2': -!!! Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'T' is not assignable to type 'Derived2': +!!! error TS2322: Property 'baz' is missing in type 'Base'. } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer3.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer3.errors.txt index f4f6dd269f8..86913461d44 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer3.errors.txt @@ -1,3 +1,12 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer3.ts(7,8): error TS2304: Cannot find name 'A'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer3.ts(20,9): error TS2322: Type '{ [x: string]: string; }' is not assignable to type 'A': + Index signatures are incompatible: + Type 'string' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer3.ts(21,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: string; }': + Index signatures are incompatible: + Type 'T' is not assignable to type 'string'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer3.ts (3 errors) ==== // Derived type indexer must be subtype of base type indexer @@ -7,7 +16,7 @@ var a: A; ~ -!!! Cannot find name 'A'. +!!! error TS2304: Cannot find name 'A'. var b1: { [x: string]: string; } a = b1; // error b1 = a; // error @@ -22,13 +31,13 @@ var b: { [x: string]: string; } a = b; // error ~ -!!! Type '{ [x: string]: string; }' is not assignable to type 'A': -!!! Index signatures are incompatible: -!!! Type 'string' is not assignable to type 'T'. +!!! error TS2322: Type '{ [x: string]: string; }' is not assignable to type 'A': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'T'. b = a; // error ~ -!!! Type 'A' is not assignable to type '{ [x: string]: string; }': -!!! Index signatures are incompatible: -!!! Type 'T' is not assignable to type 'string'. +!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: string; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'T' is not assignable to type 'string'. } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability10.errors.txt b/tests/baselines/reference/assignmentCompatability10.errors.txt index 25f76e83c07..f1fe353c906 100644 --- a/tests/baselines/reference/assignmentCompatability10.errors.txt +++ b/tests/baselines/reference/assignmentCompatability10.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/assignmentCompatability10.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPublicAndOptional': + Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'classWithPublicAndOptional'. + + ==== tests/cases/compiler/assignmentCompatability10.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,5 +13,5 @@ } __test2__.__val__x4 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPublicAndOptional': -!!! Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPublicAndOptional': +!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'classWithPublicAndOptional'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability11.errors.txt b/tests/baselines/reference/assignmentCompatability11.errors.txt index d56d0c3adce..1485c3abdba 100644 --- a/tests/baselines/reference/assignmentCompatability11.errors.txt +++ b/tests/baselines/reference/assignmentCompatability11.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/assignmentCompatability11.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number; }': + Types of property 'two' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/assignmentCompatability11.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,6 +14,6 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number; }': -!!! Types of property 'two' are incompatible: -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number; }': +!!! error TS2322: Types of property 'two' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability12.errors.txt b/tests/baselines/reference/assignmentCompatability12.errors.txt index af8b57365b4..4a0f9cc8f65 100644 --- a/tests/baselines/reference/assignmentCompatability12.errors.txt +++ b/tests/baselines/reference/assignmentCompatability12.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/assignmentCompatability12.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/assignmentCompatability12.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,6 +14,6 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability13.errors.txt b/tests/baselines/reference/assignmentCompatability13.errors.txt index 5cdfab0b13c..909193c6202 100644 --- a/tests/baselines/reference/assignmentCompatability13.errors.txt +++ b/tests/baselines/reference/assignmentCompatability13.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/assignmentCompatability13.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }': + Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type '{ two: string; }'. + + ==== tests/cases/compiler/assignmentCompatability13.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,5 +13,5 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }': -!!! Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }': +!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type '{ two: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability14.errors.txt b/tests/baselines/reference/assignmentCompatability14.errors.txt index 96b23b20dd5..897f73b8710 100644 --- a/tests/baselines/reference/assignmentCompatability14.errors.txt +++ b/tests/baselines/reference/assignmentCompatability14.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/assignmentCompatability14.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'boolean'. + + ==== tests/cases/compiler/assignmentCompatability14.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,6 +14,6 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'boolean'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability15.errors.txt b/tests/baselines/reference/assignmentCompatability15.errors.txt index 962b87624ba..f92f3a7ffd7 100644 --- a/tests/baselines/reference/assignmentCompatability15.errors.txt +++ b/tests/baselines/reference/assignmentCompatability15.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/assignmentCompatability15.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: boolean; }': + Types of property 'two' are incompatible: + Type 'string' is not assignable to type 'boolean'. + + ==== tests/cases/compiler/assignmentCompatability15.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,6 +14,6 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: boolean; }': -!!! Types of property 'two' are incompatible: -!!! Type 'string' is not assignable to type 'boolean'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: boolean; }': +!!! error TS2322: Types of property 'two' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability16.errors.txt b/tests/baselines/reference/assignmentCompatability16.errors.txt index 0e8b5b045a6..b114462c711 100644 --- a/tests/baselines/reference/assignmentCompatability16.errors.txt +++ b/tests/baselines/reference/assignmentCompatability16.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability16.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'any[]': + Property 'length' is missing in type 'Number'. + + ==== tests/cases/compiler/assignmentCompatability16.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability17.errors.txt b/tests/baselines/reference/assignmentCompatability17.errors.txt index ddf7bddabf8..f30e39de1ae 100644 --- a/tests/baselines/reference/assignmentCompatability17.errors.txt +++ b/tests/baselines/reference/assignmentCompatability17.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability17.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: any[]; }': + Types of property 'two' are incompatible: + Type 'string' is not assignable to type 'any[]': + Property 'push' is missing in type 'String'. + + ==== tests/cases/compiler/assignmentCompatability17.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: any[]; }': -!!! Types of property 'two' are incompatible: -!!! Type 'string' is not assignable to type 'any[]': -!!! Property 'push' is missing in type 'String'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: any[]; }': +!!! error TS2322: Types of property 'two' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'any[]': +!!! error TS2322: Property 'push' is missing in type 'String'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability18.errors.txt b/tests/baselines/reference/assignmentCompatability18.errors.txt index 26f5fa6ede1..d619b4847ad 100644 --- a/tests/baselines/reference/assignmentCompatability18.errors.txt +++ b/tests/baselines/reference/assignmentCompatability18.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability18.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'number[]': + Property 'length' is missing in type 'Number'. + + ==== tests/cases/compiler/assignmentCompatability18.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'number[]': -!!! Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'number[]': +!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability19.errors.txt b/tests/baselines/reference/assignmentCompatability19.errors.txt index cdfcf84aae9..1c61c2bc808 100644 --- a/tests/baselines/reference/assignmentCompatability19.errors.txt +++ b/tests/baselines/reference/assignmentCompatability19.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability19.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number[]; }': + Types of property 'two' are incompatible: + Type 'string' is not assignable to type 'number[]': + Property 'push' is missing in type 'String'. + + ==== tests/cases/compiler/assignmentCompatability19.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number[]; }': -!!! Types of property 'two' are incompatible: -!!! Type 'string' is not assignable to type 'number[]': -!!! Property 'push' is missing in type 'String'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number[]; }': +!!! error TS2322: Types of property 'two' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number[]': +!!! error TS2322: Property 'push' is missing in type 'String'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability20.errors.txt b/tests/baselines/reference/assignmentCompatability20.errors.txt index 0a198da5523..b9d966a09a5 100644 --- a/tests/baselines/reference/assignmentCompatability20.errors.txt +++ b/tests/baselines/reference/assignmentCompatability20.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability20.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'string[]': + Property 'length' is missing in type 'Number'. + + ==== tests/cases/compiler/assignmentCompatability20.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'string[]': -!!! Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string[]': +!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability21.errors.txt b/tests/baselines/reference/assignmentCompatability21.errors.txt index e8785413e05..72a690c5d16 100644 --- a/tests/baselines/reference/assignmentCompatability21.errors.txt +++ b/tests/baselines/reference/assignmentCompatability21.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability21.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string[]; }': + Types of property 'two' are incompatible: + Type 'string' is not assignable to type 'string[]': + Property 'push' is missing in type 'String'. + + ==== tests/cases/compiler/assignmentCompatability21.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string[]; }': -!!! Types of property 'two' are incompatible: -!!! Type 'string' is not assignable to type 'string[]': -!!! Property 'push' is missing in type 'String'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string[]; }': +!!! error TS2322: Types of property 'two' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'string[]': +!!! error TS2322: Property 'push' is missing in type 'String'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability22.errors.txt b/tests/baselines/reference/assignmentCompatability22.errors.txt index 6497d477102..b033522049d 100644 --- a/tests/baselines/reference/assignmentCompatability22.errors.txt +++ b/tests/baselines/reference/assignmentCompatability22.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability22.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'boolean[]': + Property 'length' is missing in type 'Number'. + + ==== tests/cases/compiler/assignmentCompatability22.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'boolean[]': -!!! Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'boolean[]': +!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability23.errors.txt b/tests/baselines/reference/assignmentCompatability23.errors.txt index 88f13a2ffc2..f50d2ba943e 100644 --- a/tests/baselines/reference/assignmentCompatability23.errors.txt +++ b/tests/baselines/reference/assignmentCompatability23.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability23.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: boolean[]; }': + Types of property 'two' are incompatible: + Type 'string' is not assignable to type 'boolean[]': + Property 'push' is missing in type 'String'. + + ==== tests/cases/compiler/assignmentCompatability23.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: boolean[]; }': -!!! Types of property 'two' are incompatible: -!!! Type 'string' is not assignable to type 'boolean[]': -!!! Property 'push' is missing in type 'String'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: boolean[]; }': +!!! error TS2322: Types of property 'two' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'boolean[]': +!!! error TS2322: Property 'push' is missing in type 'String'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability24.errors.txt b/tests/baselines/reference/assignmentCompatability24.errors.txt index 70a6717b9b7..14cd2eb41d4 100644 --- a/tests/baselines/reference/assignmentCompatability24.errors.txt +++ b/tests/baselines/reference/assignmentCompatability24.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/assignmentCompatability24.ts(9,1): error TS2323: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. + + ==== tests/cases/compiler/assignmentCompatability24.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,4 +12,4 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. \ No newline at end of file +!!! error TS2323: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability25.errors.txt b/tests/baselines/reference/assignmentCompatability25.errors.txt index bc3de672ea2..c02b876e4e0 100644 --- a/tests/baselines/reference/assignmentCompatability25.errors.txt +++ b/tests/baselines/reference/assignmentCompatability25.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/assignmentCompatability25.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number; }': + Types of property 'two' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/assignmentCompatability25.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,6 +14,6 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number; }': -!!! Types of property 'two' are incompatible: -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number; }': +!!! error TS2322: Types of property 'two' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability26.errors.txt b/tests/baselines/reference/assignmentCompatability26.errors.txt index 771ae72eb41..253c8af2c16 100644 --- a/tests/baselines/reference/assignmentCompatability26.errors.txt +++ b/tests/baselines/reference/assignmentCompatability26.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/assignmentCompatability26.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/assignmentCompatability26.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,6 +14,6 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability27.errors.txt b/tests/baselines/reference/assignmentCompatability27.errors.txt index 26948fe97ea..3c033c8d98d 100644 --- a/tests/baselines/reference/assignmentCompatability27.errors.txt +++ b/tests/baselines/reference/assignmentCompatability27.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/assignmentCompatability27.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }': + Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type '{ two: string; }'. + + ==== tests/cases/compiler/assignmentCompatability27.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,5 +13,5 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }': -!!! Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }': +!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type '{ two: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability28.errors.txt b/tests/baselines/reference/assignmentCompatability28.errors.txt index 2b50a9b3596..ce604747051 100644 --- a/tests/baselines/reference/assignmentCompatability28.errors.txt +++ b/tests/baselines/reference/assignmentCompatability28.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/assignmentCompatability28.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'boolean'. + + ==== tests/cases/compiler/assignmentCompatability28.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,6 +14,6 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'boolean'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability29.errors.txt b/tests/baselines/reference/assignmentCompatability29.errors.txt index 937d5112007..fe9e390b482 100644 --- a/tests/baselines/reference/assignmentCompatability29.errors.txt +++ b/tests/baselines/reference/assignmentCompatability29.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability29.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'any[]': + Property 'length' is missing in type 'Number'. + + ==== tests/cases/compiler/assignmentCompatability29.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'any[]': -!!! Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'any[]': +!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability30.errors.txt b/tests/baselines/reference/assignmentCompatability30.errors.txt index 08a8b313d30..663d8eaa299 100644 --- a/tests/baselines/reference/assignmentCompatability30.errors.txt +++ b/tests/baselines/reference/assignmentCompatability30.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability30.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'number[]': + Property 'length' is missing in type 'Number'. + + ==== tests/cases/compiler/assignmentCompatability30.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'number[]': -!!! Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'number[]': +!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability31.errors.txt b/tests/baselines/reference/assignmentCompatability31.errors.txt index c620198e2ac..00d5dd59188 100644 --- a/tests/baselines/reference/assignmentCompatability31.errors.txt +++ b/tests/baselines/reference/assignmentCompatability31.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability31.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'string[]': + Property 'length' is missing in type 'Number'. + + ==== tests/cases/compiler/assignmentCompatability31.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'string[]': -!!! Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string[]': +!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability32.errors.txt b/tests/baselines/reference/assignmentCompatability32.errors.txt index a20461b25bd..c4f20881a44 100644 --- a/tests/baselines/reference/assignmentCompatability32.errors.txt +++ b/tests/baselines/reference/assignmentCompatability32.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentCompatability32.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'boolean[]': + Property 'length' is missing in type 'Number'. + + ==== tests/cases/compiler/assignmentCompatability32.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,7 +15,7 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'boolean[]': -!!! Property 'length' is missing in type 'Number'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'boolean[]': +!!! error TS2322: Property 'length' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability33.errors.txt b/tests/baselines/reference/assignmentCompatability33.errors.txt index 3f9f4716f81..27a87764b61 100644 --- a/tests/baselines/reference/assignmentCompatability33.errors.txt +++ b/tests/baselines/reference/assignmentCompatability33.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/assignmentCompatability33.ts(9,1): error TS2323: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. + + ==== tests/cases/compiler/assignmentCompatability33.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,4 +12,4 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. \ No newline at end of file +!!! error TS2323: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability34.errors.txt b/tests/baselines/reference/assignmentCompatability34.errors.txt index 1ae98d98d37..9ac0a97011c 100644 --- a/tests/baselines/reference/assignmentCompatability34.errors.txt +++ b/tests/baselines/reference/assignmentCompatability34.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/assignmentCompatability34.ts(9,1): error TS2323: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tnumber) => Tnumber'. + + ==== tests/cases/compiler/assignmentCompatability34.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,4 +12,4 @@ } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tnumber) => Tnumber'. \ No newline at end of file +!!! error TS2323: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tnumber) => Tnumber'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability35.errors.txt b/tests/baselines/reference/assignmentCompatability35.errors.txt index ac6c09a8bec..4ae2aaf42d8 100644 --- a/tests/baselines/reference/assignmentCompatability35.errors.txt +++ b/tests/baselines/reference/assignmentCompatability35.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/assignmentCompatability35.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ [x: number]: number; }': + Index signature is missing in type 'interfaceWithPublicAndOptional'. + + ==== tests/cases/compiler/assignmentCompatability35.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,5 +13,5 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ [x: number]: number; }': -!!! Index signature is missing in type 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ [x: number]: number; }': +!!! error TS2322: Index signature is missing in type 'interfaceWithPublicAndOptional'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability36.errors.txt b/tests/baselines/reference/assignmentCompatability36.errors.txt index acf5aa5344e..013f5ae33b6 100644 --- a/tests/baselines/reference/assignmentCompatability36.errors.txt +++ b/tests/baselines/reference/assignmentCompatability36.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/assignmentCompatability36.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ [x: string]: any; }': + Index signature is missing in type 'interfaceWithPublicAndOptional'. + + ==== tests/cases/compiler/assignmentCompatability36.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,5 +13,5 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type '{ [x: string]: any; }': -!!! Index signature is missing in type 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ [x: string]: any; }': +!!! error TS2322: Index signature is missing in type 'interfaceWithPublicAndOptional'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability37.errors.txt b/tests/baselines/reference/assignmentCompatability37.errors.txt index f097e9664d3..7ce5905816b 100644 --- a/tests/baselines/reference/assignmentCompatability37.errors.txt +++ b/tests/baselines/reference/assignmentCompatability37.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/assignmentCompatability37.ts(9,1): error TS2323: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tnumber) => any'. + + ==== tests/cases/compiler/assignmentCompatability37.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,4 +12,4 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tnumber) => any'. \ No newline at end of file +!!! error TS2323: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tnumber) => any'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability38.errors.txt b/tests/baselines/reference/assignmentCompatability38.errors.txt index 9efa19b0338..d23685d9f99 100644 --- a/tests/baselines/reference/assignmentCompatability38.errors.txt +++ b/tests/baselines/reference/assignmentCompatability38.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/assignmentCompatability38.ts(9,1): error TS2323: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tstring) => any'. + + ==== tests/cases/compiler/assignmentCompatability38.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,4 +12,4 @@ } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tstring) => any'. \ No newline at end of file +!!! error TS2323: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tstring) => any'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability39.errors.txt b/tests/baselines/reference/assignmentCompatability39.errors.txt index f924512d461..3ab5cee7887 100644 --- a/tests/baselines/reference/assignmentCompatability39.errors.txt +++ b/tests/baselines/reference/assignmentCompatability39.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/assignmentCompatability39.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithTwoPublic': + Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'classWithTwoPublic'. + + ==== tests/cases/compiler/assignmentCompatability39.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,5 +13,5 @@ } __test2__.__val__x2 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithTwoPublic': -!!! Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithTwoPublic': +!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'classWithTwoPublic'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability40.errors.txt b/tests/baselines/reference/assignmentCompatability40.errors.txt index db1948d7cb0..4be86ebc805 100644 --- a/tests/baselines/reference/assignmentCompatability40.errors.txt +++ b/tests/baselines/reference/assignmentCompatability40.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/assignmentCompatability40.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPrivate': + Property 'one' is private in type 'classWithPrivate' but not in type 'interfaceWithPublicAndOptional'. + + ==== tests/cases/compiler/assignmentCompatability40.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,5 +13,5 @@ } __test2__.__val__x5 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPrivate': -!!! Private property 'one' cannot be reimplemented. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPrivate': +!!! error TS2322: Property 'one' is private in type 'classWithPrivate' but not in type 'interfaceWithPublicAndOptional'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability41.errors.txt b/tests/baselines/reference/assignmentCompatability41.errors.txt index e21dc1c8cd3..018beb23358 100644 --- a/tests/baselines/reference/assignmentCompatability41.errors.txt +++ b/tests/baselines/reference/assignmentCompatability41.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/assignmentCompatability41.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithTwoPrivate': + Property 'one' is private in type 'classWithTwoPrivate' but not in type 'interfaceWithPublicAndOptional'. + + ==== tests/cases/compiler/assignmentCompatability41.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,5 +13,5 @@ } __test2__.__val__x6 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithTwoPrivate': -!!! Private property 'one' cannot be reimplemented. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithTwoPrivate': +!!! error TS2322: Property 'one' is private in type 'classWithTwoPrivate' but not in type 'interfaceWithPublicAndOptional'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability42.errors.txt b/tests/baselines/reference/assignmentCompatability42.errors.txt index 2258a85139e..de6fd79041e 100644 --- a/tests/baselines/reference/assignmentCompatability42.errors.txt +++ b/tests/baselines/reference/assignmentCompatability42.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/assignmentCompatability42.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPublicPrivate': + Property 'two' is private in type 'classWithPublicPrivate' but not in type 'interfaceWithPublicAndOptional'. + + ==== tests/cases/compiler/assignmentCompatability42.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,5 +13,5 @@ } __test2__.__val__x7 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPublicPrivate': -!!! Private property 'two' cannot be reimplemented. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPublicPrivate': +!!! error TS2322: Property 'two' is private in type 'classWithPublicPrivate' but not in type 'interfaceWithPublicAndOptional'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability43.errors.txt b/tests/baselines/reference/assignmentCompatability43.errors.txt index 1ab4e3dcef8..3f5fc9789b9 100644 --- a/tests/baselines/reference/assignmentCompatability43.errors.txt +++ b/tests/baselines/reference/assignmentCompatability43.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/assignmentCompatability43.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'interfaceTwo': + Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'interfaceTwo'. + + ==== tests/cases/compiler/assignmentCompatability43.ts (1 errors) ==== module __test1__ { export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; @@ -9,5 +13,5 @@ } __test2__.__val__obj2 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~~ -!!! Type 'interfaceWithPublicAndOptional' is not assignable to type 'interfaceTwo': -!!! Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'interfaceTwo': +!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'interfaceTwo'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt b/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt index fdb719715eb..3c6f6c72b55 100644 --- a/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt +++ b/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt @@ -1,3 +1,18 @@ +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Applicable': + Property 'apply' is missing in type 'String'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Applicable': + Property 'apply' is missing in type 'string[]'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Applicable': + Property 'apply' is missing in type 'Number'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Applicable': + Property 'apply' is missing in type '{}'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(23,4): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Applicable'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Applicable'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(25,4): error TS2345: Argument of type '{}' is not assignable to parameter of type 'Applicable'. + Property 'apply' is missing in type '{}'. + + ==== tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts (8 errors) ==== // 3.8.4 Assignment Compatibility @@ -10,20 +25,20 @@ // Should fail x = ''; ~ -!!! Type 'string' is not assignable to type 'Applicable': -!!! Property 'apply' is missing in type 'String'. +!!! error TS2322: Type 'string' is not assignable to type 'Applicable': +!!! error TS2322: Property 'apply' is missing in type 'String'. x = ['']; ~ -!!! Type 'string[]' is not assignable to type 'Applicable': -!!! Property 'apply' is missing in type 'string[]'. +!!! error TS2322: Type 'string[]' is not assignable to type 'Applicable': +!!! error TS2322: Property 'apply' is missing in type 'string[]'. x = 4; ~ -!!! Type 'number' is not assignable to type 'Applicable': -!!! Property 'apply' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type 'Applicable': +!!! error TS2322: Property 'apply' is missing in type 'Number'. x = {}; ~ -!!! Type '{}' is not assignable to type 'Applicable': -!!! Property 'apply' is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type 'Applicable': +!!! error TS2322: Property 'apply' is missing in type '{}'. // Should work function f() { }; @@ -34,17 +49,17 @@ // Should Fail fn(''); ~~ -!!! Argument of type 'string' is not assignable to parameter of type 'Applicable'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'. fn(['']); ~~~~ -!!! Argument of type 'string[]' is not assignable to parameter of type 'Applicable'. +!!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Applicable'. fn(4); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'Applicable'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Applicable'. fn({}); ~~ -!!! Argument of type '{}' is not assignable to parameter of type 'Applicable'. -!!! Property 'apply' is missing in type '{}'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'Applicable'. +!!! error TS2345: Property 'apply' is missing in type '{}'. // Should work diff --git a/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt b/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt index 91c3cee4293..ab9b4985cc2 100644 --- a/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt +++ b/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt @@ -1,3 +1,18 @@ +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Callable': + Property 'call' is missing in type 'String'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Callable': + Property 'call' is missing in type 'string[]'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Callable': + Property 'call' is missing in type 'Number'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Callable': + Property 'call' is missing in type '{}'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Callable'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(23,4): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Callable'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Callable'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(25,4): error TS2345: Argument of type '{}' is not assignable to parameter of type 'Callable'. + Property 'call' is missing in type '{}'. + + ==== tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts (8 errors) ==== // 3.8.4 Assignment Compatibility @@ -10,20 +25,20 @@ // Should fail x = ''; ~ -!!! Type 'string' is not assignable to type 'Callable': -!!! Property 'call' is missing in type 'String'. +!!! error TS2322: Type 'string' is not assignable to type 'Callable': +!!! error TS2322: Property 'call' is missing in type 'String'. x = ['']; ~ -!!! Type 'string[]' is not assignable to type 'Callable': -!!! Property 'call' is missing in type 'string[]'. +!!! error TS2322: Type 'string[]' is not assignable to type 'Callable': +!!! error TS2322: Property 'call' is missing in type 'string[]'. x = 4; ~ -!!! Type 'number' is not assignable to type 'Callable': -!!! Property 'call' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type 'Callable': +!!! error TS2322: Property 'call' is missing in type 'Number'. x = {}; ~ -!!! Type '{}' is not assignable to type 'Callable': -!!! Property 'call' is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type 'Callable': +!!! error TS2322: Property 'call' is missing in type '{}'. // Should work function f() { }; @@ -34,17 +49,17 @@ // Should Fail fn(''); ~~ -!!! Argument of type 'string' is not assignable to parameter of type 'Callable'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Callable'. fn(['']); ~~~~ -!!! Argument of type 'string[]' is not assignable to parameter of type 'Callable'. +!!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Callable'. fn(4); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'Callable'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Callable'. fn({}); ~~ -!!! Argument of type '{}' is not assignable to parameter of type 'Callable'. -!!! Property 'call' is missing in type '{}'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'Callable'. +!!! error TS2345: Property 'call' is missing in type '{}'. // Should work diff --git a/tests/baselines/reference/assignmentLHSIsValue.errors.txt b/tests/baselines/reference/assignmentLHSIsValue.errors.txt index 90e6a7e3dc2..2f65b368532 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/assignmentLHSIsValue.errors.txt @@ -1,3 +1,45 @@ +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(42,36): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(44,19): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(46,27): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(50,20): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,11): error TS1005: ';' expected. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(6,21): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7,13): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(8,21): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(11,18): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(13,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(17,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(19,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(22,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(24,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(27,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(28,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(29,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(30,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(31,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(32,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(42,30): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(44,13): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(46,21): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(54,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(57,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(58,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(59,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(60,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(61,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(62,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(63,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(64,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(65,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(66,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(67,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(68,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(69,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(70,1): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (40 errors) ==== // expected error for all the LHS of assignments var value; @@ -6,146 +48,146 @@ class C { constructor() { this = value; } ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. foo() { this = value; } ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. static sfoo() { this = value; } ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } function foo() { this = value; } ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. this = value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. // identifiers: module, class, enum, function module M { export var a; } M = value; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. C = value; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. enum E { } E = value; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. foo = value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. // literals null = value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. true = value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. false = value; ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. 0 = value; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. '' = value; ~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. /d+/ = value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. // object literals { a: 0} = value; ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. // array literals ['', ''] = value; ~~~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. // super class Derived extends C { constructor() { super(); super = value; } ~ -!!! 'super' must be followed by an argument list or member access. +!!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. foo() { super = value } ~ -!!! 'super' must be followed by an argument list or member access. +!!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. static sfoo() { super = value; } ~ -!!! 'super' must be followed by an argument list or member access. +!!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } // function expression function bar() { } = value; ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. () => { } = value; ~ -!!! ';' expected. +!!! error TS1005: ';' expected. // function calls foo() = value; ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. // parentheses, the containted expression is value (this) = value; ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (M) = value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (C) = value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (E) = value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (foo) = value; ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (null) = value; ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (true) = value; ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (0) = value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. ('') = value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (/d+/) = value; ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. ({}) = value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. ([]) = value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (function baz() { }) = value; ~~~~~~~~~~~~~~~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (foo()) = value; ~~~~~~~ -!!! Invalid left-hand side of assignment expression. \ No newline at end of file +!!! error TS2364: Invalid left-hand side of assignment expression. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentStricterConstraints.errors.txt b/tests/baselines/reference/assignmentStricterConstraints.errors.txt index 37b4de1bfa5..f5234a44fd1 100644 --- a/tests/baselines/reference/assignmentStricterConstraints.errors.txt +++ b/tests/baselines/reference/assignmentStricterConstraints.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/assignmentStricterConstraints.ts(1,22): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/assignmentStricterConstraints.ts(2,5): error TS2323: Type 'S' is not assignable to type 'T'. + + ==== tests/cases/compiler/assignmentStricterConstraints.ts (2 errors) ==== var f = function (x: T, y: S): void { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. x = y ~ -!!! Type 'S' is not assignable to type 'T'. +!!! error TS2323: Type 'S' is not assignable to type 'T'. } var g = function (x: T, y: S): void { } diff --git a/tests/baselines/reference/assignmentToFunction.errors.txt b/tests/baselines/reference/assignmentToFunction.errors.txt index 0e5d9351f29..b9a2f1f2675 100644 --- a/tests/baselines/reference/assignmentToFunction.errors.txt +++ b/tests/baselines/reference/assignmentToFunction.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/assignmentToFunction.ts(2,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/compiler/assignmentToFunction.ts(8,9): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/compiler/assignmentToFunction.ts (2 errors) ==== function fn() { } fn = () => 3; ~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. module foo { function xyz() { @@ -10,6 +14,6 @@ } bar = null; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentToObject.errors.txt b/tests/baselines/reference/assignmentToObject.errors.txt index 13f7725ff38..bfb270b71b6 100644 --- a/tests/baselines/reference/assignmentToObject.errors.txt +++ b/tests/baselines/reference/assignmentToObject.errors.txt @@ -1,9 +1,14 @@ +tests/cases/compiler/assignmentToObject.ts(3,5): error TS2322: Type '{ toString: number; }' is not assignable to type 'Object': + Types of property 'toString' are incompatible: + Type 'number' is not assignable to type '() => string'. + + ==== tests/cases/compiler/assignmentToObject.ts (1 errors) ==== var a = { toString: 5 }; var b: {} = a; // ok var c: Object = a; // should be error ~ -!!! Type '{ toString: number; }' is not assignable to type 'Object': -!!! Types of property 'toString' are incompatible: -!!! Type 'number' is not assignable to type '() => string'. +!!! error TS2322: Type '{ toString: number; }' is not assignable to type 'Object': +!!! error TS2322: Types of property 'toString' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type '() => string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt b/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt index fb5aeac1bca..c6ba4e7dfe3 100644 --- a/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt +++ b/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt @@ -1,9 +1,19 @@ +tests/cases/compiler/assignmentToObjectAndFunction.ts(1,5): error TS2322: Type '{ toString: number; }' is not assignable to type 'Object': + Types of property 'toString' are incompatible: + Type 'number' is not assignable to type '() => string'. +tests/cases/compiler/assignmentToObjectAndFunction.ts(8,5): error TS2322: Type '{}' is not assignable to type 'Function': + Property 'apply' is missing in type '{}'. +tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type 'typeof bad' is not assignable to type 'Function': + Types of property 'apply' are incompatible: + Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'. + + ==== tests/cases/compiler/assignmentToObjectAndFunction.ts (3 errors) ==== var errObj: Object = { toString: 0 }; // Error, incompatible toString ~~~~~~ -!!! Type '{ toString: number; }' is not assignable to type 'Object': -!!! Types of property 'toString' are incompatible: -!!! Type 'number' is not assignable to type '() => string'. +!!! error TS2322: Type '{ toString: number; }' is not assignable to type 'Object': +!!! error TS2322: Types of property 'toString' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type '() => string'. var goodObj: Object = { toString(x?) { return ""; @@ -12,8 +22,8 @@ var errFun: Function = {}; // Error for no call signature ~~~~~~ -!!! Type '{}' is not assignable to type 'Function': -!!! Property 'apply' is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type 'Function': +!!! error TS2322: Property 'apply' is missing in type '{}'. function foo() { } module foo { @@ -36,6 +46,6 @@ var badFundule: Function = bad; // error ~~~~~~~~~~ -!!! Type 'typeof bad' is not assignable to type 'Function': -!!! Types of property 'apply' are incompatible: -!!! Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'. \ No newline at end of file +!!! error TS2322: Type 'typeof bad' is not assignable to type 'Function': +!!! error TS2322: Types of property 'apply' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentToParenthesizedExpression1.errors.txt b/tests/baselines/reference/assignmentToParenthesizedExpression1.errors.txt index 3d56ed9d18b..0b1b1e04de8 100644 --- a/tests/baselines/reference/assignmentToParenthesizedExpression1.errors.txt +++ b/tests/baselines/reference/assignmentToParenthesizedExpression1.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/assignmentToParenthesizedExpression1.ts(2,1): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/compiler/assignmentToParenthesizedExpression1.ts (1 errors) ==== var x; (1, x)=0; ~~~~~~ -!!! Invalid left-hand side of assignment expression. \ No newline at end of file +!!! error TS2364: Invalid left-hand side of assignment expression. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt index 95e9d44ee4d..070b5497121 100644 --- a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt +++ b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt @@ -1,13 +1,45 @@ +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(4,1): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(5,1): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(13,1): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(14,1): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(15,1): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(17,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(18,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(25,5): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(31,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(32,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(33,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(37,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(38,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(43,5): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(44,5): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(48,5): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(49,5): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(54,5): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(55,5): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(56,5): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(62,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(63,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(69,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(70,1): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts (24 errors) ==== var x: number; x = 3; // OK (x) = 3; // OK x = ''; // Error ~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. (x) = ''; // Error ~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. module M { export var y: number; @@ -17,20 +49,20 @@ (M.y) = 3; // OK M.y = ''; // Error ~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. (M).y = ''; // Error ~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. (M.y) = ''; // Error ~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. M = { y: 3 }; // Error ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (M) = { y: 3 }; // Error ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. module M2 { export module M3 { @@ -39,7 +71,7 @@ M3 = { x: 3 }; // Error ~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } M2.M3 = { x: 3 }; // OK (M2).M3 = { x: 3 }; // OK @@ -47,60 +79,60 @@ M2.M3 = { x: '' }; // Error ~~~~~ -!!! Type '{ x: string; }' is not assignable to type 'typeof M3': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. (M2).M3 = { x: '' }; // Error ~~~~~~~ -!!! Type '{ x: string; }' is not assignable to type 'typeof M3': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. (M2.M3) = { x: '' }; // Error ~~~~~~~ -!!! Type '{ x: string; }' is not assignable to type 'typeof M3': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. function fn() { } fn = () => 3; // Bug 823548: Should be error (fn is not a reference) ~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (fn) = () => 3; // Should be error ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. function fn2(x: number, y: { t: number }) { x = 3; (x) = 3; // OK x = ''; // Error ~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. (x) = ''; // Error ~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. (y).t = 3; // OK (y.t) = 3; // OK (y).t = ''; // Error ~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. (y.t) = ''; // Error ~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. y['t'] = 3; // OK (y)['t'] = 3; // OK (y['t']) = 3; // OK y['t'] = ''; // Error ~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. (y)['t'] = ''; // Error ~~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. (y['t']) = ''; // Error ~~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. } enum E { @@ -108,10 +140,10 @@ } E = undefined; // Error ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (E) = undefined; // Error ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. class C { @@ -119,8 +151,8 @@ C = undefined; // Error ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (C) = undefined; // Error ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentToReferenceTypes.errors.txt b/tests/baselines/reference/assignmentToReferenceTypes.errors.txt index b67b5b075e4..56d6adc4149 100644 --- a/tests/baselines/reference/assignmentToReferenceTypes.errors.txt +++ b/tests/baselines/reference/assignmentToReferenceTypes.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/assignmentToReferenceTypes.ts(5,1): error TS2304: Cannot find name 'M'. +tests/cases/compiler/assignmentToReferenceTypes.ts(9,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/compiler/assignmentToReferenceTypes.ts(13,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/compiler/assignmentToReferenceTypes.ts(16,1): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/compiler/assignmentToReferenceTypes.ts (4 errors) ==== // Should all be allowed @@ -5,24 +11,24 @@ } M = null; ~ -!!! Cannot find name 'M'. +!!! error TS2304: Cannot find name 'M'. class C { } C = null; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. enum E { } E = null; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. function f() { } f = null; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. var x = 1; x = null; diff --git a/tests/baselines/reference/assignments.errors.txt b/tests/baselines/reference/assignments.errors.txt index 5671c58d5b2..9f89863f31f 100644 --- a/tests/baselines/reference/assignments.errors.txt +++ b/tests/baselines/reference/assignments.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(11,1): error TS2304: Cannot find name 'M'. +tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(14,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(17,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(18,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(21,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): error TS2304: Cannot find name 'I'. + + ==== tests/cases/conformance/expressions/valuesAndReferences/assignments.ts (6 errors) ==== // In this file: // Assign to a module @@ -11,25 +19,25 @@ module M { } M = null; // Error ~ -!!! Cannot find name 'M'. +!!! error TS2304: Cannot find name 'M'. class C { } C = null; // Error ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. enum E { A } E = null; // Error ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. E.A = null; // OK per spec, Error per implementation (509581) ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. function fn() { } fn = null; // Should be error ~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. var v; v = null; // OK @@ -41,4 +49,4 @@ interface I { } I = null; // Error ~ -!!! Cannot find name 'I'. \ No newline at end of file +!!! error TS2304: Cannot find name 'I'. \ No newline at end of file diff --git a/tests/baselines/reference/augmentedClassWithPrototypePropertyOnModule.errors.txt b/tests/baselines/reference/augmentedClassWithPrototypePropertyOnModule.errors.txt index 96306db9e3d..bc83e3e4dfa 100644 --- a/tests/baselines/reference/augmentedClassWithPrototypePropertyOnModule.errors.txt +++ b/tests/baselines/reference/augmentedClassWithPrototypePropertyOnModule.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/augmentedClassWithPrototypePropertyOnModule.ts(3,9): error TS2300: Duplicate identifier 'prototype'. + + ==== tests/cases/compiler/augmentedClassWithPrototypePropertyOnModule.ts (1 errors) ==== declare module m { var f; var prototype; // This should be error since prototype would be static property on class m ~~~~~~~~~ -!!! Duplicate identifier 'prototype'. +!!! error TS2300: Duplicate identifier 'prototype'. } declare class m { } \ No newline at end of file diff --git a/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.errors.txt b/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.errors.txt index 4222ab54b15..2c165c2395c 100644 --- a/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.errors.txt +++ b/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(15,5): error TS2322: Type '{}' is not assignable to type '{ [x: number]: Foo; }': + Index signature is missing in type '{}'. +tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(19,5): error TS2322: Type '() => void' is not assignable to type '{ [x: number]: Bar; }': + Index signature is missing in type '() => void'. + + ==== tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts (2 errors) ==== interface Foo { a } interface Bar { b } @@ -15,14 +21,14 @@ var v1: { ~~ -!!! Type '{}' is not assignable to type '{ [x: number]: Foo; }': -!!! Index signature is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type '{ [x: number]: Foo; }': +!!! error TS2322: Index signature is missing in type '{}'. [n: number]: Foo } = o; // Should be allowed var v2: { ~~ -!!! Type '() => void' is not assignable to type '{ [x: number]: Bar; }': -!!! Index signature is missing in type '() => void'. +!!! error TS2322: Type '() => void' is not assignable to type '{ [x: number]: Bar; }': +!!! error TS2322: Index signature is missing in type '() => void'. [n: number]: Bar } = f; // Should be allowed \ No newline at end of file diff --git a/tests/baselines/reference/augmentedTypesClass.errors.txt b/tests/baselines/reference/augmentedTypesClass.errors.txt index ee05d113767..2ff6889e22f 100644 --- a/tests/baselines/reference/augmentedTypesClass.errors.txt +++ b/tests/baselines/reference/augmentedTypesClass.errors.txt @@ -1,12 +1,22 @@ -==== tests/cases/compiler/augmentedTypesClass.ts (2 errors) ==== +tests/cases/compiler/augmentedTypesClass.ts(2,7): error TS2300: Duplicate identifier 'c1'. +tests/cases/compiler/augmentedTypesClass.ts(3,5): error TS2300: Duplicate identifier 'c1'. +tests/cases/compiler/augmentedTypesClass.ts(6,7): error TS2300: Duplicate identifier 'c4'. +tests/cases/compiler/augmentedTypesClass.ts(7,6): error TS2300: Duplicate identifier 'c4'. + + +==== tests/cases/compiler/augmentedTypesClass.ts (4 errors) ==== //// class then var class c1 { public foo() { } } + ~~ +!!! error TS2300: Duplicate identifier 'c1'. var c1 = 1; // error ~~ -!!! Duplicate identifier 'c1'. +!!! error TS2300: Duplicate identifier 'c1'. //// class then enum class c4 { public foo() { } } + ~~ +!!! error TS2300: Duplicate identifier 'c4'. enum c4 { One } // error ~~ -!!! Duplicate identifier 'c4'. \ No newline at end of file +!!! error TS2300: Duplicate identifier 'c4'. \ No newline at end of file diff --git a/tests/baselines/reference/augmentedTypesClass2.errors.txt b/tests/baselines/reference/augmentedTypesClass2.errors.txt index 7216ac604c7..5881e49dae9 100644 --- a/tests/baselines/reference/augmentedTypesClass2.errors.txt +++ b/tests/baselines/reference/augmentedTypesClass2.errors.txt @@ -1,8 +1,16 @@ -==== tests/cases/compiler/augmentedTypesClass2.ts (2 errors) ==== +tests/cases/compiler/augmentedTypesClass2.ts(4,7): error TS2300: Duplicate identifier 'c11'. +tests/cases/compiler/augmentedTypesClass2.ts(10,11): error TS2300: Duplicate identifier 'c11'. +tests/cases/compiler/augmentedTypesClass2.ts(16,7): error TS2300: Duplicate identifier 'c33'. +tests/cases/compiler/augmentedTypesClass2.ts(21,6): error TS2300: Duplicate identifier 'c33'. + + +==== tests/cases/compiler/augmentedTypesClass2.ts (4 errors) ==== // Checking class with other things in type space not value space // class then interface - class c11 { + class c11 { // error + ~~~ +!!! error TS2300: Duplicate identifier 'c11'. foo() { return 1; } @@ -10,20 +18,22 @@ interface c11 { // error ~~~ -!!! Duplicate identifier 'c11'. +!!! error TS2300: Duplicate identifier 'c11'. bar(): void; } // class then class - covered // class then enum class c33 { + ~~~ +!!! error TS2300: Duplicate identifier 'c33'. foo() { return 1; } } enum c33 { One }; ~~~ -!!! Duplicate identifier 'c33'. +!!! error TS2300: Duplicate identifier 'c33'. // class then import class c44 { diff --git a/tests/baselines/reference/augmentedTypesClass2.js b/tests/baselines/reference/augmentedTypesClass2.js index b4df1672b69..f75c08a5920 100644 --- a/tests/baselines/reference/augmentedTypesClass2.js +++ b/tests/baselines/reference/augmentedTypesClass2.js @@ -2,7 +2,7 @@ // Checking class with other things in type space not value space // class then interface -class c11 { +class c11 { // error foo() { return 1; } diff --git a/tests/baselines/reference/augmentedTypesClass2a.errors.txt b/tests/baselines/reference/augmentedTypesClass2a.errors.txt index 16edf2fb577..b17ab32d408 100644 --- a/tests/baselines/reference/augmentedTypesClass2a.errors.txt +++ b/tests/baselines/reference/augmentedTypesClass2a.errors.txt @@ -1,9 +1,16 @@ -==== tests/cases/compiler/augmentedTypesClass2a.ts (2 errors) ==== +tests/cases/compiler/augmentedTypesClass2a.ts(2,7): error TS2300: Duplicate identifier 'c2'. +tests/cases/compiler/augmentedTypesClass2a.ts(3,10): error TS2300: Duplicate identifier 'c2'. +tests/cases/compiler/augmentedTypesClass2a.ts(4,5): error TS2300: Duplicate identifier 'c2'. + + +==== tests/cases/compiler/augmentedTypesClass2a.ts (3 errors) ==== //// class then function - class c2 { public foo() { } } + class c2 { public foo() { } } // error + ~~ +!!! error TS2300: Duplicate identifier 'c2'. function c2() { } // error ~~ -!!! Duplicate identifier 'c2'. +!!! error TS2300: Duplicate identifier 'c2'. var c2 = () => { } ~~ -!!! Duplicate identifier 'c2'. \ No newline at end of file +!!! error TS2300: Duplicate identifier 'c2'. \ No newline at end of file diff --git a/tests/baselines/reference/augmentedTypesClass2a.js b/tests/baselines/reference/augmentedTypesClass2a.js index cca45c2c0b3..fe31f0964c2 100644 --- a/tests/baselines/reference/augmentedTypesClass2a.js +++ b/tests/baselines/reference/augmentedTypesClass2a.js @@ -1,6 +1,6 @@ //// [augmentedTypesClass2a.ts] //// class then function -class c2 { public foo() { } } +class c2 { public foo() { } } // error function c2() { } // error var c2 = () => { } @@ -12,7 +12,7 @@ var c2 = (function () { c2.prototype.foo = function () { }; return c2; -})(); +})(); // error function c2() { } // error var c2 = function () { diff --git a/tests/baselines/reference/augmentedTypesClass4.errors.txt b/tests/baselines/reference/augmentedTypesClass4.errors.txt index f909cd9c266..6df027ca511 100644 --- a/tests/baselines/reference/augmentedTypesClass4.errors.txt +++ b/tests/baselines/reference/augmentedTypesClass4.errors.txt @@ -1,7 +1,13 @@ -==== tests/cases/compiler/augmentedTypesClass4.ts (1 errors) ==== +tests/cases/compiler/augmentedTypesClass4.ts(2,7): error TS2300: Duplicate identifier 'c3'. +tests/cases/compiler/augmentedTypesClass4.ts(3,7): error TS2300: Duplicate identifier 'c3'. + + +==== tests/cases/compiler/augmentedTypesClass4.ts (2 errors) ==== //// class then class - class c3 { public foo() { } } + class c3 { public foo() { } } // error + ~~ +!!! error TS2300: Duplicate identifier 'c3'. class c3 { public bar() { } } // error ~~ -!!! Duplicate identifier 'c3'. +!!! error TS2300: Duplicate identifier 'c3'. \ No newline at end of file diff --git a/tests/baselines/reference/augmentedTypesClass4.js b/tests/baselines/reference/augmentedTypesClass4.js index c4e104e714b..71fc61d6659 100644 --- a/tests/baselines/reference/augmentedTypesClass4.js +++ b/tests/baselines/reference/augmentedTypesClass4.js @@ -1,6 +1,6 @@ //// [augmentedTypesClass4.ts] //// class then class -class c3 { public foo() { } } +class c3 { public foo() { } } // error class c3 { public bar() { } } // error @@ -12,7 +12,7 @@ var c3 = (function () { c3.prototype.foo = function () { }; return c3; -})(); +})(); // error var c3 = (function () { function c3() { } diff --git a/tests/baselines/reference/augmentedTypesEnum.errors.txt b/tests/baselines/reference/augmentedTypesEnum.errors.txt index d888f170b5d..3102f9d4786 100644 --- a/tests/baselines/reference/augmentedTypesEnum.errors.txt +++ b/tests/baselines/reference/augmentedTypesEnum.errors.txt @@ -1,39 +1,63 @@ -==== tests/cases/compiler/augmentedTypesEnum.ts (7 errors) ==== +tests/cases/compiler/augmentedTypesEnum.ts(2,6): error TS2300: Duplicate identifier 'e1111'. +tests/cases/compiler/augmentedTypesEnum.ts(3,5): error TS2300: Duplicate identifier 'e1111'. +tests/cases/compiler/augmentedTypesEnum.ts(6,6): error TS2300: Duplicate identifier 'e2'. +tests/cases/compiler/augmentedTypesEnum.ts(7,10): error TS2300: Duplicate identifier 'e2'. +tests/cases/compiler/augmentedTypesEnum.ts(9,6): error TS2300: Duplicate identifier 'e3'. +tests/cases/compiler/augmentedTypesEnum.ts(10,5): error TS2300: Duplicate identifier 'e3'. +tests/cases/compiler/augmentedTypesEnum.ts(13,6): error TS2300: Duplicate identifier 'e4'. +tests/cases/compiler/augmentedTypesEnum.ts(14,7): error TS2300: Duplicate identifier 'e4'. +tests/cases/compiler/augmentedTypesEnum.ts(18,11): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +tests/cases/compiler/augmentedTypesEnum.ts(20,12): error TS2300: Duplicate identifier 'One'. +tests/cases/compiler/augmentedTypesEnum.ts(21,12): error TS2300: Duplicate identifier 'One'. +tests/cases/compiler/augmentedTypesEnum.ts(21,12): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. + + +==== tests/cases/compiler/augmentedTypesEnum.ts (12 errors) ==== // enum then var - enum e1111 { One } + enum e1111 { One } // error + ~~~~~ +!!! error TS2300: Duplicate identifier 'e1111'. var e1111 = 1; // error ~~~~~ -!!! Duplicate identifier 'e1111'. +!!! error TS2300: Duplicate identifier 'e1111'. // enum then function - enum e2 { One } + enum e2 { One } // error + ~~ +!!! error TS2300: Duplicate identifier 'e2'. function e2() { } // error ~~ -!!! Duplicate identifier 'e2'. +!!! error TS2300: Duplicate identifier 'e2'. - enum e3 { One } + enum e3 { One } // error + ~~ +!!! error TS2300: Duplicate identifier 'e3'. var e3 = () => { } // error ~~ -!!! Duplicate identifier 'e3'. +!!! error TS2300: Duplicate identifier 'e3'. // enum then class - enum e4 { One } + enum e4 { One } // error + ~~ +!!! error TS2300: Duplicate identifier 'e4'. class e4 { public foo() { } } // error ~~ -!!! Duplicate identifier 'e4'. +!!! error TS2300: Duplicate identifier 'e4'. // enum then enum enum e5 { One } - enum e5 { Two } + enum e5 { Two } // error ~~~ -!!! In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +!!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. - enum e5a { One } enum e5a { One } // error ~~~ -!!! Duplicate identifier 'One'. +!!! error TS2300: Duplicate identifier 'One'. + enum e5a { One } // error ~~~ -!!! In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +!!! error TS2300: Duplicate identifier 'One'. + ~~~ +!!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. // enum then internal module enum e6 { One } diff --git a/tests/baselines/reference/augmentedTypesEnum.js b/tests/baselines/reference/augmentedTypesEnum.js index 8422b99798b..f7a83018cfd 100644 --- a/tests/baselines/reference/augmentedTypesEnum.js +++ b/tests/baselines/reference/augmentedTypesEnum.js @@ -1,24 +1,24 @@ //// [augmentedTypesEnum.ts] // enum then var -enum e1111 { One } +enum e1111 { One } // error var e1111 = 1; // error // enum then function -enum e2 { One } +enum e2 { One } // error function e2() { } // error -enum e3 { One } +enum e3 { One } // error var e3 = () => { } // error // enum then class -enum e4 { One } +enum e4 { One } // error class e4 { public foo() { } } // error // enum then enum enum e5 { One } -enum e5 { Two } +enum e5 { Two } // error -enum e5a { One } +enum e5a { One } // error enum e5a { One } // error // enum then internal module @@ -40,26 +40,26 @@ module e6b { export var y = 2; } // should be error var e1111; (function (e1111) { e1111[e1111["One"] = 0] = "One"; -})(e1111 || (e1111 = {})); +})(e1111 || (e1111 = {})); // error var e1111 = 1; // error // enum then function var e2; (function (e2) { e2[e2["One"] = 0] = "One"; -})(e2 || (e2 = {})); +})(e2 || (e2 = {})); // error function e2() { } // error var e3; (function (e3) { e3[e3["One"] = 0] = "One"; -})(e3 || (e3 = {})); +})(e3 || (e3 = {})); // error var e3 = function () { }; // error // enum then class var e4; (function (e4) { e4[e4["One"] = 0] = "One"; -})(e4 || (e4 = {})); +})(e4 || (e4 = {})); // error var e4 = (function () { function e4() { } @@ -75,11 +75,11 @@ var e5; var e5; (function (e5) { e5[e5["Two"] = 0] = "Two"; -})(e5 || (e5 = {})); +})(e5 || (e5 = {})); // error var e5a; (function (e5a) { e5a[e5a["One"] = 0] = "One"; -})(e5a || (e5a = {})); +})(e5a || (e5a = {})); // error var e5a; (function (e5a) { e5a[e5a["One"] = 0] = "One"; diff --git a/tests/baselines/reference/augmentedTypesEnum2.errors.txt b/tests/baselines/reference/augmentedTypesEnum2.errors.txt index 06581cf182c..8c6c7382f85 100644 --- a/tests/baselines/reference/augmentedTypesEnum2.errors.txt +++ b/tests/baselines/reference/augmentedTypesEnum2.errors.txt @@ -1,20 +1,30 @@ -==== tests/cases/compiler/augmentedTypesEnum2.ts (2 errors) ==== +tests/cases/compiler/augmentedTypesEnum2.ts(2,6): error TS2300: Duplicate identifier 'e1'. +tests/cases/compiler/augmentedTypesEnum2.ts(4,11): error TS2300: Duplicate identifier 'e1'. +tests/cases/compiler/augmentedTypesEnum2.ts(11,6): error TS2300: Duplicate identifier 'e2'. +tests/cases/compiler/augmentedTypesEnum2.ts(12,7): error TS2300: Duplicate identifier 'e2'. + + +==== tests/cases/compiler/augmentedTypesEnum2.ts (4 errors) ==== // enum then interface - enum e1 { One } + enum e1 { One } // error + ~~ +!!! error TS2300: Duplicate identifier 'e1'. - interface e1 { + interface e1 { // error ~~ -!!! Duplicate identifier 'e1'. +!!! error TS2300: Duplicate identifier 'e1'. foo(): void; } // interface then enum works // enum then class - enum e2 { One }; + enum e2 { One }; // error + ~~ +!!! error TS2300: Duplicate identifier 'e2'. class e2 { // error ~~ -!!! Duplicate identifier 'e2'. +!!! error TS2300: Duplicate identifier 'e2'. foo() { return 1; } diff --git a/tests/baselines/reference/augmentedTypesEnum2.js b/tests/baselines/reference/augmentedTypesEnum2.js index 13656b33411..8ab98a7cb7b 100644 --- a/tests/baselines/reference/augmentedTypesEnum2.js +++ b/tests/baselines/reference/augmentedTypesEnum2.js @@ -1,15 +1,15 @@ //// [augmentedTypesEnum2.ts] // enum then interface -enum e1 { One } +enum e1 { One } // error -interface e1 { +interface e1 { // error foo(): void; } // interface then enum works // enum then class -enum e2 { One }; +enum e2 { One }; // error class e2 { // error foo() { return 1; @@ -24,7 +24,7 @@ class e2 { // error var e1; (function (e1) { e1[e1["One"] = 0] = "One"; -})(e1 || (e1 = {})); +})(e1 || (e1 = {})); // error // interface then enum works // enum then class var e2; diff --git a/tests/baselines/reference/augmentedTypesEnum3.errors.txt b/tests/baselines/reference/augmentedTypesEnum3.errors.txt index c9e7bca61d4..9ec4f4d81c5 100644 --- a/tests/baselines/reference/augmentedTypesEnum3.errors.txt +++ b/tests/baselines/reference/augmentedTypesEnum3.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/augmentedTypesEnum3.ts(16,5): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. + + ==== tests/cases/compiler/augmentedTypesEnum3.ts (1 errors) ==== module E { var t; @@ -16,7 +19,7 @@ enum A { c ~ -!!! In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +!!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. } module A { var p; diff --git a/tests/baselines/reference/augmentedTypesFunction.errors.txt b/tests/baselines/reference/augmentedTypesFunction.errors.txt index ab42d79d8f7..8d1ce671c9e 100644 --- a/tests/baselines/reference/augmentedTypesFunction.errors.txt +++ b/tests/baselines/reference/augmentedTypesFunction.errors.txt @@ -1,37 +1,63 @@ -==== tests/cases/compiler/augmentedTypesFunction.ts (6 errors) ==== +tests/cases/compiler/augmentedTypesFunction.ts(2,10): error TS2300: Duplicate identifier 'y1'. +tests/cases/compiler/augmentedTypesFunction.ts(3,5): error TS2300: Duplicate identifier 'y1'. +tests/cases/compiler/augmentedTypesFunction.ts(6,10): error TS2393: Duplicate function implementation. +tests/cases/compiler/augmentedTypesFunction.ts(7,10): error TS2393: Duplicate function implementation. +tests/cases/compiler/augmentedTypesFunction.ts(9,10): error TS2300: Duplicate identifier 'y2a'. +tests/cases/compiler/augmentedTypesFunction.ts(10,5): error TS2300: Duplicate identifier 'y2a'. +tests/cases/compiler/augmentedTypesFunction.ts(13,10): error TS2300: Duplicate identifier 'y3'. +tests/cases/compiler/augmentedTypesFunction.ts(14,7): error TS2300: Duplicate identifier 'y3'. +tests/cases/compiler/augmentedTypesFunction.ts(16,10): error TS2300: Duplicate identifier 'y3a'. +tests/cases/compiler/augmentedTypesFunction.ts(17,7): error TS2300: Duplicate identifier 'y3a'. +tests/cases/compiler/augmentedTypesFunction.ts(20,10): error TS2300: Duplicate identifier 'y4'. +tests/cases/compiler/augmentedTypesFunction.ts(21,6): error TS2300: Duplicate identifier 'y4'. + + +==== tests/cases/compiler/augmentedTypesFunction.ts (12 errors) ==== // function then var - function y1() { } + function y1() { } // error + ~~ +!!! error TS2300: Duplicate identifier 'y1'. var y1 = 1; // error ~~ -!!! Duplicate identifier 'y1'. +!!! error TS2300: Duplicate identifier 'y1'. // function then function - function y2() { } function y2() { } // error - ~~~~~~~~~~~~~~~~~ -!!! Duplicate function implementation. + ~~ +!!! error TS2393: Duplicate function implementation. + function y2() { } // error + ~~ +!!! error TS2393: Duplicate function implementation. - function y2a() { } + function y2a() { } // error + ~~~ +!!! error TS2300: Duplicate identifier 'y2a'. var y2a = () => { } // error ~~~ -!!! Duplicate identifier 'y2a'. +!!! error TS2300: Duplicate identifier 'y2a'. // function then class - function y3() { } + function y3() { } // error + ~~ +!!! error TS2300: Duplicate identifier 'y3'. class y3 { } // error ~~ -!!! Duplicate identifier 'y3'. +!!! error TS2300: Duplicate identifier 'y3'. - function y3a() { } + function y3a() { } // error + ~~~ +!!! error TS2300: Duplicate identifier 'y3a'. class y3a { public foo() { } } // error ~~~ -!!! Duplicate identifier 'y3a'. +!!! error TS2300: Duplicate identifier 'y3a'. // function then enum - function y4() { } + function y4() { } // error + ~~ +!!! error TS2300: Duplicate identifier 'y4'. enum y4 { One } // error ~~ -!!! Duplicate identifier 'y4'. +!!! error TS2300: Duplicate identifier 'y4'. // function then internal module function y5() { } diff --git a/tests/baselines/reference/augmentedTypesFunction.js b/tests/baselines/reference/augmentedTypesFunction.js index 097482c7c5b..078854e227c 100644 --- a/tests/baselines/reference/augmentedTypesFunction.js +++ b/tests/baselines/reference/augmentedTypesFunction.js @@ -1,24 +1,24 @@ //// [augmentedTypesFunction.ts] // function then var -function y1() { } +function y1() { } // error var y1 = 1; // error // function then function -function y2() { } +function y2() { } // error function y2() { } // error -function y2a() { } +function y2a() { } // error var y2a = () => { } // error // function then class -function y3() { } +function y3() { } // error class y3 { } // error -function y3a() { } +function y3a() { } // error class y3a { public foo() { } } // error // function then enum -function y4() { } +function y4() { } // error enum y4 { One } // error // function then internal module @@ -41,27 +41,27 @@ module y5c { export interface I { foo(): void } } // should be an error //// [augmentedTypesFunction.js] // function then var function y1() { -} +} // error var y1 = 1; // error // function then function function y2() { -} +} // error function y2() { } // error function y2a() { -} +} // error var y2a = function () { }; // error // function then class function y3() { -} +} // error var y3 = (function () { function y3() { } return y3; })(); // error function y3a() { -} +} // error var y3a = (function () { function y3a() { } @@ -71,7 +71,7 @@ var y3a = (function () { })(); // error // function then enum function y4() { -} +} // error var y4; (function (y4) { y4[y4["One"] = 0] = "One"; diff --git a/tests/baselines/reference/augmentedTypesInterface.errors.txt b/tests/baselines/reference/augmentedTypesInterface.errors.txt index e26c2648c32..a9fc28dd5ae 100644 --- a/tests/baselines/reference/augmentedTypesInterface.errors.txt +++ b/tests/baselines/reference/augmentedTypesInterface.errors.txt @@ -1,4 +1,10 @@ -==== tests/cases/compiler/augmentedTypesInterface.ts (2 errors) ==== +tests/cases/compiler/augmentedTypesInterface.ts(12,11): error TS2300: Duplicate identifier 'i2'. +tests/cases/compiler/augmentedTypesInterface.ts(16,7): error TS2300: Duplicate identifier 'i2'. +tests/cases/compiler/augmentedTypesInterface.ts(23,11): error TS2300: Duplicate identifier 'i3'. +tests/cases/compiler/augmentedTypesInterface.ts(26,6): error TS2300: Duplicate identifier 'i3'. + + +==== tests/cases/compiler/augmentedTypesInterface.ts (4 errors) ==== // interface then interface interface i { @@ -10,25 +16,29 @@ } // interface then class - interface i2 { + interface i2 { // error + ~~ +!!! error TS2300: Duplicate identifier 'i2'. foo(): void; } class i2 { // error ~~ -!!! Duplicate identifier 'i2'. +!!! error TS2300: Duplicate identifier 'i2'. bar() { return 1; } } // interface then enum - interface i3 { + interface i3 { // error + ~~ +!!! error TS2300: Duplicate identifier 'i3'. foo(): void; } enum i3 { One }; // error ~~ -!!! Duplicate identifier 'i3'. +!!! error TS2300: Duplicate identifier 'i3'. // interface then import interface i4 { diff --git a/tests/baselines/reference/augmentedTypesInterface.js b/tests/baselines/reference/augmentedTypesInterface.js index 5c68ba9a744..709b16d615c 100644 --- a/tests/baselines/reference/augmentedTypesInterface.js +++ b/tests/baselines/reference/augmentedTypesInterface.js @@ -10,7 +10,7 @@ interface i { } // interface then class -interface i2 { +interface i2 { // error foo(): void; } @@ -21,7 +21,7 @@ class i2 { // error } // interface then enum -interface i3 { +interface i3 { // error foo(): void; } enum i3 { One }; // error diff --git a/tests/baselines/reference/augmentedTypesModules.errors.txt b/tests/baselines/reference/augmentedTypesModules.errors.txt index 6975ee37159..980837a18ef 100644 --- a/tests/baselines/reference/augmentedTypesModules.errors.txt +++ b/tests/baselines/reference/augmentedTypesModules.errors.txt @@ -1,29 +1,46 @@ -==== tests/cases/compiler/augmentedTypesModules.ts (6 errors) ==== +tests/cases/compiler/augmentedTypesModules.ts(5,8): error TS2300: Duplicate identifier 'm1a'. +tests/cases/compiler/augmentedTypesModules.ts(6,5): error TS2300: Duplicate identifier 'm1a'. +tests/cases/compiler/augmentedTypesModules.ts(8,8): error TS2300: Duplicate identifier 'm1b'. +tests/cases/compiler/augmentedTypesModules.ts(9,5): error TS2300: Duplicate identifier 'm1b'. +tests/cases/compiler/augmentedTypesModules.ts(16,8): error TS2300: Duplicate identifier 'm1d'. +tests/cases/compiler/augmentedTypesModules.ts(19,5): error TS2300: Duplicate identifier 'm1d'. +tests/cases/compiler/augmentedTypesModules.ts(25,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/augmentedTypesModules.ts(28,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged + + +==== tests/cases/compiler/augmentedTypesModules.ts (9 errors) ==== // module then var module m1 { } var m1 = 1; // Should be allowed - module m1a { var y = 2; } - var m1a = 1; + module m1a { var y = 2; } // error + ~~~ +!!! error TS2300: Duplicate identifier 'm1a'. + var m1a = 1; // error ~~~ -!!! Duplicate identifier 'm1a'. +!!! error TS2300: Duplicate identifier 'm1a'. - module m1b { export var y = 2; } - var m1b = 1; + module m1b { export var y = 2; } // error + ~~~ +!!! error TS2300: Duplicate identifier 'm1b'. + var m1b = 1; // error ~~~ -!!! Duplicate identifier 'm1b'. +!!! error TS2300: Duplicate identifier 'm1b'. module m1c { export interface I { foo(): void; } } var m1c = 1; // Should be allowed - module m1d { + module m1d { // error + ~~~ +!!! error TS2300: Duplicate identifier 'm1d'. export class I { foo() { } } } var m1d = 1; // error ~~~ -!!! Duplicate identifier 'm1d'. +!!! error TS2300: Duplicate identifier 'm1d'. // module then function module m2 { } @@ -31,12 +48,12 @@ module m2a { var y = 2; } ~~~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged function m2a() { }; // error since the module is instantiated module m2b { export var y = 2; } ~~~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged function m2b() { }; // error since the module is instantiated // should be errors to have function first @@ -61,7 +78,7 @@ module m3a { var y = 2; } ~~~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged class m3a { foo() { } } // error, class isn't ambient or declared before the module class m3b { foo() { } } diff --git a/tests/baselines/reference/augmentedTypesModules.js b/tests/baselines/reference/augmentedTypesModules.js index 5085b1cbda3..0c7967b2227 100644 --- a/tests/baselines/reference/augmentedTypesModules.js +++ b/tests/baselines/reference/augmentedTypesModules.js @@ -3,18 +3,18 @@ module m1 { } var m1 = 1; // Should be allowed -module m1a { var y = 2; } -var m1a = 1; +module m1a { var y = 2; } // error +var m1a = 1; // error -module m1b { export var y = 2; } -var m1b = 1; +module m1b { export var y = 2; } // error +var m1b = 1; // error module m1c { export interface I { foo(): void; } } var m1c = 1; // Should be allowed -module m1d { +module m1d { // error export class I { foo() { } } } var m1d = 1; // error @@ -102,13 +102,13 @@ var m1 = 1; // Should be allowed var m1a; (function (m1a) { var y = 2; -})(m1a || (m1a = {})); -var m1a = 1; +})(m1a || (m1a = {})); // error +var m1a = 1; // error var m1b; (function (m1b) { m1b.y = 2; -})(m1b || (m1b = {})); -var m1b = 1; +})(m1b || (m1b = {})); // error +var m1b = 1; // error var m1c = 1; // Should be allowed var m1d; (function (m1d) { diff --git a/tests/baselines/reference/augmentedTypesModules2.errors.txt b/tests/baselines/reference/augmentedTypesModules2.errors.txt index e25682fa39e..19c87a14913 100644 --- a/tests/baselines/reference/augmentedTypesModules2.errors.txt +++ b/tests/baselines/reference/augmentedTypesModules2.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/augmentedTypesModules2.ts(5,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/augmentedTypesModules2.ts(8,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/augmentedTypesModules2.ts(14,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged + + ==== tests/cases/compiler/augmentedTypesModules2.ts (3 errors) ==== // module then function module m2 { } @@ -5,12 +10,12 @@ module m2a { var y = 2; } ~~~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged function m2a() { }; // error since the module is instantiated module m2b { export var y = 2; } ~~~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged function m2b() { }; // error since the module is instantiated function m2c() { }; @@ -18,7 +23,7 @@ module m2cc { export var y = 2; } ~~~~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged function m2cc() { }; // error to have module first module m2d { } diff --git a/tests/baselines/reference/augmentedTypesModules3.errors.txt b/tests/baselines/reference/augmentedTypesModules3.errors.txt index aa5bc0336a4..e264c74463c 100644 --- a/tests/baselines/reference/augmentedTypesModules3.errors.txt +++ b/tests/baselines/reference/augmentedTypesModules3.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/augmentedTypesModules3.ts(5,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged + + ==== tests/cases/compiler/augmentedTypesModules3.ts (1 errors) ==== //// module then class module m3 { } @@ -5,5 +8,5 @@ module m3a { var y = 2; } ~~~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged class m3a { foo() { } } // error, class isn't ambient or declared before the module \ No newline at end of file diff --git a/tests/baselines/reference/augmentedTypesVar.errors.txt b/tests/baselines/reference/augmentedTypesVar.errors.txt index 6edbb52ec50..24c194d25c3 100644 --- a/tests/baselines/reference/augmentedTypesVar.errors.txt +++ b/tests/baselines/reference/augmentedTypesVar.errors.txt @@ -1,49 +1,76 @@ -==== tests/cases/compiler/augmentedTypesVar.ts (7 errors) ==== +tests/cases/compiler/augmentedTypesVar.ts(6,5): error TS2300: Duplicate identifier 'x2'. +tests/cases/compiler/augmentedTypesVar.ts(7,10): error TS2300: Duplicate identifier 'x2'. +tests/cases/compiler/augmentedTypesVar.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'number', but here has type '() => void'. +tests/cases/compiler/augmentedTypesVar.ts(13,5): error TS2300: Duplicate identifier 'x4'. +tests/cases/compiler/augmentedTypesVar.ts(14,7): error TS2300: Duplicate identifier 'x4'. +tests/cases/compiler/augmentedTypesVar.ts(16,5): error TS2300: Duplicate identifier 'x4a'. +tests/cases/compiler/augmentedTypesVar.ts(17,7): error TS2300: Duplicate identifier 'x4a'. +tests/cases/compiler/augmentedTypesVar.ts(20,5): error TS2300: Duplicate identifier 'x5'. +tests/cases/compiler/augmentedTypesVar.ts(21,6): error TS2300: Duplicate identifier 'x5'. +tests/cases/compiler/augmentedTypesVar.ts(27,5): error TS2300: Duplicate identifier 'x6a'. +tests/cases/compiler/augmentedTypesVar.ts(28,8): error TS2300: Duplicate identifier 'x6a'. +tests/cases/compiler/augmentedTypesVar.ts(30,5): error TS2300: Duplicate identifier 'x6b'. +tests/cases/compiler/augmentedTypesVar.ts(31,8): error TS2300: Duplicate identifier 'x6b'. + + +==== tests/cases/compiler/augmentedTypesVar.ts (13 errors) ==== // var then var var x1 = 1; var x1 = 2; // var then function - var x2 = 1; - function x2() { } // should be an error - ~~ -!!! Duplicate identifier 'x2'. - - var x3 = 1; - var x3 = () => { } // should be an error + var x2 = 1; // error ~~ -!!! Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'number', but here has type '() => void'. +!!! error TS2300: Duplicate identifier 'x2'. + function x2() { } // error + ~~ +!!! error TS2300: Duplicate identifier 'x2'. + + var x3 = 1; + var x3 = () => { } // error + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'number', but here has type '() => void'. // var then class - var x4 = 1; + var x4 = 1; // error + ~~ +!!! error TS2300: Duplicate identifier 'x4'. class x4 { } // error ~~ -!!! Duplicate identifier 'x4'. +!!! error TS2300: Duplicate identifier 'x4'. - var x4a = 1; + var x4a = 1; // error + ~~~ +!!! error TS2300: Duplicate identifier 'x4a'. class x4a { public foo() { } } // error ~~~ -!!! Duplicate identifier 'x4a'. +!!! error TS2300: Duplicate identifier 'x4a'. // var then enum var x5 = 1; + ~~ +!!! error TS2300: Duplicate identifier 'x5'. enum x5 { One } // error ~~ -!!! Duplicate identifier 'x5'. +!!! error TS2300: Duplicate identifier 'x5'. // var then module var x6 = 1; module x6 { } // ok since non-instantiated - var x6a = 1; + var x6a = 1; // error + ~~~ +!!! error TS2300: Duplicate identifier 'x6a'. module x6a { var y = 2; } // error since instantiated ~~~ -!!! Duplicate identifier 'x6a'. +!!! error TS2300: Duplicate identifier 'x6a'. - var x6b = 1; + var x6b = 1; // error + ~~~ +!!! error TS2300: Duplicate identifier 'x6b'. module x6b { export var y = 2; } // error ~~~ -!!! Duplicate identifier 'x6b'. +!!! error TS2300: Duplicate identifier 'x6b'. // var then import, messes with other error reporting //var x7 = 1; diff --git a/tests/baselines/reference/augmentedTypesVar.js b/tests/baselines/reference/augmentedTypesVar.js index ca50b8ab9a9..4735d647056 100644 --- a/tests/baselines/reference/augmentedTypesVar.js +++ b/tests/baselines/reference/augmentedTypesVar.js @@ -4,17 +4,17 @@ var x1 = 1; var x1 = 2; // var then function -var x2 = 1; -function x2() { } // should be an error +var x2 = 1; // error +function x2() { } // error -var x3 = 1; -var x3 = () => { } // should be an error +var x3 = 1; +var x3 = () => { } // error // var then class -var x4 = 1; +var x4 = 1; // error class x4 { } // error -var x4a = 1; +var x4a = 1; // error class x4a { public foo() { } } // error // var then enum @@ -25,10 +25,10 @@ enum x5 { One } // error var x6 = 1; module x6 { } // ok since non-instantiated -var x6a = 1; +var x6a = 1; // error module x6a { var y = 2; } // error since instantiated -var x6b = 1; +var x6b = 1; // error module x6b { export var y = 2; } // error // var then import, messes with other error reporting @@ -41,20 +41,20 @@ module x6b { export var y = 2; } // error var x1 = 1; var x1 = 2; // var then function -var x2 = 1; +var x2 = 1; // error function x2() { -} // should be an error +} // error var x3 = 1; var x3 = function () { -}; // should be an error +}; // error // var then class -var x4 = 1; +var x4 = 1; // error var x4 = (function () { function x4() { } return x4; })(); // error -var x4a = 1; +var x4a = 1; // error var x4a = (function () { function x4a() { } @@ -70,12 +70,12 @@ var x5; })(x5 || (x5 = {})); // error // var then module var x6 = 1; -var x6a = 1; +var x6a = 1; // error var x6a; (function (x6a) { var y = 2; })(x6a || (x6a = {})); // error since instantiated -var x6b = 1; +var x6b = 1; // error var x6b; (function (x6b) { x6b.y = 2; diff --git a/tests/baselines/reference/autoLift2.errors.txt b/tests/baselines/reference/autoLift2.errors.txt index 6f62c8e9e4b..dbe9e98cd63 100644 --- a/tests/baselines/reference/autoLift2.errors.txt +++ b/tests/baselines/reference/autoLift2.errors.txt @@ -1,3 +1,15 @@ +tests/cases/compiler/autoLift2.ts(5,17): error TS1005: ';' expected. +tests/cases/compiler/autoLift2.ts(6,17): error TS1005: ';' expected. +tests/cases/compiler/autoLift2.ts(5,14): error TS2339: Property 'foo' does not exist on type 'A'. +tests/cases/compiler/autoLift2.ts(5,19): error TS2304: Cannot find name 'any'. +tests/cases/compiler/autoLift2.ts(6,14): error TS2339: Property 'bar' does not exist on type 'A'. +tests/cases/compiler/autoLift2.ts(6,19): error TS2304: Cannot find name 'any'. +tests/cases/compiler/autoLift2.ts(12,11): error TS2339: Property 'foo' does not exist on type 'A'. +tests/cases/compiler/autoLift2.ts(14,11): error TS2339: Property 'bar' does not exist on type 'A'. +tests/cases/compiler/autoLift2.ts(16,33): error TS2339: Property 'foo' does not exist on type 'A'. +tests/cases/compiler/autoLift2.ts(18,33): error TS2339: Property 'bar' does not exist on type 'A'. + + ==== tests/cases/compiler/autoLift2.ts (10 errors) ==== class A @@ -5,18 +17,18 @@ constructor() { this.foo: any; ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~ -!!! Property 'foo' does not exist on type 'A'. +!!! error TS2339: Property 'foo' does not exist on type 'A'. ~~~ -!!! Cannot find name 'any'. +!!! error TS2304: Cannot find name 'any'. this.bar: any; ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~ -!!! Property 'bar' does not exist on type 'A'. +!!! error TS2339: Property 'bar' does not exist on type 'A'. ~~~ -!!! Cannot find name 'any'. +!!! error TS2304: Cannot find name 'any'. } @@ -24,19 +36,19 @@ this.foo = "foo"; ~~~ -!!! Property 'foo' does not exist on type 'A'. +!!! error TS2339: Property 'foo' does not exist on type 'A'. this.bar = "bar"; ~~~ -!!! Property 'bar' does not exist on type 'A'. +!!! error TS2339: Property 'bar' does not exist on type 'A'. [1, 2].forEach((p) => this.foo); ~~~ -!!! Property 'foo' does not exist on type 'A'. +!!! error TS2339: Property 'foo' does not exist on type 'A'. [1, 2].forEach((p) => this.bar); ~~~ -!!! Property 'bar' does not exist on type 'A'. +!!! error TS2339: Property 'bar' does not exist on type 'A'. } diff --git a/tests/baselines/reference/autolift3.errors.txt b/tests/baselines/reference/autolift3.errors.txt index a73368620f5..384ad498661 100644 --- a/tests/baselines/reference/autolift3.errors.txt +++ b/tests/baselines/reference/autolift3.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/autolift3.ts(26,3): error TS2339: Property 'foo' does not exist on type 'B'. + + ==== tests/cases/compiler/autolift3.ts (1 errors) ==== class B { @@ -26,7 +29,7 @@ b.foo(); ~~~ -!!! Property 'foo' does not exist on type 'B'. +!!! error TS2339: Property 'foo' does not exist on type 'B'. diff --git a/tests/baselines/reference/autolift4.errors.txt b/tests/baselines/reference/autolift4.errors.txt index 9469d976c59..b548479b692 100644 --- a/tests/baselines/reference/autolift4.errors.txt +++ b/tests/baselines/reference/autolift4.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/autolift4.ts(19,70): error TS2339: Property 'm' does not exist on type 'Point3D'. + + ==== tests/cases/compiler/autolift4.ts (1 errors) ==== class Point { @@ -19,7 +22,7 @@ getDist() { return Math.sqrt(this.x*this.x + this.y*this.y + this.z*this.m); ~ -!!! Property 'm' does not exist on type 'Point3D'. +!!! error TS2339: Property 'm' does not exist on type 'Point3D'. } } diff --git a/tests/baselines/reference/badArrayIndex.errors.txt b/tests/baselines/reference/badArrayIndex.errors.txt index 71228c95e21..818870f6c26 100644 --- a/tests/baselines/reference/badArrayIndex.errors.txt +++ b/tests/baselines/reference/badArrayIndex.errors.txt @@ -1,6 +1,10 @@ +tests/cases/compiler/badArrayIndex.ts(1,22): error TS1109: Expression expected. +tests/cases/compiler/badArrayIndex.ts(1,15): error TS2304: Cannot find name 'number'. + + ==== tests/cases/compiler/badArrayIndex.ts (2 errors) ==== var results = number[]; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~~ -!!! Cannot find name 'number'. \ No newline at end of file +!!! error TS2304: Cannot find name 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/badArraySyntax.errors.txt b/tests/baselines/reference/badArraySyntax.errors.txt index 9c1edf93231..8c9bd45fba1 100644 --- a/tests/baselines/reference/badArraySyntax.errors.txt +++ b/tests/baselines/reference/badArraySyntax.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/badArraySyntax.ts(6,15): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/badArraySyntax.ts(7,15): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/badArraySyntax.ts(8,20): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/badArraySyntax.ts(9,20): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/badArraySyntax.ts(10,29): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/badArraySyntax.ts(10,40): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. + + ==== tests/cases/compiler/badArraySyntax.ts (6 errors) ==== class Z { public x = ""; @@ -6,19 +14,19 @@ var a1: Z[] = []; var a2 = new Z[]; ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var a3 = new Z[](); ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var a4: Z[] = new Z[]; ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var a5: Z[] = new Z[](); ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var a6: Z[][] = new Z [ ] [ ]; ~~~~~~~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. \ No newline at end of file diff --git a/tests/baselines/reference/badExternalModuleReference.errors.txt b/tests/baselines/reference/badExternalModuleReference.errors.txt index 392336db379..96ac4224222 100644 --- a/tests/baselines/reference/badExternalModuleReference.errors.txt +++ b/tests/baselines/reference/badExternalModuleReference.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/badExternalModuleReference.ts(1,21): error TS2307: Cannot find external module 'garbage'. + + ==== tests/cases/compiler/badExternalModuleReference.ts (1 errors) ==== import a1 = require("garbage"); ~~~~~~~~~ -!!! Cannot find external module 'garbage'. +!!! error TS2307: Cannot find external module 'garbage'. export declare var a: { test1: a1.connectModule; (): a1.connectExport; diff --git a/tests/baselines/reference/badOverloadError.types b/tests/baselines/reference/badOverloadError.types index 837eb5c5c83..ba9d6e76c1c 100644 --- a/tests/baselines/reference/badOverloadError.types +++ b/tests/baselines/reference/badOverloadError.types @@ -6,6 +6,6 @@ function method() { >dictionary : { [x: string]: string; } ><{ [index: string]: string; }>{} : { [x: string]: string; } >index : string ->{} : { [x: string]: string; } +>{} : { [x: string]: undefined; } } diff --git a/tests/baselines/reference/baseCheck.errors.txt b/tests/baselines/reference/baseCheck.errors.txt index a09491ac455..f52ba4b3dbd 100644 --- a/tests/baselines/reference/baseCheck.errors.txt +++ b/tests/baselines/reference/baseCheck.errors.txt @@ -1,3 +1,14 @@ +tests/cases/compiler/baseCheck.ts(9,18): error TS2304: Cannot find name 'loc'. +tests/cases/compiler/baseCheck.ts(17,53): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/baseCheck.ts(17,59): error TS2332: 'this' cannot be referenced in current location. +tests/cases/compiler/baseCheck.ts(18,62): error TS2332: 'this' cannot be referenced in current location. +tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/compiler/baseCheck.ts(19,68): error TS2332: 'this' cannot be referenced in current location. +tests/cases/compiler/baseCheck.ts(22,9): error TS2304: Cannot find name 'x'. +tests/cases/compiler/baseCheck.ts(23,7): error TS2304: Cannot find name 'x'. +tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'. + + ==== tests/cases/compiler/baseCheck.ts (9 errors) ==== class C { constructor(x: number, y: number) { } } class ELoc extends C { @@ -9,7 +20,7 @@ constructor(x: number) { super(0, loc); ~~~ -!!! Cannot find name 'loc'. +!!! error TS2304: Cannot find name 'loc'. } m() { @@ -19,30 +30,30 @@ class D extends C { constructor(public z: number) { super(this.z) } } // too few params ~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. ~~~~ -!!! 'this' cannot be referenced in current location. +!!! error TS2332: 'this' cannot be referenced in current location. class E extends C { constructor(public z: number) { super(0, this.z) } } ~~~~ -!!! 'this' cannot be referenced in current location. +!!! error TS2332: 'this' cannot be referenced in current location. class F extends C { constructor(public z: number) { super("hello", this.z) } } // first param type ~~~~~~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ~~~~ -!!! 'this' cannot be referenced in current location. +!!! error TS2332: 'this' cannot be referenced in current location. function f() { if (x<10) { ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. x=11; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. } else { x=12; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. } } \ No newline at end of file diff --git a/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt b/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt index eb083f30f3c..f55bca8e0e2 100644 --- a/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt +++ b/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y': + Named properties 'm' of types 'X' and 'Y' are not identical. + + ==== tests/cases/compiler/baseTypePrivateMemberClash.ts (1 errors) ==== class X { private m: number; @@ -8,5 +12,5 @@ interface Z extends X, Y { } ~ -!!! Interface 'Z' cannot simultaneously extend types 'X' and 'Y': -!!! Named properties 'm' of types 'X' and 'Y' are not identical. \ No newline at end of file +!!! error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y': +!!! error TS2320: Named properties 'm' of types 'X' and 'Y' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/bases.errors.txt b/tests/baselines/reference/bases.errors.txt index f4dc4ab5c8f..a4a04af142d 100644 --- a/tests/baselines/reference/bases.errors.txt +++ b/tests/baselines/reference/bases.errors.txt @@ -1,3 +1,16 @@ +tests/cases/compiler/bases.ts(7,15): error TS1005: ';' expected. +tests/cases/compiler/bases.ts(13,15): error TS1005: ';' expected. +tests/cases/compiler/bases.ts(7,14): error TS2339: Property 'y' does not exist on type 'B'. +tests/cases/compiler/bases.ts(7,17): error TS2304: Cannot find name 'any'. +tests/cases/compiler/bases.ts(11,7): error TS2421: Class 'C' incorrectly implements interface 'I': + Property 'x' is missing in type 'C'. +tests/cases/compiler/bases.ts(12,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/bases.ts(13,14): error TS2339: Property 'x' does not exist on type 'C'. +tests/cases/compiler/bases.ts(13,17): error TS2304: Cannot find name 'any'. +tests/cases/compiler/bases.ts(17,9): error TS2339: Property 'x' does not exist on type 'C'. +tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist on type 'C'. + + ==== tests/cases/compiler/bases.ts (10 errors) ==== interface I { x; @@ -7,38 +20,38 @@ constructor() { this.y: any; ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Property 'y' does not exist on type 'B'. +!!! error TS2339: Property 'y' does not exist on type 'B'. ~~~ -!!! Cannot find name 'any'. +!!! error TS2304: Cannot find name 'any'. } } class C extends B implements I { ~ -!!! Class 'C' incorrectly implements interface 'I': -!!! Property 'x' is missing in type 'C'. +!!! error TS2421: Class 'C' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is missing in type 'C'. constructor() { ~~~~~~~~~~~~~~~ this.x: any; ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~~~~~~~~~~~~~~~ ~ -!!! Property 'x' does not exist on type 'C'. +!!! error TS2339: Property 'x' does not exist on type 'C'. ~~~ -!!! Cannot find name 'any'. +!!! error TS2304: Cannot find name 'any'. } ~~~~~ -!!! Constructors for derived classes must contain a 'super' call. +!!! error TS2377: Constructors for derived classes must contain a 'super' call. } new C().x; ~ -!!! Property 'x' does not exist on type 'C'. +!!! error TS2339: Property 'x' does not exist on type 'C'. new C().y; ~ -!!! Property 'y' does not exist on type 'C'. +!!! error TS2339: Property 'y' does not exist on type 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types index 3deeae69bbe..2c3ba8bc7c7 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types @@ -54,8 +54,8 @@ var r4 = true ? a : b; // typeof a >b : { x: number; z?: number; } var r5 = true ? b : a; // typeof b ->r5 : { x: number; z?: number; } ->true ? b : a : { x: number; z?: number; } +>r5 : { x: number; y?: number; } +>true ? b : a : { x: number; y?: number; } >b : { x: number; z?: number; } >a : { x: number; y?: number; } @@ -72,7 +72,7 @@ var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { }; >r7 : (x: Object) => void >x : Object >Object : Object ->true ? (x: number) => { } : (x: Object) => { } : (x: Object) => void +>true ? (x: number) => { } : (x: Object) => { } : (x: number) => void >(x: number) => { } : (x: number) => void >x : number >(x: Object) => { } : (x: Object) => void @@ -91,7 +91,7 @@ var r8 = true ? (x: Object) => { } : (x: number) => { }; // returns Object => vo var r10: Base = true ? derived : derived2; // no error since we use the contextual type in BCT >r10 : Base >Base : Base ->true ? derived : derived2 : Base +>true ? derived : derived2 : Derived | Derived2 >derived : Derived >derived2 : Derived2 @@ -112,7 +112,7 @@ function foo5(t: T, u: U): Object { >Object : Object return true ? t : u; // BCT is Object ->true ? t : u : Object +>true ? t : u : T | U >t : T >u : U } diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.errors.txt b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.errors.txt index 9d86da98f3f..83f4678c8f3 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.errors.txt +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.errors.txt @@ -1,4 +1,9 @@ -==== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts (8 errors) ==== +tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts(18,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts(22,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts(22,28): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + +==== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts (3 errors) ==== // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // these are errors @@ -10,32 +15,22 @@ var derived2: Derived2; var r2 = true ? 1 : ''; - ~~~~~~~~~~~~~ -!!! No best common type exists between 'number' and 'string'. var r9 = true ? derived : derived2; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! No best common type exists between 'Derived' and 'Derived2'. function foo(t: T, u: U) { return true ? t : u; - ~~~~~~~~~~~~ -!!! No best common type exists between 'T' and 'U'. } function foo2(t: T, u: U) { // Error for referencing own type parameter ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. return true ? t : u; // Ok because BCT(T, U) = U - ~~~~~~~~~~~~ -!!! No best common type exists between 'T' and 'U'. } function foo3(t: T, u: U) { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. return true ? t : u; - ~~~~~~~~~~~~ -!!! No best common type exists between 'T' and 'U'. } \ No newline at end of file diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.js b/tests/baselines/reference/bestCommonTypeOfTuple.js new file mode 100644 index 00000000000..752523317b5 --- /dev/null +++ b/tests/baselines/reference/bestCommonTypeOfTuple.js @@ -0,0 +1,58 @@ +//// [bestCommonTypeOfTuple.ts] +function f1(x: number): string { return "foo"; } + +function f2(x: number): number { return 10; } + +function f3(x: number): boolean { return true; } + +enum E1 { one } + +enum E2 { two } + + +var t1: [(x: number) => string, (x: number) => number]; +var t2: [E1, E2]; +var t3: [number, any]; +var t4: [E1, E2, number]; + +// no error +t1 = [f1, f2]; +t2 = [E1.one, E2.two]; +t3 = [5, undefined]; +t4 = [E1.one, E2.two, 20]; +var e1 = t1[2]; // {} +var e2 = t2[2]; // {} +var e3 = t3[2]; // any +var e4 = t4[3]; // number + +//// [bestCommonTypeOfTuple.js] +function f1(x) { + return "foo"; +} +function f2(x) { + return 10; +} +function f3(x) { + return true; +} +var E1; +(function (E1) { + E1[E1["one"] = 0] = "one"; +})(E1 || (E1 = {})); +var E2; +(function (E2) { + E2[E2["two"] = 0] = "two"; +})(E2 || (E2 = {})); +var t1; +var t2; +var t3; +var t4; +// no error +t1 = [f1, f2]; +t2 = [0 /* one */, 0 /* two */]; +t3 = [5, undefined]; +t4 = [0 /* one */, 0 /* two */, 20]; +var e1 = t1[2]; // {} +var e2 = t2[2]; // {} +var e3 = t3[2]; // any +var e4 = t4[3]; // number diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.types b/tests/baselines/reference/bestCommonTypeOfTuple.types new file mode 100644 index 00000000000..87624c267aa --- /dev/null +++ b/tests/baselines/reference/bestCommonTypeOfTuple.types @@ -0,0 +1,96 @@ +=== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts === +function f1(x: number): string { return "foo"; } +>f1 : (x: number) => string +>x : number + +function f2(x: number): number { return 10; } +>f2 : (x: number) => number +>x : number + +function f3(x: number): boolean { return true; } +>f3 : (x: number) => boolean +>x : number + +enum E1 { one } +>E1 : E1 +>one : E1 + +enum E2 { two } +>E2 : E2 +>two : E2 + + +var t1: [(x: number) => string, (x: number) => number]; +>t1 : [(x: number) => string, (x: number) => number] +>x : number +>x : number + +var t2: [E1, E2]; +>t2 : [E1, E2] +>E1 : E1 +>E2 : E2 + +var t3: [number, any]; +>t3 : [number, any] + +var t4: [E1, E2, number]; +>t4 : [E1, E2, number] +>E1 : E1 +>E2 : E2 + +// no error +t1 = [f1, f2]; +>t1 = [f1, f2] : [(x: number) => string, (x: number) => number] +>t1 : [(x: number) => string, (x: number) => number] +>[f1, f2] : [(x: number) => string, (x: number) => number] +>f1 : (x: number) => string +>f2 : (x: number) => number + +t2 = [E1.one, E2.two]; +>t2 = [E1.one, E2.two] : [E1, E2] +>t2 : [E1, E2] +>[E1.one, E2.two] : [E1, E2] +>E1.one : E1 +>E1 : typeof E1 +>one : E1 +>E2.two : E2 +>E2 : typeof E2 +>two : E2 + +t3 = [5, undefined]; +>t3 = [5, undefined] : [number, undefined] +>t3 : [number, any] +>[5, undefined] : [number, undefined] +>undefined : undefined + +t4 = [E1.one, E2.two, 20]; +>t4 = [E1.one, E2.two, 20] : [E1, E2, number] +>t4 : [E1, E2, number] +>[E1.one, E2.two, 20] : [E1, E2, number] +>E1.one : E1 +>E1 : typeof E1 +>one : E1 +>E2.two : E2 +>E2 : typeof E2 +>two : E2 + +var e1 = t1[2]; // {} +>e1 : { (x: number): string; } | { (x: number): number; } +>t1[2] : { (x: number): string; } | { (x: number): number; } +>t1 : [(x: number) => string, (x: number) => number] + +var e2 = t2[2]; // {} +>e2 : E1 | E2 +>t2[2] : E1 | E2 +>t2 : [E1, E2] + +var e3 = t3[2]; // any +>e3 : any +>t3[2] : any +>t3 : [number, any] + +var e4 = t4[3]; // number +>e4 : number +>t4[3] : number +>t4 : [E1, E2, number] + diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js new file mode 100644 index 00000000000..f9183f41348 --- /dev/null +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -0,0 +1,77 @@ +//// [bestCommonTypeOfTuple2.ts] +interface base { } +interface base1 { i } +class C implements base { c } +class D implements base { d } +class E implements base { e } +class F extends C { f } + +class C1 implements base1 { i = "foo"; c } +class D1 extends C1 { i = "bar"; d } + +var t1: [C, base]; +var t2: [C, D]; +var t3: [C1, D1]; +var t4: [base1, C1]; +var t5: [C1, F] + +var e11 = t1[4]; // base +var e21 = t2[4]; // {} +var e31 = t3[4]; // C1 +var e41 = t4[2]; // base1 +var e51 = t5[2]; // {} + + +//// [bestCommonTypeOfTuple2.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + } + return C; +})(); +var D = (function () { + function D() { + } + return D; +})(); +var E = (function () { + function E() { + } + return E; +})(); +var F = (function (_super) { + __extends(F, _super); + function F() { + _super.apply(this, arguments); + } + return F; +})(C); +var C1 = (function () { + function C1() { + this.i = "foo"; + } + return C1; +})(); +var D1 = (function (_super) { + __extends(D1, _super); + function D1() { + _super.apply(this, arguments); + this.i = "bar"; + } + return D1; +})(C1); +var t1; +var t2; +var t3; +var t4; +var t5; +var e11 = t1[4]; // base +var e21 = t2[4]; // {} +var e31 = t3[4]; // C1 +var e41 = t4[2]; // base1 +var e51 = t5[2]; // {} diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.types b/tests/baselines/reference/bestCommonTypeOfTuple2.types new file mode 100644 index 00000000000..a87407e98fc --- /dev/null +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.types @@ -0,0 +1,90 @@ +=== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple2.ts === +interface base { } +>base : base + +interface base1 { i } +>base1 : base1 +>i : any + +class C implements base { c } +>C : C +>base : base +>c : any + +class D implements base { d } +>D : D +>base : base +>d : any + +class E implements base { e } +>E : E +>base : base +>e : any + +class F extends C { f } +>F : F +>C : C +>f : any + +class C1 implements base1 { i = "foo"; c } +>C1 : C1 +>base1 : base1 +>i : string +>c : any + +class D1 extends C1 { i = "bar"; d } +>D1 : D1 +>C1 : C1 +>i : string +>d : any + +var t1: [C, base]; +>t1 : [C, base] +>C : C +>base : base + +var t2: [C, D]; +>t2 : [C, D] +>C : C +>D : D + +var t3: [C1, D1]; +>t3 : [C1, D1] +>C1 : C1 +>D1 : D1 + +var t4: [base1, C1]; +>t4 : [base1, C1] +>base1 : base1 +>C1 : C1 + +var t5: [C1, F] +>t5 : [C1, F] +>C1 : C1 +>F : F + +var e11 = t1[4]; // base +>e11 : base +>t1[4] : base +>t1 : [C, base] + +var e21 = t2[4]; // {} +>e21 : C | D +>t2[4] : C | D +>t2 : [C, D] + +var e31 = t3[4]; // C1 +>e31 : C1 +>t3[4] : C1 +>t3 : [C1, D1] + +var e41 = t4[2]; // base1 +>e41 : base1 +>t4[2] : base1 +>t4 : [base1, C1] + +var e51 = t5[2]; // {} +>e51 : F | C1 +>t5[2] : F | C1 +>t5 : [C1, F] + diff --git a/tests/baselines/reference/binaryArithmatic3.errors.txt b/tests/baselines/reference/binaryArithmatic3.errors.txt index 74f3662aad7..6dffe5e150c 100644 --- a/tests/baselines/reference/binaryArithmatic3.errors.txt +++ b/tests/baselines/reference/binaryArithmatic3.errors.txt @@ -1,6 +1,10 @@ +tests/cases/compiler/binaryArithmatic3.ts(1,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/binaryArithmatic3.ts(1,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/compiler/binaryArithmatic3.ts (2 errors) ==== var v = undefined | undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/binaryArithmatic4.errors.txt b/tests/baselines/reference/binaryArithmatic4.errors.txt index 87200bec116..f72c23073ca 100644 --- a/tests/baselines/reference/binaryArithmatic4.errors.txt +++ b/tests/baselines/reference/binaryArithmatic4.errors.txt @@ -1,6 +1,10 @@ +tests/cases/compiler/binaryArithmatic4.ts(1,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/binaryArithmatic4.ts(1,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/compiler/binaryArithmatic4.ts (2 errors) ==== var v = null | null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/bind1.errors.txt b/tests/baselines/reference/bind1.errors.txt index 0f883d94f52..3d50d18b1bc 100644 --- a/tests/baselines/reference/bind1.errors.txt +++ b/tests/baselines/reference/bind1.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/bind1.ts(2,31): error TS2304: Cannot find name 'I'. + + ==== tests/cases/compiler/bind1.ts (1 errors) ==== module M { export class C implements I {} // this should be an unresolved symbol I error ~ -!!! Cannot find name 'I'. +!!! error TS2304: Cannot find name 'I'. } \ No newline at end of file diff --git a/tests/baselines/reference/bitwiseCompoundAssignmentOperators.errors.txt b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.errors.txt new file mode 100644 index 00000000000..ae7a8fdce0a --- /dev/null +++ b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.errors.txt @@ -0,0 +1,59 @@ +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(3,1): error TS2447: The '^=' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(9,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(14,1): error TS2447: The '&=' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(20,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(24,1): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(28,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts (8 errors) ==== + var a = true; + var b = 1; + a ^= a; + ~~~~~~ +!!! error TS2447: The '^=' operator is not allowed for boolean types. Consider using '!==' instead. + a = true; + b ^= b; + b = 1; + a ^= b; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + a = true; + b ^= a; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + b = 1; + + var c = false; + var d = 2; + c &= c; + ~~~~~~ +!!! error TS2447: The '&=' operator is not allowed for boolean types. Consider using '&&' instead. + c = false; + d &= d; + d = 2; + c &= d; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + c = false; + d &= c; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var e = true; + var f = 0; + e |= e; + ~~~~~~ +!!! error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. + e = true; + f |= f; + f = 0; + e |= f; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + e = true; + f |= f; + + \ No newline at end of file diff --git a/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js new file mode 100644 index 00000000000..c148fc0142c --- /dev/null +++ b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js @@ -0,0 +1,63 @@ +//// [bitwiseCompoundAssignmentOperators.ts] +var a = true; +var b = 1; +a ^= a; +a = true; +b ^= b; +b = 1; +a ^= b; +a = true; +b ^= a; +b = 1; + +var c = false; +var d = 2; +c &= c; +c = false; +d &= d; +d = 2; +c &= d; +c = false; +d &= c; + +var e = true; +var f = 0; +e |= e; +e = true; +f |= f; +f = 0; +e |= f; +e = true; +f |= f; + + + +//// [bitwiseCompoundAssignmentOperators.js] +var a = true; +var b = 1; +a ^= a; +a = true; +b ^= b; +b = 1; +a ^= b; +a = true; +b ^= a; +b = 1; +var c = false; +var d = 2; +c &= c; +c = false; +d &= d; +d = 2; +c &= d; +c = false; +d &= c; +var e = true; +var f = 0; +e |= e; +e = true; +f |= f; +f = 0; +e |= f; +e = true; +f |= f; diff --git a/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.errors.txt b/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.errors.txt index 8ec2f4e0407..d730ef41fd8 100644 --- a/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorInvalidOperations.ts(5,10): error TS1005: ',' expected. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorInvalidOperations.ts(5,11): error TS1109: Expression expected. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorInvalidOperations.ts(8,27): error TS1134: Variable declaration expected. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorInvalidOperations.ts(11,9): error TS1109: Expression expected. + + ==== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorInvalidOperations.ts (4 errors) ==== // Unary operator ~ var q; @@ -5,16 +11,16 @@ // operand before ~ var a = q~; //expect error ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. // multiple operands after ~ var mul = ~[1, 2, "abc"], ""; //expect error ~~ -!!! Variable declaration expected. +!!! error TS1134: Variable declaration expected. // miss an operand var b =~; ~ -!!! Expression expected. \ No newline at end of file +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt index 3513093d9f4..fe91cc8a339 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(46,26): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(47,26): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(48,26): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + + ==== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts (3 errors) ==== // ~ operator on any type @@ -46,13 +51,13 @@ var ResultIsNumber15 = ~(ANY + ANY1); var ResultIsNumber16 = ~(null + undefined); ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsNumber17 = ~(null + null); ~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var ResultIsNumber18 = ~(undefined + undefined); ~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. // multiple ~ operators var ResultIsNumber19 = ~~ANY; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js index e38520ef71a..9cd5a63912e 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js @@ -1,40 +1,40 @@ //// [bitwiseNotOperatorWithEnumType.ts] // ~ operator on enum type -enum ENUM1 { 1, 2, "" }; +enum ENUM1 { A, B, "" }; // enum type var var ResultIsNumber1 = ~ENUM1; // enum type expressions -var ResultIsNumber2 = ~ENUM1[1]; -var ResultIsNumber3 = ~(ENUM1[1] + ENUM1[2]); +var ResultIsNumber2 = ~ENUM1["A"]; +var ResultIsNumber3 = ~(ENUM1.A + ENUM1["B"]); // multiple ~ operators -var ResultIsNumber4 = ~~~(ENUM1[1] + ENUM1[2]); +var ResultIsNumber4 = ~~~(ENUM1["A"] + ENUM1.B); // miss assignment operators ~ENUM1; -~ENUM1[1]; -~ENUM1[1], ~ENUM1[2]; +~ENUM1["A"]; +~ENUM1.A, ~ENUM1["B"]; //// [bitwiseNotOperatorWithEnumType.js] // ~ operator on enum type var ENUM1; (function (ENUM1) { - ENUM1[ENUM1["1"] = 0] = "1"; - ENUM1[ENUM1["2"] = 1] = "2"; + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = {})); ; // enum type var var ResultIsNumber1 = ~ENUM1; // enum type expressions -var ResultIsNumber2 = ~ENUM1[1]; -var ResultIsNumber3 = ~(ENUM1[1] + ENUM1[2]); +var ResultIsNumber2 = ~ENUM1["A"]; +var ResultIsNumber3 = ~(0 /* A */ + ENUM1["B"]); // multiple ~ operators -var ResultIsNumber4 = ~~~(ENUM1[1] + ENUM1[2]); +var ResultIsNumber4 = ~~~(ENUM1["A"] + 1 /* B */); // miss assignment operators ~ENUM1; -~ENUM1[1]; -~ENUM1[1], ~ENUM1[2]; +~ENUM1["A"]; +~0 /* A */, ~ENUM1["B"]; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types index 077b8fdd4d6..71598c6f693 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types +++ b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types @@ -1,8 +1,10 @@ === tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType.ts === // ~ operator on enum type -enum ENUM1 { 1, 2, "" }; +enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 +>A : ENUM1 +>B : ENUM1 // enum type var var ResultIsNumber1 = ~ENUM1; @@ -11,51 +13,54 @@ var ResultIsNumber1 = ~ENUM1; >ENUM1 : typeof ENUM1 // enum type expressions -var ResultIsNumber2 = ~ENUM1[1]; +var ResultIsNumber2 = ~ENUM1["A"]; >ResultIsNumber2 : number ->~ENUM1[1] : number ->ENUM1[1] : ENUM1 +>~ENUM1["A"] : number +>ENUM1["A"] : ENUM1 >ENUM1 : typeof ENUM1 -var ResultIsNumber3 = ~(ENUM1[1] + ENUM1[2]); +var ResultIsNumber3 = ~(ENUM1.A + ENUM1["B"]); >ResultIsNumber3 : number ->~(ENUM1[1] + ENUM1[2]) : number ->(ENUM1[1] + ENUM1[2]) : number ->ENUM1[1] + ENUM1[2] : number ->ENUM1[1] : ENUM1 +>~(ENUM1.A + ENUM1["B"]) : number +>(ENUM1.A + ENUM1["B"]) : number +>ENUM1.A + ENUM1["B"] : number +>ENUM1.A : ENUM1 >ENUM1 : typeof ENUM1 ->ENUM1[2] : ENUM1 +>A : ENUM1 +>ENUM1["B"] : ENUM1 >ENUM1 : typeof ENUM1 // multiple ~ operators -var ResultIsNumber4 = ~~~(ENUM1[1] + ENUM1[2]); +var ResultIsNumber4 = ~~~(ENUM1["A"] + ENUM1.B); >ResultIsNumber4 : number ->~~~(ENUM1[1] + ENUM1[2]) : number ->~~(ENUM1[1] + ENUM1[2]) : number ->~(ENUM1[1] + ENUM1[2]) : number ->(ENUM1[1] + ENUM1[2]) : number ->ENUM1[1] + ENUM1[2] : number ->ENUM1[1] : ENUM1 +>~~~(ENUM1["A"] + ENUM1.B) : number +>~~(ENUM1["A"] + ENUM1.B) : number +>~(ENUM1["A"] + ENUM1.B) : number +>(ENUM1["A"] + ENUM1.B) : number +>ENUM1["A"] + ENUM1.B : number +>ENUM1["A"] : ENUM1 >ENUM1 : typeof ENUM1 ->ENUM1[2] : ENUM1 +>ENUM1.B : ENUM1 >ENUM1 : typeof ENUM1 +>B : ENUM1 // miss assignment operators ~ENUM1; >~ENUM1 : number >ENUM1 : typeof ENUM1 -~ENUM1[1]; ->~ENUM1[1] : number ->ENUM1[1] : ENUM1 +~ENUM1["A"]; +>~ENUM1["A"] : number +>ENUM1["A"] : ENUM1 >ENUM1 : typeof ENUM1 -~ENUM1[1], ~ENUM1[2]; ->~ENUM1[1], ~ENUM1[2] : number ->~ENUM1[1] : number ->ENUM1[1] : ENUM1 +~ENUM1.A, ~ENUM1["B"]; +>~ENUM1.A, ~ENUM1["B"] : number +>~ENUM1.A : number +>ENUM1.A : ENUM1 >ENUM1 : typeof ENUM1 ->~ENUM1[2] : number ->ENUM1[2] : ENUM1 +>A : ENUM1 +>~ENUM1["B"] : number +>ENUM1["B"] : ENUM1 >ENUM1 : typeof ENUM1 diff --git a/tests/baselines/reference/boolInsteadOfBoolean.errors.txt b/tests/baselines/reference/boolInsteadOfBoolean.errors.txt index 611d98995d8..13141b6235b 100644 --- a/tests/baselines/reference/boolInsteadOfBoolean.errors.txt +++ b/tests/baselines/reference/boolInsteadOfBoolean.errors.txt @@ -1,6 +1,9 @@ +tests/cases/conformance/types/primitives/boolean/boolInsteadOfBoolean.ts(1,8): error TS2304: Cannot find name 'bool'. + + ==== tests/cases/conformance/types/primitives/boolean/boolInsteadOfBoolean.ts (1 errors) ==== var x: bool; ~~~~ -!!! Cannot find name 'bool'. +!!! error TS2304: Cannot find name 'bool'. var a: boolean = x; x = a; \ No newline at end of file diff --git a/tests/baselines/reference/breakInIterationOrSwitchStatement4.errors.txt b/tests/baselines/reference/breakInIterationOrSwitchStatement4.errors.txt index 667108c902d..c331ff09c2c 100644 --- a/tests/baselines/reference/breakInIterationOrSwitchStatement4.errors.txt +++ b/tests/baselines/reference/breakInIterationOrSwitchStatement4.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/breakInIterationOrSwitchStatement4.ts(1,15): error TS2304: Cannot find name 'something'. + + ==== tests/cases/compiler/breakInIterationOrSwitchStatement4.ts (1 errors) ==== for (var i in something) { ~~~~~~~~~ -!!! Cannot find name 'something'. +!!! error TS2304: Cannot find name 'something'. break; } \ No newline at end of file diff --git a/tests/baselines/reference/breakNotInIterationOrSwitchStatement1.errors.txt b/tests/baselines/reference/breakNotInIterationOrSwitchStatement1.errors.txt index 6220fd09e9d..28a762f3d09 100644 --- a/tests/baselines/reference/breakNotInIterationOrSwitchStatement1.errors.txt +++ b/tests/baselines/reference/breakNotInIterationOrSwitchStatement1.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/breakNotInIterationOrSwitchStatement1.ts(1,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. + + ==== tests/cases/compiler/breakNotInIterationOrSwitchStatement1.ts (1 errors) ==== break; ~~~~~~ -!!! A 'break' statement can only be used within an enclosing iteration or switch statement. \ No newline at end of file +!!! error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. \ No newline at end of file diff --git a/tests/baselines/reference/breakNotInIterationOrSwitchStatement2.errors.txt b/tests/baselines/reference/breakNotInIterationOrSwitchStatement2.errors.txt index e34345f8e8c..d77fb4bc05b 100644 --- a/tests/baselines/reference/breakNotInIterationOrSwitchStatement2.errors.txt +++ b/tests/baselines/reference/breakNotInIterationOrSwitchStatement2.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/breakNotInIterationOrSwitchStatement2.ts(3,5): error TS1107: Jump target cannot cross function boundary. + + ==== tests/cases/compiler/breakNotInIterationOrSwitchStatement2.ts (1 errors) ==== while (true) { function f() { break; ~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } \ No newline at end of file diff --git a/tests/baselines/reference/breakTarget5.errors.txt b/tests/baselines/reference/breakTarget5.errors.txt index a9b3932bcbb..a54a415b990 100644 --- a/tests/baselines/reference/breakTarget5.errors.txt +++ b/tests/baselines/reference/breakTarget5.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/breakTarget5.ts(5,7): error TS1107: Jump target cannot cross function boundary. + + ==== tests/cases/compiler/breakTarget5.ts (1 errors) ==== target: while (true) { @@ -5,7 +8,7 @@ while (true) { break target; ~~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } } \ No newline at end of file diff --git a/tests/baselines/reference/breakTarget6.errors.txt b/tests/baselines/reference/breakTarget6.errors.txt index 3a921bc6d36..82d823c986d 100644 --- a/tests/baselines/reference/breakTarget6.errors.txt +++ b/tests/baselines/reference/breakTarget6.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/breakTarget6.ts(2,3): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. + + ==== tests/cases/compiler/breakTarget6.ts (1 errors) ==== while (true) { break target; ~~~~~~~~~~~~~ -!!! A 'break' statement can only jump to a label of an enclosing statement. +!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. } \ No newline at end of file diff --git a/tests/baselines/reference/callConstructAssignment.errors.txt b/tests/baselines/reference/callConstructAssignment.errors.txt index e80dbcbfc38..e3f850a1855 100644 --- a/tests/baselines/reference/callConstructAssignment.errors.txt +++ b/tests/baselines/reference/callConstructAssignment.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/callConstructAssignment.ts(7,1): error TS2323: Type 'new () => any' is not assignable to type '() => void'. +tests/cases/compiler/callConstructAssignment.ts(8,1): error TS2323: Type '() => void' is not assignable to type 'new () => any'. + + ==== tests/cases/compiler/callConstructAssignment.ts (2 errors) ==== @@ -7,7 +11,7 @@ foo = bar; // error ~~~ -!!! Type 'new () => any' is not assignable to type '() => void'. +!!! error TS2323: Type 'new () => any' is not assignable to type '() => void'. bar = foo; // error ~~~ -!!! Type '() => void' is not assignable to type 'new () => any'. \ No newline at end of file +!!! error TS2323: Type '() => void' is not assignable to type 'new () => any'. \ No newline at end of file diff --git a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.errors.txt b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.errors.txt index dfe311ab86c..0e8e8ff9303 100644 --- a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.errors.txt +++ b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.errors.txt @@ -1,3 +1,19 @@ +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(5,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(6,11): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(9,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(10,11): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(13,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(14,11): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(21,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(22,11): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(28,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(29,11): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(36,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(37,11): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(43,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(44,11): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts (14 errors) ==== // type parameter lists must exactly match type argument lists // all of these invocations are errors @@ -5,26 +21,26 @@ function f(x: T, y: U): T { return null; } var r1 = f(1, ''); ~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r1b = f(1, ''); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var f2 = (x: T, y: U): T => { return null; } var r2 = f2(1, ''); ~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r2b = f2(1, ''); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var f3: { (x: T, y: U): T; } var r3 = f3(1, ''); ~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r3b = f3(1, ''); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. class C { f(x: T, y: U): T { @@ -33,10 +49,10 @@ } var r4 = (new C()).f(1, ''); ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r4b = (new C()).f(1, ''); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. interface I { f(x: T, y: U): T; @@ -44,10 +60,10 @@ var i: I; var r5 = i.f(1, ''); ~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r5b = i.f(1, ''); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. class C2 { f(x: T, y: U): T { @@ -56,10 +72,10 @@ } var r6 = (new C2()).f(1, ''); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r6b = (new C2()).f(1, ''); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. interface I2 { f(x: T, y: U): T; @@ -67,7 +83,7 @@ var i2: I2; var r7 = i2.f(1, ''); ~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r7b = i2.f(1, ''); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.errors.txt b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.errors.txt index 69284efdf82..6a11751ead3 100644 --- a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.errors.txt +++ b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.errors.txt @@ -1,3 +1,14 @@ +tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(5,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(8,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(11,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(18,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(24,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(31,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(37,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(40,10): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts(43,10): error TS2347: Untyped function calls may not accept type arguments. + + ==== tests/cases/conformance/types/typeParameters/typeArgumentLists/callNonGenericFunctionWithTypeArguments.ts (9 errors) ==== // it is always illegal to provide type arguments to a non-generic function // all invocations here are illegal @@ -5,17 +16,17 @@ function f(x: number) { return null; } var r = f(1); ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var f2 = (x: number) => { return null; } var r2 = f2(1); ~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var f3: { (x: number): any; } var r3 = f3(1); ~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. class C { f(x: number) { @@ -24,7 +35,7 @@ } var r4 = (new C()).f(1); ~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. interface I { f(x: number): any; @@ -32,7 +43,7 @@ var i: I; var r5 = i.f(1); ~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. class C2 { f(x: number) { @@ -41,7 +52,7 @@ } var r6 = (new C2()).f(1); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. interface I2 { f(x: number); @@ -49,14 +60,14 @@ var i2: I2; var r7 = i2.f(1); ~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var a; var r8 = a(); ~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. var a2: any; var r8 = a2(); ~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. \ No newline at end of file +!!! error TS2347: Untyped function calls may not accept type arguments. \ No newline at end of file diff --git a/tests/baselines/reference/callOnClass.errors.txt b/tests/baselines/reference/callOnClass.errors.txt index 9232fefe703..83e4472dd4f 100644 --- a/tests/baselines/reference/callOnClass.errors.txt +++ b/tests/baselines/reference/callOnClass.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/callOnClass.ts(2,9): error TS2348: Value of type 'typeof C' is not callable. Did you mean to include 'new'? + + ==== tests/cases/compiler/callOnClass.ts (1 errors) ==== class C { } var c = C(); ~~~ -!!! Value of type 'typeof C' is not callable. Did you mean to include 'new'? +!!! error TS2348: Value of type 'typeof C' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/callOnInstance.errors.txt b/tests/baselines/reference/callOnInstance.errors.txt index da866a56e04..156bdfd512a 100644 --- a/tests/baselines/reference/callOnInstance.errors.txt +++ b/tests/baselines/reference/callOnInstance.errors.txt @@ -1,19 +1,28 @@ -==== tests/cases/compiler/callOnInstance.ts (4 errors) ==== - declare function D(): string; +tests/cases/compiler/callOnInstance.ts(1,18): error TS2300: Duplicate identifier 'D'. +tests/cases/compiler/callOnInstance.ts(3,15): error TS2300: Duplicate identifier 'D'. +tests/cases/compiler/callOnInstance.ts(7,19): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/callOnInstance.ts(7,19): error TS2350: Only a void function can be called with the 'new' keyword. +tests/cases/compiler/callOnInstance.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. + + +==== tests/cases/compiler/callOnInstance.ts (5 errors) ==== + declare function D(): string; // error + ~ +!!! error TS2300: Duplicate identifier 'D'. - declare class D { constructor (value: number); } // Duplicate identifier + declare class D { constructor (value: number); } // error ~ -!!! Duplicate identifier 'D'. +!!! error TS2300: Duplicate identifier 'D'. var s1: string = D(); // OK var s2: string = (new D(1))(); ~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. ~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. +!!! error TS2350: Only a void function can be called with the 'new' keyword. declare class C { constructor(value: number); } (new C(1))(); // Error for calling an instance ~~~~~~~~~~~~ -!!! Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file diff --git a/tests/baselines/reference/callOnInstance.js b/tests/baselines/reference/callOnInstance.js index 477bdca26a7..3b07d0affc8 100644 --- a/tests/baselines/reference/callOnInstance.js +++ b/tests/baselines/reference/callOnInstance.js @@ -1,7 +1,7 @@ //// [callOnInstance.ts] -declare function D(): string; +declare function D(): string; // error -declare class D { constructor (value: number); } // Duplicate identifier +declare class D { constructor (value: number); } // error var s1: string = D(); // OK diff --git a/tests/baselines/reference/callOverloadViaElementAccessExpression.errors.txt b/tests/baselines/reference/callOverloadViaElementAccessExpression.errors.txt index 46b7f099ff0..9c85dad20e9 100644 --- a/tests/baselines/reference/callOverloadViaElementAccessExpression.errors.txt +++ b/tests/baselines/reference/callOverloadViaElementAccessExpression.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/callOverloadViaElementAccessExpression.ts(10,5): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/callOverloadViaElementAccessExpression.ts(11,5): error TS2323: Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/callOverloadViaElementAccessExpression.ts (2 errors) ==== class C { foo(x: number): number; @@ -10,7 +14,7 @@ var c = new C(); var r: string = c['foo'](1); ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. var r2: number = c['foo'](''); ~~ -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2323: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/callOverloads1.errors.txt b/tests/baselines/reference/callOverloads1.errors.txt index a561ffb0c83..64927462104 100644 --- a/tests/baselines/reference/callOverloads1.errors.txt +++ b/tests/baselines/reference/callOverloads1.errors.txt @@ -1,5 +1,13 @@ -==== tests/cases/compiler/callOverloads1.ts (3 errors) ==== - class Foo { +tests/cases/compiler/callOverloads1.ts(1,7): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads1.ts(9,10): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads1.ts(9,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/callOverloads1.ts(17,1): error TS2348: Value of type 'typeof Foo' is not callable. Did you mean to include 'new'? + + +==== tests/cases/compiler/callOverloads1.ts (4 errors) ==== + class Foo { // error + ~~~ +!!! error TS2300: Duplicate identifier 'Foo'. bar1() { /*WScript.Echo("bar1");*/ } constructor(x: any) { @@ -9,9 +17,9 @@ function Foo(); // error ~~~ -!!! Duplicate identifier 'Foo'. +!!! error TS2300: Duplicate identifier 'Foo'. ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. function F1(s:string); function F1(a:any) { return a;} @@ -21,4 +29,4 @@ f1.bar1(); Foo(); ~~~~~ -!!! Value of type 'typeof Foo' is not callable. Did you mean to include 'new'? \ No newline at end of file +!!! error TS2348: Value of type 'typeof Foo' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/callOverloads1.js b/tests/baselines/reference/callOverloads1.js index dc76fcba98a..86cb951f853 100644 --- a/tests/baselines/reference/callOverloads1.js +++ b/tests/baselines/reference/callOverloads1.js @@ -1,5 +1,5 @@ //// [callOverloads1.ts] -class Foo { +class Foo { // error bar1() { /*WScript.Echo("bar1");*/ } constructor(x: any) { diff --git a/tests/baselines/reference/callOverloads2.errors.txt b/tests/baselines/reference/callOverloads2.errors.txt index a715c13401e..6291fa8f3de 100644 --- a/tests/baselines/reference/callOverloads2.errors.txt +++ b/tests/baselines/reference/callOverloads2.errors.txt @@ -1,7 +1,18 @@ -==== tests/cases/compiler/callOverloads2.ts (5 errors) ==== +tests/cases/compiler/callOverloads2.ts(3,7): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads2.ts(11,10): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads2.ts(13,10): error TS2389: Function implementation name must be 'Foo'. +tests/cases/compiler/callOverloads2.ts(13,10): error TS2393: Duplicate function implementation. +tests/cases/compiler/callOverloads2.ts(14,10): error TS2393: Duplicate function implementation. +tests/cases/compiler/callOverloads2.ts(16,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/callOverloads2.ts(24,1): error TS2348: Value of type 'typeof Foo' is not callable. Did you mean to include 'new'? + + +==== tests/cases/compiler/callOverloads2.ts (7 errors) ==== - class Foo { + class Foo { // error + ~~~ +!!! error TS2300: Duplicate identifier 'Foo'. bar1() { /*WScript.Echo("bar1");*/ } constructor(x: any) { @@ -9,20 +20,22 @@ } } - function Foo(); + function Foo(); // error ~~~ -!!! Duplicate identifier 'Foo'. +!!! error TS2300: Duplicate identifier 'Foo'. - function F1(s:string) {return s;} + function F1(s:string) {return s;} // error ~~ -!!! Function implementation name must be 'Foo'. - function F1(a:any) { return a;} // error - duplicate identifier - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate function implementation. +!!! error TS2389: Function implementation name must be 'Foo'. + ~~ +!!! error TS2393: Duplicate function implementation. + function F1(a:any) { return a;} // error + ~~ +!!! error TS2393: Duplicate function implementation. function Goo(s:string); // error - no implementation ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. declare function Gar(s:String); // expect no error @@ -32,5 +45,5 @@ f1.bar1(); Foo(); ~~~~~ -!!! Value of type 'typeof Foo' is not callable. Did you mean to include 'new'? +!!! error TS2348: Value of type 'typeof Foo' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/callOverloads2.js b/tests/baselines/reference/callOverloads2.js index be42753bc3d..e3cbceb177a 100644 --- a/tests/baselines/reference/callOverloads2.js +++ b/tests/baselines/reference/callOverloads2.js @@ -1,7 +1,7 @@ //// [callOverloads2.ts] -class Foo { +class Foo { // error bar1() { /*WScript.Echo("bar1");*/ } constructor(x: any) { @@ -9,10 +9,10 @@ class Foo { } } -function Foo(); +function Foo(); // error -function F1(s:string) {return s;} -function F1(a:any) { return a;} // error - duplicate identifier +function F1(s:string) {return s;} // error +function F1(a:any) { return a;} // error function Goo(s:string); // error - no implementation @@ -36,10 +36,10 @@ var Foo = (function () { })(); function F1(s) { return s; -} +} // error function F1(a) { return a; -} // error - duplicate identifier +} // error var f1 = new Foo("hey"); f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callOverloads3.errors.txt b/tests/baselines/reference/callOverloads3.errors.txt index e6b7fecb59f..ecb889bc1ab 100644 --- a/tests/baselines/reference/callOverloads3.errors.txt +++ b/tests/baselines/reference/callOverloads3.errors.txt @@ -1,16 +1,29 @@ -==== tests/cases/compiler/callOverloads3.ts (5 errors) ==== +tests/cases/compiler/callOverloads3.ts(2,10): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads3.ts(2,16): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads3.ts(3,10): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads3.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/callOverloads3.ts(3,24): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads3.ts(4,7): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads3.ts(12,10): error TS2350: Only a void function can be called with the 'new' keyword. + + +==== tests/cases/compiler/callOverloads3.ts (7 errors) ==== - function Foo():Foo; - ~~~ -!!! Cannot find name 'Foo'. - function Foo(s:string):Foo; + function Foo():Foo; // error ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2300: Duplicate identifier 'Foo'. + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + function Foo(s:string):Foo; // error + ~~~ +!!! error TS2300: Duplicate identifier 'Foo'. + ~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. ~~~ -!!! Cannot find name 'Foo'. - class Foo { +!!! error TS2304: Cannot find name 'Foo'. + class Foo { // error ~~~ -!!! Duplicate identifier 'Foo'. +!!! error TS2300: Duplicate identifier 'Foo'. bar1() { /*WScript.Echo("bar1");*/ } constructor(x: any) { // WScript.Echo("Constructor function has executed"); @@ -20,7 +33,7 @@ var f1 = new Foo("hey"); ~~~~~~~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. +!!! error TS2350: Only a void function can be called with the 'new' keyword. f1.bar1(); diff --git a/tests/baselines/reference/callOverloads3.js b/tests/baselines/reference/callOverloads3.js index 93176cc1edb..85c16fe85a6 100644 --- a/tests/baselines/reference/callOverloads3.js +++ b/tests/baselines/reference/callOverloads3.js @@ -1,8 +1,8 @@ //// [callOverloads3.ts] -function Foo():Foo; -function Foo(s:string):Foo; -class Foo { +function Foo():Foo; // error +function Foo(s:string):Foo; // error +class Foo { // error bar1() { /*WScript.Echo("bar1");*/ } constructor(x: any) { // WScript.Echo("Constructor function has executed"); diff --git a/tests/baselines/reference/callOverloads4.errors.txt b/tests/baselines/reference/callOverloads4.errors.txt index 5fafef84f4c..3010d7c15d8 100644 --- a/tests/baselines/reference/callOverloads4.errors.txt +++ b/tests/baselines/reference/callOverloads4.errors.txt @@ -1,16 +1,29 @@ -==== tests/cases/compiler/callOverloads4.ts (5 errors) ==== +tests/cases/compiler/callOverloads4.ts(2,10): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads4.ts(2,16): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads4.ts(3,10): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads4.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/callOverloads4.ts(3,24): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads4.ts(4,7): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads4.ts(12,10): error TS2350: Only a void function can be called with the 'new' keyword. + + +==== tests/cases/compiler/callOverloads4.ts (7 errors) ==== - function Foo():Foo; - ~~~ -!!! Cannot find name 'Foo'. - function Foo(s:string):Foo; + function Foo():Foo; // error ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2300: Duplicate identifier 'Foo'. + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + function Foo(s:string):Foo; // error + ~~~ +!!! error TS2300: Duplicate identifier 'Foo'. + ~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. ~~~ -!!! Cannot find name 'Foo'. - class Foo { +!!! error TS2304: Cannot find name 'Foo'. + class Foo { // error ~~~ -!!! Duplicate identifier 'Foo'. +!!! error TS2300: Duplicate identifier 'Foo'. bar1() { /*WScript.Echo("bar1");*/ } constructor(s: string); constructor(x: any) { @@ -20,7 +33,7 @@ var f1 = new Foo("hey"); ~~~~~~~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. +!!! error TS2350: Only a void function can be called with the 'new' keyword. f1.bar1(); diff --git a/tests/baselines/reference/callOverloads4.js b/tests/baselines/reference/callOverloads4.js index 86ec2b91e7e..6aab555b721 100644 --- a/tests/baselines/reference/callOverloads4.js +++ b/tests/baselines/reference/callOverloads4.js @@ -1,8 +1,8 @@ //// [callOverloads4.ts] -function Foo():Foo; -function Foo(s:string):Foo; -class Foo { +function Foo():Foo; // error +function Foo(s:string):Foo; // error +class Foo { // error bar1() { /*WScript.Echo("bar1");*/ } constructor(s: string); constructor(x: any) { diff --git a/tests/baselines/reference/callOverloads5.errors.txt b/tests/baselines/reference/callOverloads5.errors.txt index 7df261b7e0c..e521a9a9076 100644 --- a/tests/baselines/reference/callOverloads5.errors.txt +++ b/tests/baselines/reference/callOverloads5.errors.txt @@ -1,15 +1,28 @@ -==== tests/cases/compiler/callOverloads5.ts (5 errors) ==== - function Foo():Foo; - ~~~ -!!! Cannot find name 'Foo'. - function Foo(s:string):Foo; +tests/cases/compiler/callOverloads5.ts(1,10): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads5.ts(1,16): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads5.ts(2,10): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads5.ts(2,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/callOverloads5.ts(2,24): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads5.ts(3,7): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/callOverloads5.ts(13,10): error TS2350: Only a void function can be called with the 'new' keyword. + + +==== tests/cases/compiler/callOverloads5.ts (7 errors) ==== + function Foo():Foo; // error ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2300: Duplicate identifier 'Foo'. + ~~~ +!!! error TS2304: Cannot find name 'Foo'. + function Foo(s:string):Foo; // error + ~~~ +!!! error TS2300: Duplicate identifier 'Foo'. + ~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. ~~~ -!!! Cannot find name 'Foo'. - class Foo { +!!! error TS2304: Cannot find name 'Foo'. + class Foo { // error ~~~ -!!! Duplicate identifier 'Foo'. +!!! error TS2300: Duplicate identifier 'Foo'. bar1(s:string); bar1(n:number); bar1(a:any) { /*WScript.Echo(a);*/ } @@ -21,7 +34,7 @@ var f1 = new Foo("hey"); ~~~~~~~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. +!!! error TS2350: Only a void function can be called with the 'new' keyword. f1.bar1("a"); diff --git a/tests/baselines/reference/callOverloads5.js b/tests/baselines/reference/callOverloads5.js index 30cc65915ec..2220568e4c2 100644 --- a/tests/baselines/reference/callOverloads5.js +++ b/tests/baselines/reference/callOverloads5.js @@ -1,7 +1,7 @@ //// [callOverloads5.ts] -function Foo():Foo; -function Foo(s:string):Foo; -class Foo { +function Foo():Foo; // error +function Foo(s:string):Foo; // error +class Foo { // error bar1(s:string); bar1(n:number); bar1(a:any) { /*WScript.Echo(a);*/ } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt index 17087865020..d0e31f4a246 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance.ts(57,15): error TS2429: Interface 'I2' incorrectly extends interface 'Base2': + Types of property 'a' are incompatible: + Type '(x: number) => string' is not assignable to type '(x: number) => number': + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance.ts (1 errors) ==== module CallSignature { interface Base { // T @@ -57,10 +63,10 @@ // S's interface I2 extends Base2 { ~~ -!!! Interface 'I2' incorrectly extends interface 'Base2': -!!! Types of property 'a' are incompatible: -!!! Type '(x: number) => string' is not assignable to type '(x: number) => number': -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2429: Interface 'I2' incorrectly extends interface 'Base2': +!!! error TS2429: Types of property 'a' are incompatible: +!!! error TS2429: Type '(x: number) => string' is not assignable to type '(x: number) => number': +!!! error TS2429: Type 'string' is not assignable to type 'number'. // N's a: (x: number) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt index 81cd8b924f0..51bf9695692 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt @@ -1,3 +1,19 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(51,19): error TS2429: Interface 'I2' incorrectly extends interface 'A': + Types of property 'a2' are incompatible: + Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]': + Types of parameters 'x' and 'x' are incompatible: + Type 'T' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(60,19): error TS2429: Interface 'I4' incorrectly extends interface 'A': + Types of property 'a8' are incompatible: + Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': + Types of parameters 'y' and 'y' are incompatible: + Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': + Types of parameters 'arg2' and 'arg2' are incompatible: + Type '{ foo: number; }' is not assignable to type 'Base': + Types of property 'foo' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts (2 errors) ==== // checking subtype relations for function types as it relates to contextual signature instantiation // error cases @@ -51,11 +67,11 @@ interface I2 extends A { ~~ -!!! Interface 'I2' incorrectly extends interface 'A': -!!! Types of property 'a2' are incompatible: -!!! Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'T' is not assignable to type 'number'. +!!! error TS2429: Interface 'I2' incorrectly extends interface 'A': +!!! error TS2429: Types of property 'a2' are incompatible: +!!! error TS2429: Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]': +!!! error TS2429: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2429: Type 'T' is not assignable to type 'number'. a2: (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic } @@ -66,15 +82,15 @@ interface I4 extends A { ~~ -!!! Interface 'I4' incorrectly extends interface 'A': -!!! Types of property 'a8' are incompatible: -!!! Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': -!!! Types of parameters 'arg2' and 'arg2' are incompatible: -!!! Type '{ foo: number; }' is not assignable to type 'Base': -!!! Types of property 'foo' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2429: Interface 'I4' incorrectly extends interface 'A': +!!! error TS2429: Types of property 'a8' are incompatible: +!!! error TS2429: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': +!!! error TS2429: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2429: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': +!!! error TS2429: Types of parameters 'arg2' and 'arg2' are incompatible: +!!! error TS2429: Type '{ foo: number; }' is not assignable to type 'Base': +!!! error TS2429: Types of property 'foo' are incompatible: +!!! error TS2429: Type 'number' is not assignable to type 'string'. a8: (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U; // error, type mismatch } diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt index 7cd13f2fafb..1f018be434a 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt @@ -1,15 +1,33 @@ +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(3,14): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(4,22): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(5,22): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(15,9): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(44,9): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2323: Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts (16 errors) ==== // Optional parameters cannot also have initializer expressions, these are all errors function foo(x?: number = 1) { } ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. var f = function foo(x?: number = 1) { } ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. var f2 = (x: number, y? = 1) => { } ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. foo(1); foo(); @@ -21,7 +39,7 @@ class C { foo(x?: number = 1) { } ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. } var c: C; @@ -31,14 +49,14 @@ interface I { (x? = 1); ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. ~~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. foo(x: number, y?: number = 1); ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. ~~~~~~~~~~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. } var i: I; @@ -50,14 +68,14 @@ var a: { (x?: number = 1); ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. ~~~~~~~~~~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. foo(x? = 1); ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. ~~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. } a(); @@ -68,15 +86,15 @@ var b = { foo(x?: number = 1) { }, ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. a: function foo(x: number, y?: number = '') { }, ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. ~~~~~~~~~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. b: (x?: any = '') => { } ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. } b.foo(); diff --git a/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.errors.txt b/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.errors.txt index 349e8513e70..1c558910a8c 100644 --- a/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.errors.txt +++ b/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts(9,10): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts (1 errors) ==== interface I1 { (value: T): void; @@ -9,5 +12,5 @@ test("expects boolean instead of string"); // should not error - "test" should not expect a boolean test(true); // should error - string expected ~~~~ -!!! Argument of type 'boolean' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt index b0df8303150..aada6c9f8a1 100644 --- a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(8,11): error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I': + Named properties 'foo' of types 'I' and 'I' are not identical. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + + ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts (2 errors) ==== // Normally it is an error to have multiple overloads which differ only by return type in a single type declaration. // Here the multiple overloads come from multiple bases. @@ -8,13 +13,13 @@ interface A extends I, I { } ~ -!!! Interface 'A' cannot simultaneously extend types 'I' and 'I': -!!! Named properties 'foo' of types 'I' and 'I' are not identical. +!!! error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I': +!!! error TS2320: Named properties 'foo' of types 'I' and 'I' are not identical. var x: A; // BUG 822524 var r = x.foo(1); // no error var r2 = x.foo(''); // error ~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.errors.txt b/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.errors.txt index f7d58ea096e..c5a30ad21ad 100644 --- a/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.errors.txt +++ b/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.errors.txt @@ -1,119 +1,161 @@ +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(3,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(3,24): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(4,22): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(4,32): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(5,20): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(5,30): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(6,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(7,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(9,15): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(9,34): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(10,23): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(10,42): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(11,20): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(11,39): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(12,11): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(12,30): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(13,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(13,28): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(16,9): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(16,19): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(17,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(17,28): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(18,13): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(18,26): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(22,6): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(22,17): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(23,6): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(23,25): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(24,9): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(24,20): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(25,9): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(26,19): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(30,9): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(30,19): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(31,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(31,29): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(35,9): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(36,32): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(37,12): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts(37,25): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithAccessibilityModifiersOnParameters.ts (40 errors) ==== // Call signature parameters do not allow accessibility modifiers function foo(public x, private y) { } ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. var f = function foo(public x, private y) { } ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. var f2 = function (public x, private y) { } ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. var f3 = (x, private y) => { } ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. var f4 = (public x: T, y: T) => { } ~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. function foo2(private x: string, public y: number) { } ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. var f5 = function foo(private x: string, public y: number) { } ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. var f6 = function (private x: string, public y: number) { } ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. var f7 = (private x: string, public y: number) => { } ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. var f8 = (private x: T, public y: T) => { } ~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. class C { foo(public x, private y) { } ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. foo2(public x: number, private y: string) { } ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. foo3(public x: T, private y: T) { } ~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } interface I { (private x, public y); ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. (private x: string, public y: number); ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. foo(private x, public y); ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. foo(public x: number, y: string); ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. foo3(x: T, private y: T); ~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } var a: { foo(public x, private y); ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. foo2(private x: number, public y: string); ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. }; var b = { foo(public x, y) { }, ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. a: function foo(x: number, private y: string) { }, ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. b: (public x: T, private y: T) => { } ~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/callSignaturesWithDuplicateParameters.errors.txt b/tests/baselines/reference/callSignaturesWithDuplicateParameters.errors.txt index facb92dd461..034aa4039cf 100644 --- a/tests/baselines/reference/callSignaturesWithDuplicateParameters.errors.txt +++ b/tests/baselines/reference/callSignaturesWithDuplicateParameters.errors.txt @@ -1,83 +1,173 @@ -==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts (22 errors) ==== +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(3,14): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(3,17): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(4,22): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(4,25): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(5,20): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(5,23): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(6,11): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(6,14): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(7,14): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(7,20): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(9,15): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(9,26): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(10,23): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(10,34): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(11,20): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(11,31): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(12,11): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(12,22): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(16,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(16,12): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(17,10): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(17,21): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(18,13): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(18,19): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(22,6): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(22,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(23,6): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(23,17): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(24,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(24,12): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(25,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(25,20): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(26,13): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(26,19): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(30,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(30,12): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(31,10): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(31,21): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(35,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(35,12): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(36,21): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(36,32): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(37,12): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(37,18): error TS2300: Duplicate identifier 'x'. + + +==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts (44 errors) ==== // Duplicate parameter names are always an error function foo(x, x) { } - ~ -!!! Duplicate identifier 'x'. - var f = function foo(x, x) { } - ~ -!!! Duplicate identifier 'x'. - var f2 = function (x, x) { } - ~ -!!! Duplicate identifier 'x'. - var f3 = (x, x) => { } ~ -!!! Duplicate identifier 'x'. - var f4 = (x: T, x: T) => { } +!!! error TS2300: Duplicate identifier 'x'. + ~ +!!! error TS2300: Duplicate identifier 'x'. + var f = function foo(x, x) { } + ~ +!!! error TS2300: Duplicate identifier 'x'. + ~ +!!! error TS2300: Duplicate identifier 'x'. + var f2 = function (x, x) { } ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. + ~ +!!! error TS2300: Duplicate identifier 'x'. + var f3 = (x, x) => { } + ~ +!!! error TS2300: Duplicate identifier 'x'. + ~ +!!! error TS2300: Duplicate identifier 'x'. + var f4 = (x: T, x: T) => { } + ~ +!!! error TS2300: Duplicate identifier 'x'. + ~ +!!! error TS2300: Duplicate identifier 'x'. function foo2(x: string, x: number) { } + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. var f5 = function foo(x: string, x: number) { } + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. var f6 = function (x: string, x: number) { } + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. var f7 = (x: string, x: number) => { } + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. var f8 = (x: T, y: T) => { } class C { foo(x, x) { } + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. foo2(x: number, x: string) { } + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. foo3(x: T, x: T) { } + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } interface I { (x, x); + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. (x: string, x: number); + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. foo(x, x); + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. foo(x: number, x: string); + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. foo3(x: T, x: T); + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } var a: { foo(x, x); + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. foo2(x: number, x: string); + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. }; var b = { foo(x, x) { }, + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. a: function foo(x: number, x: string) { }, + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. b: (x: T, x: T) => { } + ~ +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers.errors.txt b/tests/baselines/reference/callSignaturesWithParameterInitializers.errors.txt index 033fa6d51c0..ffff3886375 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers.errors.txt +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers.ts(24,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers.ts(25,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers.ts(36,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers.ts(37,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + + ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers.ts (4 errors) ==== // Optional parameters allow initializers only in implementation signatures @@ -24,10 +30,10 @@ interface I { (x = 1); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. foo(x: number, y = 1); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. } var i: I; @@ -40,10 +46,10 @@ var a: { (x = 1); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. foo(x = 1); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. } a(); diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt b/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt index ad4a81aa7f1..1801bd42e4d 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt @@ -1,10 +1,17 @@ -==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts (4 errors) ==== +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,15): error TS1005: '{' expected. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(4,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(11,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(21,5): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts (5 errors) ==== // Optional parameters allow initializers only in implementation signatures // All the below declarations are errors function foo(x = 2); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. function foo(x = 1) { } foo(1); @@ -13,7 +20,7 @@ class C { foo(x = 2); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. foo(x = 1) { } } @@ -22,12 +29,14 @@ c.foo(1); var b = { - foo(x = 1), + foo(x = 1), // error ~ -!!! '{' expected. - foo(x = 1) { }, +!!! error TS1005: '{' expected. ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. + foo(x = 1) { }, // error + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. } b.foo(); diff --git a/tests/baselines/reference/callWithWrongNumberOfTypeArguments.errors.txt b/tests/baselines/reference/callWithWrongNumberOfTypeArguments.errors.txt index 027efabf4a4..a3776946292 100644 --- a/tests/baselines/reference/callWithWrongNumberOfTypeArguments.errors.txt +++ b/tests/baselines/reference/callWithWrongNumberOfTypeArguments.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/callWithWrongNumberOfTypeArguments.ts(3,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/callWithWrongNumberOfTypeArguments.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/callWithWrongNumberOfTypeArguments.ts (2 errors) ==== function f() { } f(); ~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. f(); f(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/callbackArgsDifferByOptionality.errors.txt b/tests/baselines/reference/callbackArgsDifferByOptionality.errors.txt index aaa831dc2ac..2df02c30185 100644 --- a/tests/baselines/reference/callbackArgsDifferByOptionality.errors.txt +++ b/tests/baselines/reference/callbackArgsDifferByOptionality.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/callbackArgsDifferByOptionality.ts(1,23): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/callbackArgsDifferByOptionality.ts(4,5): error TS2304: Cannot find name 'cb'. + + ==== tests/cases/compiler/callbackArgsDifferByOptionality.ts (2 errors) ==== function x3(callback: (x?: 'hi') => number); ~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function x3(callback: (x: string) => number); function x3(callback: (x: any) => number) { cb(); ~~ -!!! Cannot find name 'cb'. +!!! error TS2304: Cannot find name 'cb'. } \ No newline at end of file diff --git a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt index 504e08eadf0..cfb9287cdbc 100644 --- a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt +++ b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,21): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,15): error TS2339: Property 'ClassA' does not exist on type 'typeof M'. + + ==== tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts (2 errors) ==== module M { @@ -5,6 +9,6 @@ } var t = new M.ClassA[]; ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ -!!! Property 'ClassA' does not exist on type 'typeof M'. \ No newline at end of file +!!! error TS2339: Property 'ClassA' does not exist on type 'typeof M'. \ No newline at end of file diff --git a/tests/baselines/reference/cannotInvokeNewOnIndexExpression.errors.txt b/tests/baselines/reference/cannotInvokeNewOnIndexExpression.errors.txt index 015bd2d43c3..7be5a1f086c 100644 --- a/tests/baselines/reference/cannotInvokeNewOnIndexExpression.errors.txt +++ b/tests/baselines/reference/cannotInvokeNewOnIndexExpression.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/cannotInvokeNewOnIndexExpression.ts(1,23): error TS2304: Cannot find name 'any'. + + ==== tests/cases/compiler/cannotInvokeNewOnIndexExpression.ts (1 errors) ==== var test: any[] = new any[1]; ~~~ -!!! Cannot find name 'any'. \ No newline at end of file +!!! error TS2304: Cannot find name 'any'. \ No newline at end of file diff --git a/tests/baselines/reference/castExpressionParentheses.js b/tests/baselines/reference/castExpressionParentheses.js index 2f62d6e9447..2b518226c60 100644 --- a/tests/baselines/reference/castExpressionParentheses.js +++ b/tests/baselines/reference/castExpressionParentheses.js @@ -43,7 +43,7 @@ new (A()); // parentheses should be omitted // literals { a: 0 }; -[1, 3, ]; +[1, 3,]; "string"; 23.0; /regexp/g; diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt new file mode 100644 index 00000000000..c3079699a80 --- /dev/null +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -0,0 +1,73 @@ +tests/cases/conformance/types/tuple/castingTuple.ts(13,23): error TS2353: Neither type '[number, string]' nor type '[number, string, boolean]' is assignable to the other: + Property '2' is missing in type '[number, string]'. +tests/cases/conformance/types/tuple/castingTuple.ts(16,21): error TS2353: Neither type '[C, D]' nor type '[C, D, A]' is assignable to the other: + Property '2' is missing in type '[C, D]'. +tests/cases/conformance/types/tuple/castingTuple.ts(24,10): error TS2353: Neither type '[number, string]' nor type '[number, number]' is assignable to the other: + Types of property '1' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/castingTuple.ts(25,10): error TS2353: Neither type '[C, D]' nor type '[A, I]' is assignable to the other: + Types of property '0' are incompatible: + Type 'C' is not assignable to type 'A': + Property 'a' is missing in type 'C'. +tests/cases/conformance/types/tuple/castingTuple.ts(26,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. +tests/cases/conformance/types/tuple/castingTuple.ts(26,14): error TS2353: Neither type '[number, string]' nor type 'number[]' is assignable to the other: + Types of property 'pop' are incompatible: + Type '() => string | number' is not assignable to type '() => number': + Type 'string | number' is not assignable to type 'number': + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/castingTuple.ts(27,1): error TS2304: Cannot find name 't4'. + + +==== tests/cases/conformance/types/tuple/castingTuple.ts (7 errors) ==== + interface I { } + class A { a = 10; } + class C implements I { c }; + class D implements I { d }; + class E extends A { e }; + class F extends A { f }; + enum E1 { one } + enum E2 { one } + + // no error + var numStrTuple: [number, string] = [5, "foo"]; + var emptyObjTuple = <[{}, {}]>numStrTuple; + var numStrBoolTuple = <[number, string, boolean]>numStrTuple; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2353: Neither type '[number, string]' nor type '[number, string, boolean]' is assignable to the other: +!!! error TS2353: Property '2' is missing in type '[number, string]'. + var classCDTuple: [C, D] = [new C(), new D()]; + var interfaceIITuple = <[I, I]>classCDTuple; + var classCDATuple = <[C, D, A]>classCDTuple; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2353: Neither type '[C, D]' nor type '[C, D, A]' is assignable to the other: +!!! error TS2353: Property '2' is missing in type '[C, D]'. + var eleFromCDA1 = classCDATuple[2]; // A + var eleFromCDA2 = classCDATuple[5]; // {} + var t10: [E1, E2] = [E1.one, E2.one]; + var t11 = <[number, number]>t10; + var array1 = <{}[]>emptyObjTuple; + + // error + var t3 = <[number, number]>numStrTuple; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2353: Neither type '[number, string]' nor type '[number, number]' is assignable to the other: +!!! error TS2353: Types of property '1' are incompatible: +!!! error TS2353: Type 'string' is not assignable to type 'number'. + var t9 = <[A, I]>classCDTuple; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2353: Neither type '[C, D]' nor type '[A, I]' is assignable to the other: +!!! error TS2353: Types of property '0' are incompatible: +!!! error TS2353: Type 'C' is not assignable to type 'A': +!!! error TS2353: Property 'a' is missing in type 'C'. + var array1 = numStrTuple; + ~~~~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2353: Neither type '[number, string]' nor type 'number[]' is assignable to the other: +!!! error TS2353: Types of property 'pop' are incompatible: +!!! error TS2353: Type '() => string | number' is not assignable to type '() => number': +!!! error TS2353: Type 'string | number' is not assignable to type 'number': +!!! error TS2353: Type 'string' is not assignable to type 'number'. + t4[2] = 10; + ~~ +!!! error TS2304: Cannot find name 't4'. \ No newline at end of file diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js new file mode 100644 index 00000000000..0671062bb4e --- /dev/null +++ b/tests/baselines/reference/castingTuple.js @@ -0,0 +1,95 @@ +//// [castingTuple.ts] +interface I { } +class A { a = 10; } +class C implements I { c }; +class D implements I { d }; +class E extends A { e }; +class F extends A { f }; +enum E1 { one } +enum E2 { one } + +// no error +var numStrTuple: [number, string] = [5, "foo"]; +var emptyObjTuple = <[{}, {}]>numStrTuple; +var numStrBoolTuple = <[number, string, boolean]>numStrTuple; +var classCDTuple: [C, D] = [new C(), new D()]; +var interfaceIITuple = <[I, I]>classCDTuple; +var classCDATuple = <[C, D, A]>classCDTuple; +var eleFromCDA1 = classCDATuple[2]; // A +var eleFromCDA2 = classCDATuple[5]; // {} +var t10: [E1, E2] = [E1.one, E2.one]; +var t11 = <[number, number]>t10; +var array1 = <{}[]>emptyObjTuple; + +// error +var t3 = <[number, number]>numStrTuple; +var t9 = <[A, I]>classCDTuple; +var array1 = numStrTuple; +t4[2] = 10; + +//// [castingTuple.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var A = (function () { + function A() { + this.a = 10; + } + return A; +})(); +var C = (function () { + function C() { + } + return C; +})(); +; +var D = (function () { + function D() { + } + return D; +})(); +; +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.apply(this, arguments); + } + return E; +})(A); +; +var F = (function (_super) { + __extends(F, _super); + function F() { + _super.apply(this, arguments); + } + return F; +})(A); +; +var E1; +(function (E1) { + E1[E1["one"] = 0] = "one"; +})(E1 || (E1 = {})); +var E2; +(function (E2) { + E2[E2["one"] = 0] = "one"; +})(E2 || (E2 = {})); +// no error +var numStrTuple = [5, "foo"]; +var emptyObjTuple = numStrTuple; +var numStrBoolTuple = numStrTuple; +var classCDTuple = [new C(), new D()]; +var interfaceIITuple = classCDTuple; +var classCDATuple = classCDTuple; +var eleFromCDA1 = classCDATuple[2]; // A +var eleFromCDA2 = classCDATuple[5]; // {} +var t10 = [0 /* one */, 0 /* one */]; +var t11 = t10; +var array1 = emptyObjTuple; +// error +var t3 = numStrTuple; +var t9 = classCDTuple; +var array1 = numStrTuple; +t4[2] = 10; diff --git a/tests/baselines/reference/catchClauseWithTypeAnnotation.errors.txt b/tests/baselines/reference/catchClauseWithTypeAnnotation.errors.txt index 3052a7fb28a..d3eea6619b6 100644 --- a/tests/baselines/reference/catchClauseWithTypeAnnotation.errors.txt +++ b/tests/baselines/reference/catchClauseWithTypeAnnotation.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/catchClauseWithTypeAnnotation.ts(2,11): error TS1013: Catch clause parameter cannot have a type annotation. + + ==== tests/cases/compiler/catchClauseWithTypeAnnotation.ts (1 errors) ==== try { } catch (e: any) { ~ -!!! Catch clause parameter cannot have a type annotation. +!!! error TS1013: Catch clause parameter cannot have a type annotation. } \ No newline at end of file diff --git a/tests/baselines/reference/chainedAssignment1.errors.txt b/tests/baselines/reference/chainedAssignment1.errors.txt index 9bab75fe15c..29555d10dcb 100644 --- a/tests/baselines/reference/chainedAssignment1.errors.txt +++ b/tests/baselines/reference/chainedAssignment1.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/chainedAssignment1.ts(21,1): error TS2322: Type 'Z' is not assignable to type 'X': + Property 'a' is missing in type 'Z'. +tests/cases/compiler/chainedAssignment1.ts(21,6): error TS2322: Type 'Z' is not assignable to type 'Y': + Property 'a' is missing in type 'Z'. +tests/cases/compiler/chainedAssignment1.ts(22,1): error TS2323: Type 'Z' is not assignable to type 'Y'. + + ==== tests/cases/compiler/chainedAssignment1.ts (3 errors) ==== class X { constructor(public z) { } @@ -21,11 +28,11 @@ var c3 = new Z(); c1 = c2 = c3; // a bug made this not report the same error as below ~~ -!!! Type 'Z' is not assignable to type 'X': -!!! Property 'a' is missing in type 'Z'. +!!! error TS2322: Type 'Z' is not assignable to type 'X': +!!! error TS2322: Property 'a' is missing in type 'Z'. ~~ -!!! Type 'Z' is not assignable to type 'Y': -!!! Property 'a' is missing in type 'Z'. +!!! error TS2322: Type 'Z' is not assignable to type 'Y': +!!! error TS2322: Property 'a' is missing in type 'Z'. c2 = c3; // Error TS111: Cannot convert Z to Y ~~ -!!! Type 'Z' is not assignable to type 'Y'. \ No newline at end of file +!!! error TS2323: Type 'Z' is not assignable to type 'Y'. \ No newline at end of file diff --git a/tests/baselines/reference/chainedAssignment3.errors.txt b/tests/baselines/reference/chainedAssignment3.errors.txt index 61d34172032..758c3e2a332 100644 --- a/tests/baselines/reference/chainedAssignment3.errors.txt +++ b/tests/baselines/reference/chainedAssignment3.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/chainedAssignment3.ts(18,1): error TS2322: Type 'A' is not assignable to type 'B': + Property 'value' is missing in type 'A'. +tests/cases/compiler/chainedAssignment3.ts(19,5): error TS2323: Type 'A' is not assignable to type 'B'. + + ==== tests/cases/compiler/chainedAssignment3.ts (2 errors) ==== class A { id: number; @@ -18,11 +23,11 @@ // error cases b = a = new A(); ~ -!!! Type 'A' is not assignable to type 'B': -!!! Property 'value' is missing in type 'A'. +!!! error TS2322: Type 'A' is not assignable to type 'B': +!!! error TS2322: Property 'value' is missing in type 'A'. a = b = new A(); ~ -!!! Type 'A' is not assignable to type 'B'. +!!! error TS2323: Type 'A' is not assignable to type 'B'. \ No newline at end of file diff --git a/tests/baselines/reference/chainedAssignmentChecking.errors.txt b/tests/baselines/reference/chainedAssignmentChecking.errors.txt index f5580d38c03..3748995e4f0 100644 --- a/tests/baselines/reference/chainedAssignmentChecking.errors.txt +++ b/tests/baselines/reference/chainedAssignmentChecking.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/chainedAssignmentChecking.ts(21,1): error TS2322: Type 'Z' is not assignable to type 'X': + Property 'a' is missing in type 'Z'. +tests/cases/compiler/chainedAssignmentChecking.ts(21,6): error TS2322: Type 'Z' is not assignable to type 'Y': + Property 'a' is missing in type 'Z'. + + ==== tests/cases/compiler/chainedAssignmentChecking.ts (2 errors) ==== class X { constructor(public z) { } @@ -21,9 +27,9 @@ c1 = c2 = c3; // Should be error ~~ -!!! Type 'Z' is not assignable to type 'X': -!!! Property 'a' is missing in type 'Z'. +!!! error TS2322: Type 'Z' is not assignable to type 'X': +!!! error TS2322: Property 'a' is missing in type 'Z'. ~~ -!!! Type 'Z' is not assignable to type 'Y': -!!! Property 'a' is missing in type 'Z'. +!!! error TS2322: Type 'Z' is not assignable to type 'Y': +!!! error TS2322: Property 'a' is missing in type 'Z'. \ No newline at end of file diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt index 0448b6d44a0..be465275de5 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,59): error TS2345: Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'. + + ==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (1 errors) ==== class Chain { constructor(public value: T) { } @@ -19,4 +22,4 @@ // Ok to go down the chain, but error to try to climb back up (new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A); ~~~~~~~~~~ -!!! Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'. \ No newline at end of file +!!! error TS2345: Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'. \ No newline at end of file diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt index 3cb1395700d..26df8a15ca0 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(7,43): error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'. +tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(10,29): error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'. +tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2323: Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts (5 errors) ==== class Chain { constructor(public value: T) { } @@ -7,12 +14,12 @@ // Ok to go down the chain, but error to climb up the chain (new Chain(t)).then(tt => s).then(ss => t); ~~~~~~~ -!!! Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'. +!!! error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'. // But error to try to climb up the chain (new Chain(s)).then(ss => t); ~~~~~~~ -!!! Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'. +!!! error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'. // Staying at T or S should be fine (new Chain(t)).then(tt => t).then(tt => t).then(tt => t); @@ -36,16 +43,16 @@ // Should get an error that we are assigning a string to a number (new Chain2(i)).then(ii => t).then(tt => s).value.x = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. // Staying at T or S should keep the constraint. // Get an error when we assign a string to a number in both cases (new Chain2(i)).then(ii => t).then(tt => t).then(tt => t).then(tt => t).value.x = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. (new Chain2(i)).then(ii => s).then(ss => s).then(ss => s).then(ss => s).value.x = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. return null; } diff --git a/tests/baselines/reference/checkForObjectTooStrict.errors.txt b/tests/baselines/reference/checkForObjectTooStrict.errors.txt index cc2cfc4cf7d..7af7481f6ae 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.errors.txt +++ b/tests/baselines/reference/checkForObjectTooStrict.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/checkForObjectTooStrict.ts(22,19): error TS2311: A class may only extend another class. +tests/cases/compiler/checkForObjectTooStrict.ts(26,9): error TS2335: 'super' can only be referenced in a derived class. + + ==== tests/cases/compiler/checkForObjectTooStrict.ts (2 errors) ==== module Foo { @@ -22,13 +26,13 @@ class Baz extends Object { ~~~~~~ -!!! A class may only extend another class. +!!! error TS2311: A class may only extend another class. constructor () { // ERROR, as expected super(); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } diff --git a/tests/baselines/reference/circularModuleImports.errors.txt b/tests/baselines/reference/circularModuleImports.errors.txt index 8ce4566a683..9423ddd05ff 100644 --- a/tests/baselines/reference/circularModuleImports.errors.txt +++ b/tests/baselines/reference/circularModuleImports.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/circularModuleImports.ts(5,5): error TS2303: Circular definition of import alias 'A'. + + ==== tests/cases/compiler/circularModuleImports.ts (1 errors) ==== module M @@ -5,7 +8,7 @@ import A = B; ~~~~~~~~~~~~~ -!!! Circular definition of import alias 'A'. +!!! error TS2303: Circular definition of import alias 'A'. import B = A; diff --git a/tests/baselines/reference/circularReference.errors.txt b/tests/baselines/reference/circularReference.errors.txt index 2a825b9fc87..667d1ca895d 100644 --- a/tests/baselines/reference/circularReference.errors.txt +++ b/tests/baselines/reference/circularReference.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(9,12): error TS2339: Property 'x' does not exist on type 'C1'. +tests/cases/conformance/externalModules/foo2.ts(8,12): error TS2339: Property 'y' does not exist on type 'C1'. +tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x' does not exist on type 'C1'. + + ==== tests/cases/conformance/externalModules/foo2.ts (2 errors) ==== import foo1 = require('./foo1'); export module M1 { @@ -8,14 +14,14 @@ this.m1 = new foo1.M1.C1(); this.m1.y = 10; // Error ~ -!!! Property 'y' does not exist on type 'C1'. +!!! error TS2339: Property 'y' does not exist on type 'C1'. this.m1.x = 20; // OK var tmp = new M1.C1(); tmp.y = 10; // OK tmp.x = 20; // Error ~ -!!! Property 'x' does not exist on type 'C1'. +!!! error TS2339: Property 'x' does not exist on type 'C1'. } } } @@ -23,7 +29,7 @@ ==== tests/cases/conformance/externalModules/foo1.ts (2 errors) ==== import foo2 = require('./foo2'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. export module M1 { export class C1 { m1: foo2.M1.C1; @@ -33,7 +39,7 @@ this.m1.y = 10; // OK this.m1.x = 20; // Error ~ -!!! Property 'x' does not exist on type 'C1'. +!!! error TS2339: Property 'x' does not exist on type 'C1'. } } } diff --git a/tests/baselines/reference/class1.errors.txt b/tests/baselines/reference/class1.errors.txt index 9acb45f4c2a..b90fae9cb40 100644 --- a/tests/baselines/reference/class1.errors.txt +++ b/tests/baselines/reference/class1.errors.txt @@ -1,5 +1,11 @@ -==== tests/cases/compiler/class1.ts (1 errors) ==== - interface foo{ } - class foo{ } +tests/cases/compiler/class1.ts(1,11): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/class1.ts(2,7): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/compiler/class1.ts (2 errors) ==== + interface foo{ } // error + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + class foo{ } // error ~~~ -!!! Duplicate identifier 'foo'. \ No newline at end of file +!!! error TS2300: Duplicate identifier 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/class1.js b/tests/baselines/reference/class1.js index 96b279e58c6..7a104e237b6 100644 --- a/tests/baselines/reference/class1.js +++ b/tests/baselines/reference/class1.js @@ -1,10 +1,10 @@ //// [class1.ts] -interface foo{ } -class foo{ } +interface foo{ } // error +class foo{ } // error //// [class1.js] var foo = (function () { function foo() { } return foo; -})(); +})(); // error diff --git a/tests/baselines/reference/class2.errors.txt b/tests/baselines/reference/class2.errors.txt index 5e362d9941a..dde3612b68f 100644 --- a/tests/baselines/reference/class2.errors.txt +++ b/tests/baselines/reference/class2.errors.txt @@ -1,6 +1,10 @@ +tests/cases/compiler/class2.ts(1,29): error TS1129: Statement expected. +tests/cases/compiler/class2.ts(1,45): error TS1128: Declaration or statement expected. + + ==== tests/cases/compiler/class2.ts (2 errors) ==== class foo { constructor() { static f = 3; } } ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. ~ -!!! Declaration or statement expected. \ No newline at end of file +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/classAndInterface1.errors.txt b/tests/baselines/reference/classAndInterface1.errors.txt index 6d6bb495c3d..8d31e847d71 100644 --- a/tests/baselines/reference/classAndInterface1.errors.txt +++ b/tests/baselines/reference/classAndInterface1.errors.txt @@ -1,5 +1,11 @@ -==== tests/cases/compiler/classAndInterface1.ts (1 errors) ==== - class cli { } +tests/cases/compiler/classAndInterface1.ts(1,8): error TS2300: Duplicate identifier 'cli'. +tests/cases/compiler/classAndInterface1.ts(2,11): error TS2300: Duplicate identifier 'cli'. + + +==== tests/cases/compiler/classAndInterface1.ts (2 errors) ==== + class cli { } // error + ~~~ +!!! error TS2300: Duplicate identifier 'cli'. interface cli { } // error ~~~ -!!! Duplicate identifier 'cli'. \ No newline at end of file +!!! error TS2300: Duplicate identifier 'cli'. \ No newline at end of file diff --git a/tests/baselines/reference/classAndInterface1.js b/tests/baselines/reference/classAndInterface1.js index 74eec3e942e..5efabded838 100644 --- a/tests/baselines/reference/classAndInterface1.js +++ b/tests/baselines/reference/classAndInterface1.js @@ -1,5 +1,5 @@ //// [classAndInterface1.ts] -class cli { } + class cli { } // error interface cli { } // error //// [classAndInterface1.js] @@ -7,4 +7,4 @@ var cli = (function () { function cli() { } return cli; -})(); +})(); // error diff --git a/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt b/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt index 95c1893ff1d..aa3e687cf4d 100644 --- a/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt +++ b/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt @@ -1,17 +1,27 @@ -==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts (2 errors) ==== +tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(1,7): error TS2300: Duplicate identifier 'C'. +tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(2,11): error TS2300: Duplicate identifier 'C'. +tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(5,11): error TS2300: Duplicate identifier 'D'. +tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(9,15): error TS2300: Duplicate identifier 'D'. + + +==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts (4 errors) ==== class C { foo: string; } + ~ +!!! error TS2300: Duplicate identifier 'C'. interface C { foo: string; } // error ~ -!!! Duplicate identifier 'C'. +!!! error TS2300: Duplicate identifier 'C'. module M { class D { + ~ +!!! error TS2300: Duplicate identifier 'D'. bar: string; } interface D { // error ~ -!!! Duplicate identifier 'D'. +!!! error TS2300: Duplicate identifier 'D'. bar: string; } } \ No newline at end of file diff --git a/tests/baselines/reference/classAndVariableWithSameName.errors.txt b/tests/baselines/reference/classAndVariableWithSameName.errors.txt index fa9d852a976..2e8c16d4494 100644 --- a/tests/baselines/reference/classAndVariableWithSameName.errors.txt +++ b/tests/baselines/reference/classAndVariableWithSameName.errors.txt @@ -1,15 +1,25 @@ -==== tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts (2 errors) ==== - class C { foo: string; } +tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts(1,7): error TS2300: Duplicate identifier 'C'. +tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts(2,5): error TS2300: Duplicate identifier 'C'. +tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts(5,11): error TS2300: Duplicate identifier 'D'. +tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts(9,9): error TS2300: Duplicate identifier 'D'. + + +==== tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts (4 errors) ==== + class C { foo: string; } // error + ~ +!!! error TS2300: Duplicate identifier 'C'. var C = ''; // error ~ -!!! Duplicate identifier 'C'. +!!! error TS2300: Duplicate identifier 'C'. module M { - class D { + class D { // error + ~ +!!! error TS2300: Duplicate identifier 'D'. bar: string; } var D = 1; // error ~ -!!! Duplicate identifier 'D'. +!!! error TS2300: Duplicate identifier 'D'. } \ No newline at end of file diff --git a/tests/baselines/reference/classAndVariableWithSameName.js b/tests/baselines/reference/classAndVariableWithSameName.js index ab17905d5b2..1d547dc5508 100644 --- a/tests/baselines/reference/classAndVariableWithSameName.js +++ b/tests/baselines/reference/classAndVariableWithSameName.js @@ -1,9 +1,9 @@ //// [classAndVariableWithSameName.ts] -class C { foo: string; } +class C { foo: string; } // error var C = ''; // error module M { - class D { + class D { // error bar: string; } @@ -15,7 +15,7 @@ var C = (function () { function C() { } return C; -})(); +})(); // error var C = ''; // error var M; (function (M) { diff --git a/tests/baselines/reference/classBodyWithStatements.errors.txt b/tests/baselines/reference/classBodyWithStatements.errors.txt index 840402821fa..6da42dbb6bf 100644 --- a/tests/baselines/reference/classBodyWithStatements.errors.txt +++ b/tests/baselines/reference/classBodyWithStatements.errors.txt @@ -1,19 +1,25 @@ +tests/cases/conformance/classes/classDeclarations/classBody/classBodyWithStatements.ts(2,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/conformance/classes/classDeclarations/classBody/classBodyWithStatements.ts(3,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/classes/classDeclarations/classBody/classBodyWithStatements.ts(6,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/conformance/classes/classDeclarations/classBody/classBodyWithStatements.ts(7,1): error TS1128: Declaration or statement expected. + + ==== tests/cases/conformance/classes/classDeclarations/classBody/classBodyWithStatements.ts (4 errors) ==== class C { var x = 1; ~~~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. class C2 { function foo() {} ~~~~~~~~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. var x = 1; var y = 2; diff --git a/tests/baselines/reference/classCannotExtendVar.errors.txt b/tests/baselines/reference/classCannotExtendVar.errors.txt index 94d116248fa..5af07801bb4 100644 --- a/tests/baselines/reference/classCannotExtendVar.errors.txt +++ b/tests/baselines/reference/classCannotExtendVar.errors.txt @@ -1,9 +1,15 @@ -==== tests/cases/compiler/classCannotExtendVar.ts (1 errors) ==== +tests/cases/compiler/classCannotExtendVar.ts(1,5): error TS2300: Duplicate identifier 'Markup'. +tests/cases/compiler/classCannotExtendVar.ts(3,7): error TS2300: Duplicate identifier 'Markup'. + + +==== tests/cases/compiler/classCannotExtendVar.ts (2 errors) ==== var Markup; + ~~~~~~ +!!! error TS2300: Duplicate identifier 'Markup'. class Markup { ~~~~~~ -!!! Duplicate identifier 'Markup'. +!!! error TS2300: Duplicate identifier 'Markup'. constructor() { } } diff --git a/tests/baselines/reference/classConstructorAccessibility.errors.txt b/tests/baselines/reference/classConstructorAccessibility.errors.txt index fe2f1e22458..c22f3593bc5 100644 --- a/tests/baselines/reference/classConstructorAccessibility.errors.txt +++ b/tests/baselines/reference/classConstructorAccessibility.errors.txt @@ -1,4 +1,10 @@ -==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts (2 errors) ==== +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(6,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(10,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(23,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(27,9): error TS1089: 'protected' modifier cannot appear on a constructor declaration. + + +==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts (4 errors) ==== class C { public constructor(public x: number) { } } @@ -6,11 +12,18 @@ class D { private constructor(public x: number) { } // error ~~~~~~~ -!!! 'private' modifier cannot appear on a constructor declaration. +!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. + } + + class E { + protected constructor(public x: number) { } // error + ~~~~~~~~~ +!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. } var c = new C(1); var d = new D(1); + var e = new E(1); module Generic { class C { @@ -20,10 +33,17 @@ class D { private constructor(public x: T) { } // error ~~~~~~~ -!!! 'private' modifier cannot appear on a constructor declaration. +!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. + } + + class E { + protected constructor(public x: T) { } // error + ~~~~~~~~~ +!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. } var c = new C(1); var d = new D(1); + var e = new E(1); } \ No newline at end of file diff --git a/tests/baselines/reference/classConstructorParametersAccessibility.errors.txt b/tests/baselines/reference/classConstructorParametersAccessibility.errors.txt new file mode 100644 index 00000000000..029c3fae018 --- /dev/null +++ b/tests/baselines/reference/classConstructorParametersAccessibility.errors.txt @@ -0,0 +1,35 @@ +tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts(12,1): error TS2341: Property 'p' is private and only accessible within class 'C2'. +tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts(19,1): error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses. + + +==== tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility.ts (2 errors) ==== + class C1 { + constructor(public x: number) { } + } + var c1: C1; + c1.x // OK + + + class C2 { + constructor(private p: number) { } + } + var c2: C2; + c2.p // private, error + ~~~~ +!!! error TS2341: Property 'p' is private and only accessible within class 'C2'. + + + class C3 { + constructor(protected p: number) { } + } + var c3: C3; + c3.p // protected, error + ~~~~ +!!! error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses. + class Derived extends C3 { + constructor(p: number) { + super(p); + this.p; // OK + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/classConstructorParametersAccessibility.js b/tests/baselines/reference/classConstructorParametersAccessibility.js new file mode 100644 index 00000000000..03d56d94e58 --- /dev/null +++ b/tests/baselines/reference/classConstructorParametersAccessibility.js @@ -0,0 +1,67 @@ +//// [classConstructorParametersAccessibility.ts] +class C1 { + constructor(public x: number) { } +} +var c1: C1; +c1.x // OK + + +class C2 { + constructor(private p: number) { } +} +var c2: C2; +c2.p // private, error + + +class C3 { + constructor(protected p: number) { } +} +var c3: C3; +c3.p // protected, error +class Derived extends C3 { + constructor(p: number) { + super(p); + this.p; // OK + } +} + + +//// [classConstructorParametersAccessibility.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1(x) { + this.x = x; + } + return C1; +})(); +var c1; +c1.x; // OK +var C2 = (function () { + function C2(p) { + this.p = p; + } + return C2; +})(); +var c2; +c2.p; // private, error +var C3 = (function () { + function C3(p) { + this.p = p; + } + return C3; +})(); +var c3; +c3.p; // protected, error +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived(p) { + _super.call(this, p); + this.p; // OK + } + return Derived; +})(C3); diff --git a/tests/baselines/reference/classConstructorParametersAccessibility2.errors.txt b/tests/baselines/reference/classConstructorParametersAccessibility2.errors.txt new file mode 100644 index 00000000000..7c95a35e1da --- /dev/null +++ b/tests/baselines/reference/classConstructorParametersAccessibility2.errors.txt @@ -0,0 +1,35 @@ +tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility2.ts(12,1): error TS2341: Property 'p' is private and only accessible within class 'C2'. +tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility2.ts(19,1): error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses. + + +==== tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility2.ts (2 errors) ==== + class C1 { + constructor(public x?: number) { } + } + var c1: C1; + c1.x // OK + + + class C2 { + constructor(private p?: number) { } + } + var c2: C2; + c2.p // private, error + ~~~~ +!!! error TS2341: Property 'p' is private and only accessible within class 'C2'. + + + class C3 { + constructor(protected p?: number) { } + } + var c3: C3; + c3.p // protected, error + ~~~~ +!!! error TS2445: Property 'p' is protected and only accessible within class 'C3' and its subclasses. + class Derived extends C3 { + constructor(p: number) { + super(p); + this.p; // OK + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/classConstructorParametersAccessibility2.js b/tests/baselines/reference/classConstructorParametersAccessibility2.js new file mode 100644 index 00000000000..1b16d13c82a --- /dev/null +++ b/tests/baselines/reference/classConstructorParametersAccessibility2.js @@ -0,0 +1,67 @@ +//// [classConstructorParametersAccessibility2.ts] +class C1 { + constructor(public x?: number) { } +} +var c1: C1; +c1.x // OK + + +class C2 { + constructor(private p?: number) { } +} +var c2: C2; +c2.p // private, error + + +class C3 { + constructor(protected p?: number) { } +} +var c3: C3; +c3.p // protected, error +class Derived extends C3 { + constructor(p: number) { + super(p); + this.p; // OK + } +} + + +//// [classConstructorParametersAccessibility2.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1(x) { + this.x = x; + } + return C1; +})(); +var c1; +c1.x; // OK +var C2 = (function () { + function C2(p) { + this.p = p; + } + return C2; +})(); +var c2; +c2.p; // private, error +var C3 = (function () { + function C3(p) { + this.p = p; + } + return C3; +})(); +var c3; +c3.p; // protected, error +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived(p) { + _super.call(this, p); + this.p; // OK + } + return Derived; +})(C3); diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.js b/tests/baselines/reference/classConstructorParametersAccessibility3.js new file mode 100644 index 00000000000..9bd6c4bf7f5 --- /dev/null +++ b/tests/baselines/reference/classConstructorParametersAccessibility3.js @@ -0,0 +1,39 @@ +//// [classConstructorParametersAccessibility3.ts] +class Base { + constructor(protected p: number) { } +} + +class Derived extends Base { + constructor(public p: number) { + super(p); + this.p; // OK + } +} + +var d: Derived; +d.p; // public, OK + +//// [classConstructorParametersAccessibility3.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base(p) { + this.p = p; + } + return Base; +})(); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived(p) { + _super.call(this, p); + this.p = p; + this.p; // OK + } + return Derived; +})(Base); +var d; +d.p; // public, OK diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.types b/tests/baselines/reference/classConstructorParametersAccessibility3.types new file mode 100644 index 00000000000..3372044569c --- /dev/null +++ b/tests/baselines/reference/classConstructorParametersAccessibility3.types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/classes/constructorDeclarations/classConstructorParametersAccessibility3.ts === +class Base { +>Base : Base + + constructor(protected p: number) { } +>p : number +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + constructor(public p: number) { +>p : number + + super(p); +>super(p) : void +>super : typeof Base +>p : number + + this.p; // OK +>this.p : number +>this : Derived +>p : number + } +} + +var d: Derived; +>d : Derived +>Derived : Derived + +d.p; // public, OK +>d.p : number +>d : Derived +>p : number + diff --git a/tests/baselines/reference/classExpression.errors.txt b/tests/baselines/reference/classExpression.errors.txt index 220bd9581e8..5a2bc4fd179 100644 --- a/tests/baselines/reference/classExpression.errors.txt +++ b/tests/baselines/reference/classExpression.errors.txt @@ -1,27 +1,36 @@ +tests/cases/conformance/classes/classExpression.ts(1,9): error TS1109: Expression expected. +tests/cases/conformance/classes/classExpression.ts(5,10): error TS1109: Expression expected. +tests/cases/conformance/classes/classExpression.ts(5,16): error TS1005: ':' expected. +tests/cases/conformance/classes/classExpression.ts(5,19): error TS1005: ',' expected. +tests/cases/conformance/classes/classExpression.ts(7,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/classes/classExpression.ts(10,13): error TS1109: Expression expected. +tests/cases/conformance/classes/classExpression.ts(5,16): error TS2304: Cannot find name 'C2'. + + ==== tests/cases/conformance/classes/classExpression.ts (7 errors) ==== var x = class C { ~~~~~ -!!! Expression expected. +!!! error TS1109: Expression expected. } var y = { foo: class C2 { ~~~~~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~ -!!! ':' expected. +!!! error TS1005: ':' expected. ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~~ -!!! Cannot find name 'C2'. +!!! error TS2304: Cannot find name 'C2'. } } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. module M { var z = class C4 { ~~~~~ -!!! Expression expected. +!!! error TS1109: Expression expected. } } \ No newline at end of file diff --git a/tests/baselines/reference/classExtendingPrimitive.errors.txt b/tests/baselines/reference/classExtendingPrimitive.errors.txt index 5b3ddb4fe7a..cab86e9e38e 100644 --- a/tests/baselines/reference/classExtendingPrimitive.errors.txt +++ b/tests/baselines/reference/classExtendingPrimitive.errors.txt @@ -1,37 +1,50 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1003: Identifier expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS1003: Identifier expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,24): error TS1005: ';' expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(3,17): error TS2304: Cannot find name 'number'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(4,18): error TS2304: Cannot find name 'string'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(5,18): error TS2304: Cannot find name 'boolean'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(6,18): error TS2304: Cannot find name 'Void'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(8,18): error TS2304: Cannot find name 'Null'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(10,18): error TS2304: Cannot find name 'undefined'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(11,18): error TS2304: Cannot find name 'Undefined'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(14,18): error TS2311: A class may only extend another class. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts (11 errors) ==== // classes cannot extend primitives class C extends number { } ~~~~~~ -!!! Cannot find name 'number'. +!!! error TS2304: Cannot find name 'number'. class C2 extends string { } ~~~~~~ -!!! Cannot find name 'string'. +!!! error TS2304: Cannot find name 'string'. class C3 extends boolean { } ~~~~~~~ -!!! Cannot find name 'boolean'. +!!! error TS2304: Cannot find name 'boolean'. class C4 extends Void { } ~~~~ -!!! Cannot find name 'Void'. +!!! error TS2304: Cannot find name 'Void'. class C4a extends void {} ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. class C5 extends Null { } ~~~~ -!!! Cannot find name 'Null'. +!!! error TS2304: Cannot find name 'Null'. class C5a extends null { } ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. class C6 extends undefined { } ~~~~~~~~~ -!!! Cannot find name 'undefined'. +!!! error TS2304: Cannot find name 'undefined'. class C7 extends Undefined { } ~~~~~~~~~ -!!! Cannot find name 'Undefined'. +!!! error TS2304: Cannot find name 'Undefined'. enum E { A } class C8 extends E { } ~ -!!! A class may only extend another class. \ No newline at end of file +!!! error TS2311: A class may only extend another class. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendingPrimitive2.errors.txt b/tests/baselines/reference/classExtendingPrimitive2.errors.txt index 9d1f62d5350..9378c7bdc19 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.errors.txt +++ b/tests/baselines/reference/classExtendingPrimitive2.errors.txt @@ -1,11 +1,16 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(3,19): error TS1003: Identifier expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,19): error TS1003: Identifier expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,24): error TS1005: ';' expected. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts (3 errors) ==== // classes cannot extend primitives class C4a extends void {} ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. class C5a extends null { } ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ~ -!!! ';' expected. \ No newline at end of file +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendingQualifiedName.errors.txt b/tests/baselines/reference/classExtendingQualifiedName.errors.txt index 626c9d551c8..42eae691050 100644 --- a/tests/baselines/reference/classExtendingQualifiedName.errors.txt +++ b/tests/baselines/reference/classExtendingQualifiedName.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/classExtendingQualifiedName.ts(5,21): error TS2305: Module 'M' has no exported member 'C'. + + ==== tests/cases/compiler/classExtendingQualifiedName.ts (1 errors) ==== module M { class C { @@ -5,6 +8,6 @@ class D extends M.C { ~~~ -!!! Module 'M' has no exported member 'C'. +!!! error TS2305: Module 'M' has no exported member 'C'. } } \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.errors.txt b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.errors.txt index 01a09095a99..50c90389520 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.errors.txt +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/classExtendsClauseClassMergedWithModuleNotReferingConstructor.ts(10,21): error TS2419: Type name 'A' in extends clause does not reference constructor function for 'A'. + + ==== tests/cases/compiler/classExtendsClauseClassMergedWithModuleNotReferingConstructor.ts (1 errors) ==== class A { a: number; @@ -10,7 +13,7 @@ var A = 1; class B extends A { ~ -!!! Type name 'A' in extends clause does not reference constructor function for 'A'. +!!! error TS2419: Type name 'A' in extends clause does not reference constructor function for 'A'. b: string; } } \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.errors.txt b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.errors.txt index a3329ee1391..7f8b6fb411b 100644 --- a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.errors.txt +++ b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/classExtendsClauseClassNotReferringConstructor.ts(4,21): error TS2419: Type name 'A' in extends clause does not reference constructor function for 'A'. + + ==== tests/cases/compiler/classExtendsClauseClassNotReferringConstructor.ts (1 errors) ==== class A { a: number; } module Foo { var A = 1; class B extends A { b: string; } ~ -!!! Type name 'A' in extends clause does not reference constructor function for 'A'. +!!! error TS2419: Type name 'A' in extends clause does not reference constructor function for 'A'. } \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsEveryObjectType.errors.txt b/tests/baselines/reference/classExtendsEveryObjectType.errors.txt index 1c6dacfd6d7..35fc2d30a35 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.errors.txt +++ b/tests/baselines/reference/classExtendsEveryObjectType.errors.txt @@ -1,31 +1,40 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,18): error TS1003: Identifier expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS1003: Identifier expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,20): error TS1005: ';' expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(4,17): error TS2311: A class may only extend another class. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(8,18): error TS2304: Cannot find name 'x'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(11,18): error TS2304: Cannot find name 'M'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(14,18): error TS2304: Cannot find name 'foo'. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts (7 errors) ==== interface I { foo: string; } class C extends I { } // error ~ -!!! A class may only extend another class. +!!! error TS2311: A class may only extend another class. class C2 extends { foo: string; } { } // error ~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. var x: { foo: string; } class C3 extends x { } // error ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. module M { export var x = 1; } class C4 extends M { } // error ~ -!!! Cannot find name 'M'. +!!! error TS2304: Cannot find name 'M'. function foo() { } class C5 extends foo { } // error ~~~ -!!! Cannot find name 'foo'. +!!! error TS2304: Cannot find name 'foo'. class C6 extends []{ } // error ~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ~ -!!! ';' expected. \ No newline at end of file +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt b/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt index 7a5573ae000..a60745020e7 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt +++ b/tests/baselines/reference/classExtendsEveryObjectType2.errors.txt @@ -1,10 +1,15 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,18): error TS1003: Identifier expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,18): error TS1003: Identifier expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,20): error TS1005: ';' expected. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts (3 errors) ==== class C2 extends { foo: string; } { } // error ~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. class C6 extends []{ } // error ~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ~ -!!! ';' expected. \ No newline at end of file +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsInterface.errors.txt b/tests/baselines/reference/classExtendsInterface.errors.txt index 4274e5e7089..746f3c4bea0 100644 --- a/tests/baselines/reference/classExtendsInterface.errors.txt +++ b/tests/baselines/reference/classExtendsInterface.errors.txt @@ -1,13 +1,17 @@ +tests/cases/compiler/classExtendsInterface.ts(2,17): error TS2311: A class may only extend another class. +tests/cases/compiler/classExtendsInterface.ts(6,21): error TS2311: A class may only extend another class. + + ==== tests/cases/compiler/classExtendsInterface.ts (2 errors) ==== interface Comparable {} class A extends Comparable {} ~~~~~~~~~~ -!!! A class may only extend another class. +!!! error TS2311: A class may only extend another class. class B implements Comparable {} interface Comparable2 {} class A2 extends Comparable2 {} ~~~~~~~~~~~~~~ -!!! A class may only extend another class. +!!! error TS2311: A class may only extend another class. class B2 implements Comparable2 {} \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.errors.txt b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.errors.txt index a74abc33755..cff696696b7 100644 --- a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.errors.txt +++ b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/classExtendsInterfaceThatExtendsClassWithPrivates1.ts(10,7): error TS2421: Class 'D2' incorrectly implements interface 'I': + Types have separate declarations of a private property 'x'. + + ==== tests/cases/compiler/classExtendsInterfaceThatExtendsClassWithPrivates1.ts (1 errors) ==== class C { public foo(x: any) { return x; } @@ -10,8 +14,8 @@ class D2 implements I { ~~ -!!! Class 'D2' incorrectly implements interface 'I': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'D2' incorrectly implements interface 'I': +!!! error TS2421: Types have separate declarations of a private property 'x'. public foo(x: any) { return x } private x = 3; other(x: any) { return x } diff --git a/tests/baselines/reference/classExtendsItself.errors.txt b/tests/baselines/reference/classExtendsItself.errors.txt index 6168ca3802a..bd15ae22c12 100644 --- a/tests/baselines/reference/classExtendsItself.errors.txt +++ b/tests/baselines/reference/classExtendsItself.errors.txt @@ -1,12 +1,17 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItself.ts(1,7): error TS2310: Type 'C' recursively references itself as a base type. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItself.ts(3,7): error TS2310: Type 'D' recursively references itself as a base type. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItself.ts(5,7): error TS2310: Type 'E' recursively references itself as a base type. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItself.ts (3 errors) ==== class C extends C { } // error ~ -!!! Type 'C' recursively references itself as a base type. +!!! error TS2310: Type 'C' recursively references itself as a base type. class D extends D { } // error ~ -!!! Type 'D' recursively references itself as a base type. +!!! error TS2310: Type 'D' recursively references itself as a base type. class E extends E { } // error ~ -!!! Type 'E' recursively references itself as a base type. \ No newline at end of file +!!! error TS2310: Type 'E' recursively references itself as a base type. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt b/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt index 16184543cc3..b39ef5b905f 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt +++ b/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt @@ -1,7 +1,11 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(1,7): error TS2310: Type 'C' recursively references itself as a base type. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(7,7): error TS2310: Type 'C2' recursively references itself as a base type. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts (2 errors) ==== class C extends E { foo: string; } // error ~ -!!! Type 'C' recursively references itself as a base type. +!!! error TS2310: Type 'C' recursively references itself as a base type. class D extends C { bar: string; } @@ -9,7 +13,7 @@ class C2 extends E2 { foo: T; } // error ~~ -!!! Type 'C2' recursively references itself as a base type. +!!! error TS2310: Type 'C2' recursively references itself as a base type. class D2 extends C2 { bar: T; } diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt b/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt index 0a5dcdd6316..a61291b5aa9 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt @@ -1,7 +1,11 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(1,7): error TS2310: Type 'C' recursively references itself as a base type. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(13,11): error TS2310: Type 'C2' recursively references itself as a base type. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts (2 errors) ==== class C extends N.E { foo: string; } // error ~ -!!! Type 'C' recursively references itself as a base type. +!!! error TS2310: Type 'C' recursively references itself as a base type. module M { export class D extends C { bar: string; } @@ -15,7 +19,7 @@ module O { class C2 extends Q.E2 { foo: T; } // error ~~ -!!! Type 'C2' recursively references itself as a base type. +!!! error TS2310: Type 'C2' recursively references itself as a base type. module P { export class D2 extends C2 { bar: T; } diff --git a/tests/baselines/reference/classExtendsItselfIndirectly3.errors.txt b/tests/baselines/reference/classExtendsItselfIndirectly3.errors.txt index 3eeccb7e618..8430ec887b5 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly3.errors.txt +++ b/tests/baselines/reference/classExtendsItselfIndirectly3.errors.txt @@ -1,7 +1,11 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly_file1.ts(1,7): error TS2310: Type 'C' recursively references itself as a base type. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly_file4.ts(1,7): error TS2310: Type 'C2' recursively references itself as a base type. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly_file1.ts (1 errors) ==== class C extends E { foo: string; } // error ~ -!!! Type 'C' recursively references itself as a base type. +!!! error TS2310: Type 'C' recursively references itself as a base type. ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly_file2.ts (0 errors) ==== class D extends C { bar: string; } @@ -12,7 +16,7 @@ ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly_file4.ts (1 errors) ==== class C2 extends E2 { foo: T; } // error ~~ -!!! Type 'C2' recursively references itself as a base type. +!!! error TS2310: Type 'C2' recursively references itself as a base type. ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly_file5.ts (0 errors) ==== class D2 extends C2 { bar: T; } diff --git a/tests/baselines/reference/classExtendsMultipleBaseClasses.errors.txt b/tests/baselines/reference/classExtendsMultipleBaseClasses.errors.txt index 545c2b21961..86b271c9ae8 100644 --- a/tests/baselines/reference/classExtendsMultipleBaseClasses.errors.txt +++ b/tests/baselines/reference/classExtendsMultipleBaseClasses.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/classExtendsMultipleBaseClasses.ts(3,18): error TS1005: '{' expected. +tests/cases/compiler/classExtendsMultipleBaseClasses.ts(3,21): error TS1005: ';' expected. + + ==== tests/cases/compiler/classExtendsMultipleBaseClasses.ts (2 errors) ==== class A { } class B { } class C extends A,B { } ~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~ -!!! ';' expected. \ No newline at end of file +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsShadowedConstructorFunction.errors.txt b/tests/baselines/reference/classExtendsShadowedConstructorFunction.errors.txt index 516154005ce..782dd2a2dbc 100644 --- a/tests/baselines/reference/classExtendsShadowedConstructorFunction.errors.txt +++ b/tests/baselines/reference/classExtendsShadowedConstructorFunction.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsShadowedConstructorFunction.ts(5,21): error TS2419: Type name 'C' in extends clause does not reference constructor function for 'C'. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsShadowedConstructorFunction.ts (1 errors) ==== class C { foo: string; } @@ -5,7 +8,7 @@ var C = 1; class D extends C { // error, C must evaluate to constructor function ~ -!!! Type name 'C' in extends clause does not reference constructor function for 'C'. +!!! error TS2419: Type name 'C' in extends clause does not reference constructor function for 'C'. bar: string; } } \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsValidConstructorFunction.errors.txt b/tests/baselines/reference/classExtendsValidConstructorFunction.errors.txt index eb7571a2436..ad2262819ed 100644 --- a/tests/baselines/reference/classExtendsValidConstructorFunction.errors.txt +++ b/tests/baselines/reference/classExtendsValidConstructorFunction.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsValidConstructorFunction.ts(5,17): error TS2304: Cannot find name 'foo'. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsValidConstructorFunction.ts (1 errors) ==== function foo() { } @@ -5,4 +8,4 @@ class C extends foo { } // error, cannot extend it though ~~~ -!!! Cannot find name 'foo'. \ No newline at end of file +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/classHeritageWithTrailingSeparator.errors.txt b/tests/baselines/reference/classHeritageWithTrailingSeparator.errors.txt index 216f434d161..1a323fd5aa4 100644 --- a/tests/baselines/reference/classHeritageWithTrailingSeparator.errors.txt +++ b/tests/baselines/reference/classHeritageWithTrailingSeparator.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/classHeritageWithTrailingSeparator.ts(2,18): error TS1005: '{' expected. + + ==== tests/cases/compiler/classHeritageWithTrailingSeparator.ts (1 errors) ==== class C { foo: number } class D extends C, { ~ -!!! '{' expected. +!!! error TS1005: '{' expected. } \ No newline at end of file diff --git a/tests/baselines/reference/classImplementsClass2.errors.txt b/tests/baselines/reference/classImplementsClass2.errors.txt index a48b000b895..f1fabd8a975 100644 --- a/tests/baselines/reference/classImplementsClass2.errors.txt +++ b/tests/baselines/reference/classImplementsClass2.errors.txt @@ -1,9 +1,15 @@ +tests/cases/compiler/classImplementsClass2.ts(2,7): error TS2421: Class 'C' incorrectly implements interface 'A': + Property 'foo' is missing in type 'C'. +tests/cases/compiler/classImplementsClass2.ts(13,1): error TS2322: Type 'C' is not assignable to type 'C2': + Property 'foo' is missing in type 'C'. + + ==== tests/cases/compiler/classImplementsClass2.ts (2 errors) ==== class A { foo(): number { return 1; } } class C implements A {} // error ~ -!!! Class 'C' incorrectly implements interface 'A': -!!! Property 'foo' is missing in type 'C'. +!!! error TS2421: Class 'C' incorrectly implements interface 'A': +!!! error TS2421: Property 'foo' is missing in type 'C'. class C2 extends A { foo() { @@ -16,5 +22,5 @@ c = c2; c2 = c; ~~ -!!! Type 'C' is not assignable to type 'C2': -!!! Property 'foo' is missing in type 'C'. \ No newline at end of file +!!! error TS2322: Type 'C' is not assignable to type 'C2': +!!! error TS2322: Property 'foo' is missing in type 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/classImplementsClass4.errors.txt b/tests/baselines/reference/classImplementsClass4.errors.txt index eb9848c63a9..7539cb1a752 100644 --- a/tests/baselines/reference/classImplementsClass4.errors.txt +++ b/tests/baselines/reference/classImplementsClass4.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/classImplementsClass4.ts(5,7): error TS2421: Class 'C' incorrectly implements interface 'A': + Property 'x' is missing in type 'C'. +tests/cases/compiler/classImplementsClass4.ts(16,1): error TS2322: Type 'C' is not assignable to type 'C2': + Property 'x' is missing in type 'C'. + + ==== tests/cases/compiler/classImplementsClass4.ts (2 errors) ==== class A { private x = 1; @@ -5,8 +11,8 @@ } class C implements A { ~ -!!! Class 'C' incorrectly implements interface 'A': -!!! Property 'x' is missing in type 'C'. +!!! error TS2421: Class 'C' incorrectly implements interface 'A': +!!! error TS2421: Property 'x' is missing in type 'C'. foo() { return 1; } @@ -19,5 +25,5 @@ c = c2; c2 = c; ~~ -!!! Type 'C' is not assignable to type 'C2': -!!! Property 'x' is missing in type 'C'. \ No newline at end of file +!!! error TS2322: Type 'C' is not assignable to type 'C2': +!!! error TS2322: Property 'x' is missing in type 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/classImplementsClass5.errors.txt b/tests/baselines/reference/classImplementsClass5.errors.txt index 97f83fc83f8..6328e595e13 100644 --- a/tests/baselines/reference/classImplementsClass5.errors.txt +++ b/tests/baselines/reference/classImplementsClass5.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/classImplementsClass5.ts(5,7): error TS2421: Class 'C' incorrectly implements interface 'A': + Types have separate declarations of a private property 'x'. +tests/cases/compiler/classImplementsClass5.ts(16,1): error TS2322: Type 'C2' is not assignable to type 'C': + Types have separate declarations of a private property 'x'. +tests/cases/compiler/classImplementsClass5.ts(17,1): error TS2322: Type 'C' is not assignable to type 'C2': + Types have separate declarations of a private property 'x'. + + ==== tests/cases/compiler/classImplementsClass5.ts (3 errors) ==== class A { private x = 1; @@ -5,8 +13,8 @@ } class C implements A { ~ -!!! Class 'C' incorrectly implements interface 'A': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'C' incorrectly implements interface 'A': +!!! error TS2421: Types have separate declarations of a private property 'x'. private x = 1; foo() { return 1; @@ -19,9 +27,9 @@ var c2: C2; c = c2; ~ -!!! Type 'C2' is not assignable to type 'C': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2322: Type 'C2' is not assignable to type 'C': +!!! error TS2322: Types have separate declarations of a private property 'x'. c2 = c; ~~ -!!! Type 'C' is not assignable to type 'C2': -!!! Private property 'x' cannot be reimplemented. \ No newline at end of file +!!! error TS2322: Type 'C' is not assignable to type 'C2': +!!! error TS2322: Types have separate declarations of a private property 'x'. \ No newline at end of file diff --git a/tests/baselines/reference/classImplementsClass6.errors.txt b/tests/baselines/reference/classImplementsClass6.errors.txt index 789c579fe94..706f94c8fbb 100644 --- a/tests/baselines/reference/classImplementsClass6.errors.txt +++ b/tests/baselines/reference/classImplementsClass6.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/classImplementsClass6.ts(20,3): error TS2339: Property 'bar' does not exist on type 'C'. +tests/cases/compiler/classImplementsClass6.ts(21,4): error TS2339: Property 'bar' does not exist on type 'C2'. + + ==== tests/cases/compiler/classImplementsClass6.ts (2 errors) ==== class A { static bar(): string { @@ -20,7 +24,7 @@ c2 = c; c.bar(); // error ~~~ -!!! Property 'bar' does not exist on type 'C'. +!!! error TS2339: Property 'bar' does not exist on type 'C'. c2.bar(); // should error ~~~ -!!! Property 'bar' does not exist on type 'C2'. \ No newline at end of file +!!! error TS2339: Property 'bar' does not exist on type 'C2'. \ No newline at end of file diff --git a/tests/baselines/reference/classIndexer2.errors.txt b/tests/baselines/reference/classIndexer2.errors.txt index 4278564d8ff..82629584ee5 100644 --- a/tests/baselines/reference/classIndexer2.errors.txt +++ b/tests/baselines/reference/classIndexer2.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/classIndexer2.ts(4,5): error TS2411: Property 'y' of type 'string' is not assignable to string index type 'number'. + + ==== tests/cases/compiler/classIndexer2.ts (1 errors) ==== class C123 { [s: string]: number; x: number; y: string; ~~~~~~~~~~ -!!! Property 'y' of type 'string' is not assignable to string index type 'number'. +!!! error TS2411: Property 'y' of type 'string' is not assignable to string index type 'number'. constructor() { } } \ No newline at end of file diff --git a/tests/baselines/reference/classIndexer3.errors.txt b/tests/baselines/reference/classIndexer3.errors.txt index f923a3364a1..eb7a2467fba 100644 --- a/tests/baselines/reference/classIndexer3.errors.txt +++ b/tests/baselines/reference/classIndexer3.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/classIndexer3.ts(9,5): error TS2411: Property 'y' of type 'string' is not assignable to string index type 'number'. + + ==== tests/cases/compiler/classIndexer3.ts (1 errors) ==== class C123 { [s: string]: number; @@ -9,5 +12,5 @@ x: number; y: string; ~~~~~~~~~~ -!!! Property 'y' of type 'string' is not assignable to string index type 'number'. +!!! error TS2411: Property 'y' of type 'string' is not assignable to string index type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/classIndexer4.errors.txt b/tests/baselines/reference/classIndexer4.errors.txt index 06559adf909..f5a132b3dc2 100644 --- a/tests/baselines/reference/classIndexer4.errors.txt +++ b/tests/baselines/reference/classIndexer4.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/classIndexer4.ts(9,5): error TS2411: Property 'y' of type 'string' is not assignable to string index type 'number'. + + ==== tests/cases/compiler/classIndexer4.ts (1 errors) ==== class C123 { [s: string]: number; @@ -9,5 +12,5 @@ x: number; y: string; ~~~~~~~~~~ -!!! Property 'y' of type 'string' is not assignable to string index type 'number'. +!!! error TS2411: Property 'y' of type 'string' is not assignable to string index type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/classInheritence.errors.txt b/tests/baselines/reference/classInheritence.errors.txt index 0b655daf932..483812c6b5f 100644 --- a/tests/baselines/reference/classInheritence.errors.txt +++ b/tests/baselines/reference/classInheritence.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/classInheritence.ts(2,7): error TS2310: Type 'A' recursively references itself as a base type. + + ==== tests/cases/compiler/classInheritence.ts (1 errors) ==== class B extends A { } class A extends A { } ~ -!!! Type 'A' recursively references itself as a base type. \ No newline at end of file +!!! error TS2310: Type 'A' recursively references itself as a base type. \ No newline at end of file diff --git a/tests/baselines/reference/classIsSubtypeOfBaseType.errors.txt b/tests/baselines/reference/classIsSubtypeOfBaseType.errors.txt index fa5dcab0973..7ba816475fb 100644 --- a/tests/baselines/reference/classIsSubtypeOfBaseType.errors.txt +++ b/tests/baselines/reference/classIsSubtypeOfBaseType.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classIsSubtypeOfBaseType.ts(11,7): error TS2416: Class 'Derived2' incorrectly extends base class 'Base<{ bar: string; }>': + Types of property 'foo' are incompatible: + Type '{ bar?: string; }' is not assignable to type '{ bar: string; }': + Property 'bar' is optional in type '{ bar?: string; }' but required in type '{ bar: string; }'. + + ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classIsSubtypeOfBaseType.ts (1 errors) ==== class Base { foo: T; @@ -11,10 +17,10 @@ class Derived2 extends Base<{ bar: string; }> { ~~~~~~~~ -!!! Class 'Derived2' incorrectly extends base class 'Base<{ bar: string; }>': -!!! Types of property 'foo' are incompatible: -!!! Type '{ bar?: string; }' is not assignable to type '{ bar: string; }': -!!! Required property 'bar' cannot be reimplemented with optional property in '{ bar?: string; }'. +!!! error TS2416: Class 'Derived2' incorrectly extends base class 'Base<{ bar: string; }>': +!!! error TS2416: Types of property 'foo' are incompatible: +!!! error TS2416: Type '{ bar?: string; }' is not assignable to type '{ bar: string; }': +!!! error TS2416: Property 'bar' is optional in type '{ bar?: string; }' but required in type '{ bar: string; }'. foo: { bar?: string; // error } diff --git a/tests/baselines/reference/classMemberInitializerScoping.errors.txt b/tests/baselines/reference/classMemberInitializerScoping.errors.txt index c34cdca7c90..7df3c0518b6 100644 --- a/tests/baselines/reference/classMemberInitializerScoping.errors.txt +++ b/tests/baselines/reference/classMemberInitializerScoping.errors.txt @@ -1,14 +1,18 @@ +tests/cases/compiler/classMemberInitializerScoping.ts(3,17): error TS2301: Initializer of instance member variable 'y' cannot reference identifier 'aaa' declared in the constructor. +tests/cases/compiler/classMemberInitializerScoping.ts(6,9): error TS2323: Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/classMemberInitializerScoping.ts (2 errors) ==== var aaa = 1; class CCC { y: number = aaa; ~~~ -!!! Initializer of instance member variable 'y' cannot reference identifier 'aaa' declared in the constructor. +!!! error TS2301: Initializer of instance member variable 'y' cannot reference identifier 'aaa' declared in the constructor. static staticY: number = aaa; // This shouldnt be error constructor(aaa) { this.y = ''; // was: error, cannot assign string to number ~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. } } diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping.errors.txt index 6f05862d765..2fac6733cca 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/classMemberInitializerWithLamdaScoping.ts(23,21): error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. + + ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping.ts (1 errors) ==== declare var console: { log(msg?: any): void; @@ -23,7 +26,7 @@ messageHandler = () => { console.log(field1); // But this should be error as the field1 will resolve to var field1 ~~~~~~ -!!! Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. +!!! error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. // but since this code would be generated inside constructor, in generated js // it would resolve to private field1 and thats not what user intended here. }; diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping2.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping2.errors.txt index d5864dac852..7a41e8bdeed 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping2.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/classMemberInitializerWithLamdaScoping2_1.ts(8,21): error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. + + ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping2_0.ts (0 errors) ==== var field1: string; @@ -11,7 +14,7 @@ messageHandler = () => { console.log(field1); // But this should be error as the field1 will resolve to var field1 ~~~~~~ -!!! Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. +!!! error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. // but since this code would be generated inside constructor, in generated js // it would resolve to private field1 and thats not what user intended here. }; diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt index e77499fca31..f396b722263 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(4,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. + + ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (0 errors) ==== var field1: string; @@ -7,13 +11,13 @@ }; export class Test1 { ~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. constructor(private field1: string) { } messageHandler = () => { console.log(field1); // But this should be error as the field1 will resolve to var field1 ~~~~~~ -!!! Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. +!!! error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. // but since this code would be generated inside constructor, in generated js // it would resolve to private field1 and thats not what user intended here. }; diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt index 4926a2c6410..84e7994fd0c 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2304: Cannot find name 'field1'. + + ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (1 errors) ==== export var field1: string; ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts (1 errors) ==== declare var console: { @@ -13,6 +17,6 @@ messageHandler = () => { console.log(field1); // Should be error that couldnt find symbol field1 ~~~~~~ -!!! Cannot find name 'field1'. +!!! error TS2304: Cannot find name 'field1'. }; } \ No newline at end of file diff --git a/tests/baselines/reference/classOverloadForFunction.errors.txt b/tests/baselines/reference/classOverloadForFunction.errors.txt index eb3fe5bc33b..14bc27fb5ca 100644 --- a/tests/baselines/reference/classOverloadForFunction.errors.txt +++ b/tests/baselines/reference/classOverloadForFunction.errors.txt @@ -1,6 +1,12 @@ -==== tests/cases/compiler/classOverloadForFunction.ts (1 errors) ==== +tests/cases/compiler/classOverloadForFunction.ts(1,7): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/classOverloadForFunction.ts(2,10): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/compiler/classOverloadForFunction.ts (2 errors) ==== class foo { }; + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. function foo() {} ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/classOverloadForFunction2.errors.txt b/tests/baselines/reference/classOverloadForFunction2.errors.txt index 3d73a8bb3f3..4dd459c48ec 100644 --- a/tests/baselines/reference/classOverloadForFunction2.errors.txt +++ b/tests/baselines/reference/classOverloadForFunction2.errors.txt @@ -1,7 +1,14 @@ -==== tests/cases/compiler/classOverloadForFunction2.ts (2 errors) ==== +tests/cases/compiler/classOverloadForFunction2.ts(1,10): error TS2300: Duplicate identifier 'bar'. +tests/cases/compiler/classOverloadForFunction2.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/classOverloadForFunction2.ts(2,7): error TS2300: Duplicate identifier 'bar'. + + +==== tests/cases/compiler/classOverloadForFunction2.ts (3 errors) ==== function bar(): string; ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2300: Duplicate identifier 'bar'. + ~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. class bar {} ~~~ -!!! Duplicate identifier 'bar'. \ No newline at end of file +!!! error TS2300: Duplicate identifier 'bar'. \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyAsPrivate.errors.txt b/tests/baselines/reference/classPropertyAsPrivate.errors.txt index c5d922c0ad5..a5fdffe091a 100644 --- a/tests/baselines/reference/classPropertyAsPrivate.errors.txt +++ b/tests/baselines/reference/classPropertyAsPrivate.errors.txt @@ -1,21 +1,35 @@ +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(3,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(4,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(8,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(9,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(15,1): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(16,1): error TS2341: Property 'y' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(17,1): error TS2341: Property 'y' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(18,1): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(20,1): error TS2341: Property 'a' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(21,1): error TS2341: Property 'b' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(22,1): error TS2341: Property 'b' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(23,1): error TS2341: Property 'foo' is private and only accessible within class 'C'. + + ==== tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts (12 errors) ==== class C { private x: string; private get y() { return null; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. private set y(x) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. private foo() { } private static a: string; private static get b() { return null; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. private static set b(x) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. private static foo() { } } @@ -23,26 +37,26 @@ // all errors c.x; ~~~ -!!! Property 'C.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. c.y; ~~~ -!!! Property 'C.y' is inaccessible. +!!! error TS2341: Property 'y' is private and only accessible within class 'C'. c.y = 1; ~~~ -!!! Property 'C.y' is inaccessible. +!!! error TS2341: Property 'y' is private and only accessible within class 'C'. c.foo(); ~~~~~ -!!! Property 'C.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'C'. C.a; ~~~ -!!! Property 'C.a' is inaccessible. +!!! error TS2341: Property 'a' is private and only accessible within class 'C'. C.b(); ~~~ -!!! Property 'C.b' is inaccessible. +!!! error TS2341: Property 'b' is private and only accessible within class 'C'. C.b = 1; ~~~ -!!! Property 'C.b' is inaccessible. +!!! error TS2341: Property 'b' is private and only accessible within class 'C'. C.foo(); ~~~~~ -!!! Property 'C.foo' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'foo' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyAsProtected.errors.txt b/tests/baselines/reference/classPropertyAsProtected.errors.txt new file mode 100644 index 00000000000..570ebc718ac --- /dev/null +++ b/tests/baselines/reference/classPropertyAsProtected.errors.txt @@ -0,0 +1,62 @@ +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(3,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(4,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(8,26): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(9,26): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(15,1): error TS2445: Property 'x' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(16,1): error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(17,1): error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(18,1): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(20,1): error TS2445: Property 'a' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(21,1): error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(22,1): error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(23,1): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. + + +==== tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts (12 errors) ==== + class C { + protected x: string; + protected get y() { return null; } + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + protected set y(x) { } + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + protected foo() { } + + protected static a: string; + protected static get b() { return null; } + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + protected static set b(x) { } + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + protected static foo() { } + } + + var c: C; + // all errors + c.x; + ~~~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'C' and its subclasses. + c.y; + ~~~ +!!! error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. + c.y = 1; + ~~~ +!!! error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. + c.foo(); + ~~~~~ +!!! error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. + + C.a; + ~~~ +!!! error TS2445: Property 'a' is protected and only accessible within class 'C' and its subclasses. + C.b(); + ~~~ +!!! error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. + C.b = 1; + ~~~ +!!! error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. + C.foo(); + ~~~~~ +!!! error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyIsPublicByDefault.errors.txt b/tests/baselines/reference/classPropertyIsPublicByDefault.errors.txt index c8c7f86dde0..1d200f6e2e7 100644 --- a/tests/baselines/reference/classPropertyIsPublicByDefault.errors.txt +++ b/tests/baselines/reference/classPropertyIsPublicByDefault.errors.txt @@ -1,21 +1,27 @@ +tests/cases/conformance/classes/members/accessibility/classPropertyIsPublicByDefault.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyIsPublicByDefault.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyIsPublicByDefault.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyIsPublicByDefault.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/conformance/classes/members/accessibility/classPropertyIsPublicByDefault.ts (4 errors) ==== class C { x: string; get y() { return null; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. set y(x) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. foo() { } static a: string; static get b() { return null; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static set b(x) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static foo() { } } diff --git a/tests/baselines/reference/classSideInheritance1.errors.txt b/tests/baselines/reference/classSideInheritance1.errors.txt index fa1035551ed..b1f02bac123 100644 --- a/tests/baselines/reference/classSideInheritance1.errors.txt +++ b/tests/baselines/reference/classSideInheritance1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/classSideInheritance1.ts(12,3): error TS2339: Property 'bar' does not exist on type 'A'. +tests/cases/compiler/classSideInheritance1.ts(13,3): error TS2339: Property 'bar' does not exist on type 'C2'. + + ==== tests/cases/compiler/classSideInheritance1.ts (2 errors) ==== class A { static bar(): string { @@ -12,9 +16,9 @@ var c: C2; a.bar(); // static off an instance - should be an error ~~~ -!!! Property 'bar' does not exist on type 'A'. +!!! error TS2339: Property 'bar' does not exist on type 'A'. c.bar(); // static off an instance - should be an error ~~~ -!!! Property 'bar' does not exist on type 'C2'. +!!! error TS2339: Property 'bar' does not exist on type 'C2'. A.bar(); // valid C2.bar(); // valid \ No newline at end of file diff --git a/tests/baselines/reference/classSideInheritance3.errors.txt b/tests/baselines/reference/classSideInheritance3.errors.txt index c7ce9606b02..48d7165adcd 100644 --- a/tests/baselines/reference/classSideInheritance3.errors.txt +++ b/tests/baselines/reference/classSideInheritance3.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/classSideInheritance3.ts(16,5): error TS2323: Type 'typeof B' is not assignable to type 'typeof A'. +tests/cases/compiler/classSideInheritance3.ts(17,5): error TS2323: Type 'typeof B' is not assignable to type 'new (x: string) => A'. + + ==== tests/cases/compiler/classSideInheritance3.ts (2 errors) ==== class A { constructor(public x: string) { @@ -16,8 +20,8 @@ var r1: typeof A = B; // error ~~ -!!! Type 'typeof B' is not assignable to type 'typeof A'. +!!! error TS2323: Type 'typeof B' is not assignable to type 'typeof A'. var r2: new (x: string) => A = B; // error ~~ -!!! Type 'typeof B' is not assignable to type 'new (x: string) => A'. +!!! error TS2323: Type 'typeof B' is not assignable to type 'new (x: string) => A'. var r3: typeof A = C; // ok \ No newline at end of file diff --git a/tests/baselines/reference/classTypeParametersInStatics.errors.txt b/tests/baselines/reference/classTypeParametersInStatics.errors.txt index 8fc40c979f7..cc1336a8804 100644 --- a/tests/baselines/reference/classTypeParametersInStatics.errors.txt +++ b/tests/baselines/reference/classTypeParametersInStatics.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/classTypeParametersInStatics.ts(12,40): error TS2302: Static members cannot reference class type parameters. +tests/cases/compiler/classTypeParametersInStatics.ts(13,29): error TS2302: Static members cannot reference class type parameters. +tests/cases/compiler/classTypeParametersInStatics.ts(13,43): error TS2302: Static members cannot reference class type parameters. + + ==== tests/cases/compiler/classTypeParametersInStatics.ts (3 errors) ==== module Editor { @@ -12,12 +17,12 @@ public static MakeHead(): List { // should error ~ -!!! Static members cannot reference class type parameters. +!!! error TS2302: Static members cannot reference class type parameters. var entry: List = new List(true, null); ~ -!!! Static members cannot reference class type parameters. +!!! error TS2302: Static members cannot reference class type parameters. ~ -!!! Static members cannot reference class type parameters. +!!! error TS2302: Static members cannot reference class type parameters. entry.prev = entry; entry.next = entry; return entry; diff --git a/tests/baselines/reference/classUpdateTests.errors.txt b/tests/baselines/reference/classUpdateTests.errors.txt index f7f4036254b..4548560df15 100644 --- a/tests/baselines/reference/classUpdateTests.errors.txt +++ b/tests/baselines/reference/classUpdateTests.errors.txt @@ -1,3 +1,23 @@ +tests/cases/compiler/classUpdateTests.ts(93,3): error TS1129: Statement expected. +tests/cases/compiler/classUpdateTests.ts(95,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/classUpdateTests.ts(99,3): error TS1129: Statement expected. +tests/cases/compiler/classUpdateTests.ts(101,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/classUpdateTests.ts(105,3): error TS1129: Statement expected. +tests/cases/compiler/classUpdateTests.ts(111,3): error TS1129: Statement expected. +tests/cases/compiler/classUpdateTests.ts(34,2): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/classUpdateTests.ts(43,18): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/compiler/classUpdateTests.ts(46,17): error TS2311: A class may only extend another class. +tests/cases/compiler/classUpdateTests.ts(47,18): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/compiler/classUpdateTests.ts(57,2): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +tests/cases/compiler/classUpdateTests.ts(63,7): error TS2416: Class 'L' incorrectly extends base class 'G': + Property 'p1' is private in type 'L' but not in type 'G'. +tests/cases/compiler/classUpdateTests.ts(69,7): error TS2416: Class 'M' incorrectly extends base class 'G': + Property 'p1' is private in type 'M' but not in type 'G'. +tests/cases/compiler/classUpdateTests.ts(70,2): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +tests/cases/compiler/classUpdateTests.ts(105,15): error TS2339: Property 'p1' does not exist on type 'Q'. +tests/cases/compiler/classUpdateTests.ts(111,16): error TS2339: Property 'p1' does not exist on type 'R'. + + ==== tests/cases/compiler/classUpdateTests.ts (16 errors) ==== // // test codegen for instance properties @@ -34,7 +54,7 @@ class F extends E { constructor() {} // ERROR - super call required ~~~~~~~~~~~~~~~~ -!!! Constructors for derived classes must contain a 'super' call. +!!! error TS2377: Constructors for derived classes must contain a 'super' call. } class G extends D { @@ -45,15 +65,15 @@ class H { constructor() { super(); } // ERROR - no super call allowed ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } class I extends Object { ~~~~~~ -!!! A class may only extend another class. +!!! error TS2311: A class may only extend another class. constructor() { super(); } // ERROR - no super call allowed ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } class J extends G { @@ -71,13 +91,13 @@ ~~~~~~~~~~ } ~~ -!!! A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class L extends G { ~ -!!! Class 'L' incorrectly extends base class 'G': -!!! Private property 'p1' cannot be reimplemented. +!!! error TS2416: Class 'L' incorrectly extends base class 'G': +!!! error TS2416: Property 'p1' is private in type 'L' but not in type 'G'. constructor(private p1:number) { super(); // NO ERROR } @@ -85,8 +105,8 @@ class M extends G { ~ -!!! Class 'M' incorrectly extends base class 'G': -!!! Private property 'p1' cannot be reimplemented. +!!! error TS2416: Class 'M' incorrectly extends base class 'G': +!!! error TS2416: Property 'p1' is private in type 'M' but not in type 'G'. constructor(private p1:number) { // ERROR ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var i = 0; @@ -95,7 +115,7 @@ ~~~~~~~~~~ } ~~ -!!! A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } // @@ -117,29 +137,29 @@ constructor() { public p1 = 0; // ERROR ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. } } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. class P { constructor() { private p1 = 0; // ERROR ~~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. } } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. class Q { constructor() { public this.p1 = 0; // ERROR ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. ~~ -!!! Property 'p1' does not exist on type 'Q'. +!!! error TS2339: Property 'p1' does not exist on type 'Q'. } } @@ -147,8 +167,8 @@ constructor() { private this.p1 = 0; // ERROR ~~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. ~~ -!!! Property 'p1' does not exist on type 'R'. +!!! error TS2339: Property 'p1' does not exist on type 'R'. } } \ No newline at end of file diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.errors.txt b/tests/baselines/reference/classWithBaseClassButNoConstructor.errors.txt index 28938907d7a..75f24d8c45a 100644 --- a/tests/baselines/reference/classWithBaseClassButNoConstructor.errors.txt +++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithBaseClassButNoConstructor.ts(10,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithBaseClassButNoConstructor.ts(22,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithBaseClassButNoConstructor.ts(31,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithBaseClassButNoConstructor.ts(39,10): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/conformance/classes/members/constructorFunctionTypes/classWithBaseClassButNoConstructor.ts (4 errors) ==== class Base { constructor(x: number) { } @@ -10,7 +16,7 @@ var r = C; var c = new C(); // error ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var c2 = new C(1); // ok class Base2 { @@ -24,7 +30,7 @@ var r2 = D; var d = new D(); // error ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var d2 = new D(1); // ok // specialized base class @@ -35,7 +41,7 @@ var r3 = D2; var d3 = new D(); // error ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var d4 = new D(1); // ok class D3 extends Base2 { @@ -45,5 +51,5 @@ var r4 = D3; var d5 = new D(); // error ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var d6 = new D(1); // ok \ No newline at end of file diff --git a/tests/baselines/reference/classWithConstructors.errors.txt b/tests/baselines/reference/classWithConstructors.errors.txt index f6612ca87f7..61e0b1248b1 100644 --- a/tests/baselines/reference/classWithConstructors.errors.txt +++ b/tests/baselines/reference/classWithConstructors.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithConstructors.ts(6,13): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithConstructors.ts(15,14): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithConstructors.ts(21,13): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithConstructors.ts(31,13): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithConstructors.ts(40,14): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithConstructors.ts(46,13): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/conformance/classes/members/constructorFunctionTypes/classWithConstructors.ts (6 errors) ==== module NonGeneric { class C { @@ -6,7 +14,7 @@ var c = new C(); // error ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var c2 = new C(''); // ok class C2 { @@ -17,7 +25,7 @@ var c3 = new C2(); // error ~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var c4 = new C2(''); // ok var c5 = new C2(1); // ok @@ -25,7 +33,7 @@ var d = new D(); // error ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var d2 = new D(1); // ok var d3 = new D(''); // ok } @@ -37,7 +45,7 @@ var c = new C(); // error ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var c2 = new C(''); // ok class C2 { @@ -48,7 +56,7 @@ var c3 = new C2(); // error ~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var c4 = new C2(''); // ok var c5 = new C2(1, 2); // ok @@ -56,7 +64,7 @@ var d = new D(); // error ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var d2 = new D(1); // ok var d3 = new D(''); // ok } \ No newline at end of file diff --git a/tests/baselines/reference/classWithMultipleBaseClasses.errors.txt b/tests/baselines/reference/classWithMultipleBaseClasses.errors.txt index 56f34575468..5463a3b21ee 100644 --- a/tests/baselines/reference/classWithMultipleBaseClasses.errors.txt +++ b/tests/baselines/reference/classWithMultipleBaseClasses.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/classWithMultipleBaseClasses.ts(18,7): error TS2421: Class 'D' incorrectly implements interface 'I': + Property 'foo' is missing in type 'D'. + + ==== tests/cases/compiler/classWithMultipleBaseClasses.ts (1 errors) ==== class A { foo() { } @@ -18,8 +22,8 @@ class D implements I, J { ~ -!!! Class 'D' incorrectly implements interface 'I': -!!! Property 'foo' is missing in type 'D'. +!!! error TS2421: Class 'D' incorrectly implements interface 'I': +!!! error TS2421: Property 'foo' is missing in type 'D'. baz() { } bat() { } } diff --git a/tests/baselines/reference/classWithOptionalParameter.errors.txt b/tests/baselines/reference/classWithOptionalParameter.errors.txt index 028e1f62dff..6e512c2a02e 100644 --- a/tests/baselines/reference/classWithOptionalParameter.errors.txt +++ b/tests/baselines/reference/classWithOptionalParameter.errors.txt @@ -1,20 +1,26 @@ +tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(4,6): error TS1112: A class member cannot be declared optional. +tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(5,6): error TS1112: A class member cannot be declared optional. +tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(9,6): error TS1112: A class member cannot be declared optional. +tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(10,6): error TS1112: A class member cannot be declared optional. + + ==== tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts (4 errors) ==== // classes do not permit optional parameters, these are errors class C { x?: string; ~ -!!! A class member cannot be declared optional. +!!! error TS1112: A class member cannot be declared optional. f?() {} ~ -!!! A class member cannot be declared optional. +!!! error TS1112: A class member cannot be declared optional. } class C2 { x?: T; ~ -!!! A class member cannot be declared optional. +!!! error TS1112: A class member cannot be declared optional. f?(x: T) {} ~ -!!! A class member cannot be declared optional. +!!! error TS1112: A class member cannot be declared optional. } \ No newline at end of file diff --git a/tests/baselines/reference/classWithOverloadImplementationOfWrongName.errors.txt b/tests/baselines/reference/classWithOverloadImplementationOfWrongName.errors.txt index 1d2d5bb0c70..23d6c6a6847 100644 --- a/tests/baselines/reference/classWithOverloadImplementationOfWrongName.errors.txt +++ b/tests/baselines/reference/classWithOverloadImplementationOfWrongName.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/classWithOverloadImplementationOfWrongName.ts(4,5): error TS2389: Function implementation name must be 'foo'. + + ==== tests/cases/compiler/classWithOverloadImplementationOfWrongName.ts (1 errors) ==== class C { foo(): string; foo(x): number; bar(x): any { } ~~~ -!!! Function implementation name must be 'foo'. +!!! error TS2389: Function implementation name must be 'foo'. } \ No newline at end of file diff --git a/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt b/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt index 9d4c0588e63..6ed05607d19 100644 --- a/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt +++ b/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/classWithOverloadImplementationOfWrongName2.ts(3,5): error TS2389: Function implementation name must be 'foo'. +tests/cases/compiler/classWithOverloadImplementationOfWrongName2.ts(4,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/classWithOverloadImplementationOfWrongName2.ts (2 errors) ==== class C { foo(): string; bar(x): any { } ~~~ -!!! Function implementation name must be 'foo'. +!!! error TS2389: Function implementation name must be 'foo'. foo(x): number; ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/classWithPredefinedTypesAsNames.errors.txt b/tests/baselines/reference/classWithPredefinedTypesAsNames.errors.txt index 47ff1f52e66..a0dfb5d62c1 100644 --- a/tests/baselines/reference/classWithPredefinedTypesAsNames.errors.txt +++ b/tests/baselines/reference/classWithPredefinedTypesAsNames.errors.txt @@ -1,15 +1,21 @@ +tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(3,7): error TS2414: Class name cannot be 'any' +tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(4,7): error TS2414: Class name cannot be 'number' +tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(5,7): error TS2414: Class name cannot be 'boolean' +tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(6,7): error TS2414: Class name cannot be 'string' + + ==== tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts (4 errors) ==== // classes cannot use predefined types as names class any { } ~~~ -!!! Class name cannot be 'any' +!!! error TS2414: Class name cannot be 'any' class number { } ~~~~~~ -!!! Class name cannot be 'number' +!!! error TS2414: Class name cannot be 'number' class boolean { } ~~~~~~~ -!!! Class name cannot be 'boolean' +!!! error TS2414: Class name cannot be 'boolean' class string { } ~~~~~~ -!!! Class name cannot be 'string' \ No newline at end of file +!!! error TS2414: Class name cannot be 'string' \ No newline at end of file diff --git a/tests/baselines/reference/classWithPredefinedTypesAsNames2.errors.txt b/tests/baselines/reference/classWithPredefinedTypesAsNames2.errors.txt index 0d6065e7a71..73cb373180c 100644 --- a/tests/baselines/reference/classWithPredefinedTypesAsNames2.errors.txt +++ b/tests/baselines/reference/classWithPredefinedTypesAsNames2.errors.txt @@ -1,6 +1,9 @@ +tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames2.ts(3,7): error TS1003: Identifier expected. + + ==== tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames2.ts (1 errors) ==== // classes cannot use predefined types as names class void {} ~~~~ -!!! Identifier expected. \ No newline at end of file +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/classWithPrivateProperty.errors.txt b/tests/baselines/reference/classWithPrivateProperty.errors.txt index aa1664bbb37..93a94e21075 100644 --- a/tests/baselines/reference/classWithPrivateProperty.errors.txt +++ b/tests/baselines/reference/classWithPrivateProperty.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/types/members/classWithPrivateProperty.ts(15,18): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(16,18): error TS2341: Property 'a' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(17,18): error TS2341: Property 'b' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(18,18): error TS2341: Property 'c' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(19,18): error TS2341: Property 'd' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(20,18): error TS2341: Property 'e' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(21,18): error TS2341: Property 'f' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(22,18): error TS2341: Property 'g' is private and only accessible within class 'C'. + + ==== tests/cases/conformance/types/members/classWithPrivateProperty.ts (8 errors) ==== // accessing any private outside the class is an error @@ -15,25 +25,25 @@ var c = new C(); var r1: string = c.x; ~~~ -!!! Property 'C.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. var r2: string = c.a; ~~~ -!!! Property 'C.a' is inaccessible. +!!! error TS2341: Property 'a' is private and only accessible within class 'C'. var r3: string = c.b; ~~~ -!!! Property 'C.b' is inaccessible. +!!! error TS2341: Property 'b' is private and only accessible within class 'C'. var r4: string = c.c(); ~~~ -!!! Property 'C.c' is inaccessible. +!!! error TS2341: Property 'c' is private and only accessible within class 'C'. var r5: string = c.d(); ~~~ -!!! Property 'C.d' is inaccessible. +!!! error TS2341: Property 'd' is private and only accessible within class 'C'. var r6: string = C.e; ~~~ -!!! Property 'C.e' is inaccessible. +!!! error TS2341: Property 'e' is private and only accessible within class 'C'. var r7: string = C.f(); ~~~ -!!! Property 'C.f' is inaccessible. +!!! error TS2341: Property 'f' is private and only accessible within class 'C'. var r8: string = C.g(); ~~~ -!!! Property 'C.g' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'g' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js new file mode 100644 index 00000000000..c0dde0d3237 --- /dev/null +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -0,0 +1,71 @@ +//// [classWithProtectedProperty.ts] +// accessing any protected outside the class is an error + +class C { + protected x; + protected a = ''; + protected b: string = ''; + protected c() { return '' } + protected d = () => ''; + protected static e; + protected static f() { return '' } + protected static g = () => ''; +} + +class D extends C { + method() { + // No errors + var d = new D(); + var r1: string = d.x; + var r2: string = d.a; + var r3: string = d.b; + var r4: string = d.c(); + var r5: string = d.d(); + var r6: string = C.e; + var r7: string = C.f(); + var r8: string = C.g(); + } +} + +//// [classWithProtectedProperty.js] +// accessing any protected outside the class is an error +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + this.a = ''; + this.b = ''; + this.d = function () { return ''; }; + } + C.prototype.c = function () { + return ''; + }; + C.f = function () { + return ''; + }; + C.g = function () { return ''; }; + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + D.prototype.method = function () { + // No errors + var d = new D(); + var r1 = d.x; + var r2 = d.a; + var r3 = d.b; + var r4 = d.c(); + var r5 = d.d(); + var r6 = C.e; + var r7 = C.f(); + var r8 = C.g(); + }; + return D; +})(C); diff --git a/tests/baselines/reference/classWithProtectedProperty.types b/tests/baselines/reference/classWithProtectedProperty.types new file mode 100644 index 00000000000..a091206cde0 --- /dev/null +++ b/tests/baselines/reference/classWithProtectedProperty.types @@ -0,0 +1,99 @@ +=== tests/cases/conformance/types/members/classWithProtectedProperty.ts === +// accessing any protected outside the class is an error + +class C { +>C : C + + protected x; +>x : any + + protected a = ''; +>a : string + + protected b: string = ''; +>b : string + + protected c() { return '' } +>c : () => string + + protected d = () => ''; +>d : () => string +>() => '' : () => string + + protected static e; +>e : any + + protected static f() { return '' } +>f : () => string + + protected static g = () => ''; +>g : () => string +>() => '' : () => string +} + +class D extends C { +>D : D +>C : C + + method() { +>method : () => void + + // No errors + var d = new D(); +>d : D +>new D() : D +>D : typeof D + + var r1: string = d.x; +>r1 : string +>d.x : any +>d : D +>x : any + + var r2: string = d.a; +>r2 : string +>d.a : string +>d : D +>a : string + + var r3: string = d.b; +>r3 : string +>d.b : string +>d : D +>b : string + + var r4: string = d.c(); +>r4 : string +>d.c() : string +>d.c : () => string +>d : D +>c : () => string + + var r5: string = d.d(); +>r5 : string +>d.d() : string +>d.d : () => string +>d : D +>d : () => string + + var r6: string = C.e; +>r6 : string +>C.e : any +>C : typeof C +>e : any + + var r7: string = C.f(); +>r7 : string +>C.f() : string +>C.f : () => string +>C : typeof C +>f : () => string + + var r8: string = C.g(); +>r8 : string +>C.g() : string +>C.g : () => string +>C : typeof C +>g : () => string + } +} diff --git a/tests/baselines/reference/classWithStaticMembers.errors.txt b/tests/baselines/reference/classWithStaticMembers.errors.txt index 63f6d4b76e0..814cb9343e8 100644 --- a/tests/baselines/reference/classWithStaticMembers.errors.txt +++ b/tests/baselines/reference/classWithStaticMembers.errors.txt @@ -1,12 +1,16 @@ +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithStaticMembers.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/constructorFunctionTypes/classWithStaticMembers.ts(4,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/conformance/classes/members/constructorFunctionTypes/classWithStaticMembers.ts (2 errors) ==== class C { static fn() { return this; } static get x() { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static set x(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. constructor(public a: number, private b: number) { } static foo: string; } diff --git a/tests/baselines/reference/classWithTwoConstructorDefinitions.errors.txt b/tests/baselines/reference/classWithTwoConstructorDefinitions.errors.txt index 6ed2fe3f84d..6b08be330a0 100644 --- a/tests/baselines/reference/classWithTwoConstructorDefinitions.errors.txt +++ b/tests/baselines/reference/classWithTwoConstructorDefinitions.errors.txt @@ -1,14 +1,24 @@ -==== tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts (2 errors) ==== +tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts(2,5): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts(3,5): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts(7,5): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts(8,5): error TS2392: Multiple constructor implementations are not allowed. + + +==== tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts (4 errors) ==== class C { - constructor() { } + constructor() { } // error + ~~~~~~~~~~~~~~~~~ +!!! error TS2392: Multiple constructor implementations are not allowed. constructor(x) { } // error ~~~~~~~~~~~~~~~~~~ -!!! Multiple constructor implementations are not allowed. +!!! error TS2392: Multiple constructor implementations are not allowed. } class D { - constructor(x: T) { } + constructor(x: T) { } // error + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2392: Multiple constructor implementations are not allowed. constructor(x: T, y: T) { } // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Multiple constructor implementations are not allowed. +!!! error TS2392: Multiple constructor implementations are not allowed. } \ No newline at end of file diff --git a/tests/baselines/reference/classWithTwoConstructorDefinitions.js b/tests/baselines/reference/classWithTwoConstructorDefinitions.js index 77c98697f1f..31e5498cfc9 100644 --- a/tests/baselines/reference/classWithTwoConstructorDefinitions.js +++ b/tests/baselines/reference/classWithTwoConstructorDefinitions.js @@ -1,22 +1,22 @@ //// [classWithTwoConstructorDefinitions.ts] class C { - constructor() { } + constructor() { } // error constructor(x) { } // error } class D { - constructor(x: T) { } + constructor(x: T) { } // error constructor(x: T, y: T) { } // error } //// [classWithTwoConstructorDefinitions.js] var C = (function () { function C() { - } + } // error return C; })(); var D = (function () { function D(x) { - } + } // error return D; })(); diff --git a/tests/baselines/reference/classWithoutExplicitConstructor.errors.txt b/tests/baselines/reference/classWithoutExplicitConstructor.errors.txt index 8f21178ed72..981f38f017c 100644 --- a/tests/baselines/reference/classWithoutExplicitConstructor.errors.txt +++ b/tests/baselines/reference/classWithoutExplicitConstructor.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/classWithoutExplicitConstructor.ts(7,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/classWithoutExplicitConstructor.ts(15,10): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/classWithoutExplicitConstructor.ts (2 errors) ==== class C { x = 1 @@ -7,7 +11,7 @@ var c = new C(); var c2 = new C(null); // error ~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. class D { x = 2 @@ -17,4 +21,4 @@ var d = new D(); var d2 = new D(null); // error ~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/classdecl.errors.txt b/tests/baselines/reference/classdecl.errors.txt index fcb0ad8b25a..e43be2f5ad0 100644 --- a/tests/baselines/reference/classdecl.errors.txt +++ b/tests/baselines/reference/classdecl.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/classdecl.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/classdecl.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/classdecl.ts(18,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/classdecl.ts(24,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/classdecl.ts (4 errors) ==== class a { //constructor (); @@ -12,17 +18,17 @@ public pv; public get d() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 30; } public set d() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } public static get p2() { ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return { x: 30, y: 40 }; } @@ -30,7 +36,7 @@ } private static get p3() { ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "string"; } private pv3; diff --git a/tests/baselines/reference/clinterfaces.errors.txt b/tests/baselines/reference/clinterfaces.errors.txt index e187459e4f4..d5eab2c7994 100644 --- a/tests/baselines/reference/clinterfaces.errors.txt +++ b/tests/baselines/reference/clinterfaces.errors.txt @@ -1,32 +1,50 @@ -==== tests/cases/compiler/clinterfaces.ts (4 errors) ==== +tests/cases/compiler/clinterfaces.ts(2,11): error TS2300: Duplicate identifier 'C'. +tests/cases/compiler/clinterfaces.ts(3,15): error TS2300: Duplicate identifier 'C'. +tests/cases/compiler/clinterfaces.ts(4,15): error TS2300: Duplicate identifier 'D'. +tests/cases/compiler/clinterfaces.ts(5,11): error TS2300: Duplicate identifier 'D'. +tests/cases/compiler/clinterfaces.ts(8,11): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/clinterfaces.ts(12,7): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/clinterfaces.ts(16,7): error TS2300: Duplicate identifier 'Bar'. +tests/cases/compiler/clinterfaces.ts(20,11): error TS2300: Duplicate identifier 'Bar'. + + +==== tests/cases/compiler/clinterfaces.ts (8 errors) ==== module M { class C { } + ~ +!!! error TS2300: Duplicate identifier 'C'. interface C { } ~ -!!! Duplicate identifier 'C'. +!!! error TS2300: Duplicate identifier 'C'. interface D { } + ~ +!!! error TS2300: Duplicate identifier 'D'. class D { } ~ -!!! Duplicate identifier 'D'. +!!! error TS2300: Duplicate identifier 'D'. } interface Foo { + ~~~ +!!! error TS2300: Duplicate identifier 'Foo'. a: string; } class Foo{ ~~~ -!!! Duplicate identifier 'Foo'. +!!! error TS2300: Duplicate identifier 'Foo'. b: number; } class Bar{ + ~~~ +!!! error TS2300: Duplicate identifier 'Bar'. b: number; } interface Bar { ~~~ -!!! Duplicate identifier 'Bar'. +!!! error TS2300: Duplicate identifier 'Bar'. a: string; } diff --git a/tests/baselines/reference/cloduleSplitAcrossFiles.errors.txt b/tests/baselines/reference/cloduleSplitAcrossFiles.errors.txt index 4d33163d693..e9001265feb 100644 --- a/tests/baselines/reference/cloduleSplitAcrossFiles.errors.txt +++ b/tests/baselines/reference/cloduleSplitAcrossFiles.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/cloduleSplitAcrossFiles_module.ts(1,8): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged + + ==== tests/cases/compiler/cloduleSplitAcrossFiles_class.ts (0 errors) ==== class D { } ==== tests/cases/compiler/cloduleSplitAcrossFiles_module.ts (1 errors) ==== module D { ~ -!!! A module declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged export var y = "hi"; } D.y; \ No newline at end of file diff --git a/tests/baselines/reference/cloduleStaticMembers.errors.txt b/tests/baselines/reference/cloduleStaticMembers.errors.txt index ad1a3572c93..914fea72424 100644 --- a/tests/baselines/reference/cloduleStaticMembers.errors.txt +++ b/tests/baselines/reference/cloduleStaticMembers.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/cloduleStaticMembers.ts(6,13): error TS2341: Property 'x' is private and only accessible within class 'Clod'. +tests/cases/compiler/cloduleStaticMembers.ts(7,13): error TS2304: Cannot find name 'x'. +tests/cases/compiler/cloduleStaticMembers.ts(10,13): error TS2304: Cannot find name 'y'. + + ==== tests/cases/compiler/cloduleStaticMembers.ts (3 errors) ==== class Clod { private static x = 10; @@ -6,14 +11,14 @@ module Clod { var p = Clod.x; ~~~~~~ -!!! Property 'Clod.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'Clod'. var q = x; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. var s = Clod.y; var t = y; ~ -!!! Cannot find name 'y'. +!!! error TS2304: Cannot find name 'y'. } \ No newline at end of file diff --git a/tests/baselines/reference/cloduleTest2.errors.txt b/tests/baselines/reference/cloduleTest2.errors.txt index a1355c0c9f1..9659b5b0d4c 100644 --- a/tests/baselines/reference/cloduleTest2.errors.txt +++ b/tests/baselines/reference/cloduleTest2.errors.txt @@ -1,10 +1,20 @@ +tests/cases/compiler/cloduleTest2.ts(4,13): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/cloduleTest2.ts(10,13): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/cloduleTest2.ts(18,7): error TS2339: Property 'bar' does not exist on type 'm3d'. +tests/cases/compiler/cloduleTest2.ts(19,7): error TS2339: Property 'y' does not exist on type 'm3d'. +tests/cases/compiler/cloduleTest2.ts(27,7): error TS2339: Property 'bar' does not exist on type 'm3d'. +tests/cases/compiler/cloduleTest2.ts(28,7): error TS2339: Property 'y' does not exist on type 'm3d'. +tests/cases/compiler/cloduleTest2.ts(33,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/cloduleTest2.ts(36,10): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/cloduleTest2.ts (8 errors) ==== module T1 { module m3d { export var y = 2; } declare class m3d { constructor(foo); foo(): void ; static bar(); } var r = new m3d(); // error ~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. } module T2 { @@ -12,7 +22,7 @@ module m3d { export var y = 2; } var r = new m3d(); // error ~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. } module T3 { @@ -22,10 +32,10 @@ r.foo(); r.bar(); // error ~~~ -!!! Property 'bar' does not exist on type 'm3d'. +!!! error TS2339: Property 'bar' does not exist on type 'm3d'. r.y; // error ~ -!!! Property 'y' does not exist on type 'm3d'. +!!! error TS2339: Property 'y' does not exist on type 'm3d'. } module T4 { @@ -35,19 +45,19 @@ r.foo(); r.bar(); // error ~~~ -!!! Property 'bar' does not exist on type 'm3d'. +!!! error TS2339: Property 'bar' does not exist on type 'm3d'. r.y; // error ~ -!!! Property 'y' does not exist on type 'm3d'. +!!! error TS2339: Property 'y' does not exist on type 'm3d'. } module m3d { export var y = 2; } declare class m3d { constructor(foo); foo(): void; static bar(); } var r = new m3d(); // error ~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. declare class m4d extends m3d { } var r2 = new m4d(); // error ~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/cloduleWithDuplicateMember1.errors.txt b/tests/baselines/reference/cloduleWithDuplicateMember1.errors.txt index d4c17e19bd1..914088f6c19 100644 --- a/tests/baselines/reference/cloduleWithDuplicateMember1.errors.txt +++ b/tests/baselines/reference/cloduleWithDuplicateMember1.errors.txt @@ -1,26 +1,39 @@ -==== tests/cases/compiler/cloduleWithDuplicateMember1.ts (5 errors) ==== +tests/cases/compiler/cloduleWithDuplicateMember1.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/cloduleWithDuplicateMember1.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/cloduleWithDuplicateMember1.ts(3,16): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/cloduleWithDuplicateMember1.ts(6,12): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/cloduleWithDuplicateMember1.ts(10,16): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/cloduleWithDuplicateMember1.ts(13,21): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/cloduleWithDuplicateMember1.ts(14,21): error TS2300: Duplicate identifier 'x'. + + +==== tests/cases/compiler/cloduleWithDuplicateMember1.ts (7 errors) ==== class C { get x() { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~ +!!! error TS2300: Duplicate identifier 'x'. return ''; } static foo() { } + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. } module C { export var x = 1; ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } module C { export function foo() { } ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. export function x() { } ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/cloduleWithDuplicateMember2.errors.txt b/tests/baselines/reference/cloduleWithDuplicateMember2.errors.txt index 1eca71ea428..55d2fdbddf2 100644 --- a/tests/baselines/reference/cloduleWithDuplicateMember2.errors.txt +++ b/tests/baselines/reference/cloduleWithDuplicateMember2.errors.txt @@ -1,18 +1,26 @@ -==== tests/cases/compiler/cloduleWithDuplicateMember2.ts (3 errors) ==== +tests/cases/compiler/cloduleWithDuplicateMember2.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/cloduleWithDuplicateMember2.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/cloduleWithDuplicateMember2.ts(7,16): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/cloduleWithDuplicateMember2.ts(10,21): error TS2300: Duplicate identifier 'x'. + + +==== tests/cases/compiler/cloduleWithDuplicateMember2.ts (4 errors) ==== class C { set x(y) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static set y(z) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } module C { export var x = 1; + ~ +!!! error TS2300: Duplicate identifier 'x'. } module C { export function x() { } ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/clodulesDerivedClasses.errors.txt b/tests/baselines/reference/clodulesDerivedClasses.errors.txt index 8ee9d5817a0..e4ce78e1875 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.errors.txt +++ b/tests/baselines/reference/clodulesDerivedClasses.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/clodulesDerivedClasses.ts(9,7): error TS2418: Class static side 'typeof Path' incorrectly extends base class static side 'typeof Shape': + Types of property 'Utils' are incompatible: + Type 'typeof Utils' is not assignable to type 'typeof Utils': + Property 'convert' is missing in type 'typeof Utils'. + + ==== tests/cases/compiler/clodulesDerivedClasses.ts (1 errors) ==== class Shape { id: number; @@ -9,10 +15,10 @@ class Path extends Shape { ~~~~ -!!! Class static side 'typeof Path' incorrectly extends base class static side 'typeof Shape': -!!! Types of property 'Utils' are incompatible: -!!! Type 'typeof Utils' is not assignable to type 'typeof Utils': -!!! Property 'convert' is missing in type 'typeof Utils'. +!!! error TS2418: Class static side 'typeof Path' incorrectly extends base class static side 'typeof Shape': +!!! error TS2418: Types of property 'Utils' are incompatible: +!!! error TS2418: Type 'typeof Utils' is not assignable to type 'typeof Utils': +!!! error TS2418: Property 'convert' is missing in type 'typeof Utils'. name: string; } diff --git a/tests/baselines/reference/collisionArgumentsArrowFunctions.errors.txt b/tests/baselines/reference/collisionArgumentsArrowFunctions.errors.txt index 958ff48235c..f5291d3de43 100644 --- a/tests/baselines/reference/collisionArgumentsArrowFunctions.errors.txt +++ b/tests/baselines/reference/collisionArgumentsArrowFunctions.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/collisionArgumentsArrowFunctions.ts(1,22): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsArrowFunctions.ts(4,12): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + + ==== tests/cases/compiler/collisionArgumentsArrowFunctions.ts (2 errors) ==== var f1 = (i: number, ...arguments) => { //arguments is error ~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any[]; // no error } var f12 = (arguments: number, ...rest) => { //arguments is error ~~~~~~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error } var f1NoError = (arguments: number) => { // no error diff --git a/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt b/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt index bff94980b72..f2ec9429eb7 100644 --- a/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt +++ b/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt @@ -1,16 +1,23 @@ +tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,28): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,25): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + + ==== tests/cases/compiler/collisionArgumentsClassConstructor.ts (5 errors) ==== // Constructors class c1 { constructor(i: number, ...arguments) { // error ~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any[]; // no error } } class c12 { constructor(arguments: number, ...rest) { // error ~~~~~~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error } } @@ -34,7 +41,7 @@ class c3 { constructor(public arguments: number, ...restParameters) { //arguments is error ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error } } @@ -59,7 +66,7 @@ constructor(i: string, ...arguments); // no codegen no error constructor(i: any, ...arguments) { // error ~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any[]; // no error } } @@ -69,7 +76,7 @@ constructor(arguments: string, ...rest); // no codegen no error constructor(arguments: any, ...rest) { // error ~~~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any; // no error } } diff --git a/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt b/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt index 57342c1006d..38ad6867200 100644 --- a/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt +++ b/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt @@ -1,13 +1,19 @@ +tests/cases/compiler/collisionArgumentsClassMethod.ts(2,27): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassMethod.ts(13,23): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + + ==== tests/cases/compiler/collisionArgumentsClassMethod.ts (4 errors) ==== class c1 { public foo(i: number, ...arguments) { //arguments is error ~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any[]; // no error } public foo1(arguments: number, ...rest) { //arguments is error ~~~~~~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error } public fooNoError(arguments: number) { // no error @@ -17,14 +23,14 @@ public f4(i: string, ...arguments); // no codegen no error public f4(i: any, ...arguments) { // error ~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any[]; // no error } public f41(arguments: number, ...rest); // no codegen no error public f41(arguments: string, ...rest); // no codegen no error public f41(arguments: any, ...rest) { // error ~~~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any; // no error } public f4NoError(arguments: number); // no error diff --git a/tests/baselines/reference/collisionArgumentsFunction.errors.txt b/tests/baselines/reference/collisionArgumentsFunction.errors.txt index 9d76598113a..a557e9cbcba 100644 --- a/tests/baselines/reference/collisionArgumentsFunction.errors.txt +++ b/tests/baselines/reference/collisionArgumentsFunction.errors.txt @@ -1,13 +1,19 @@ +tests/cases/compiler/collisionArgumentsFunction.ts(2,13): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsFunction.ts(5,25): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsFunction.ts(25,13): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsFunction.ts(30,22): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + + ==== tests/cases/compiler/collisionArgumentsFunction.ts (4 errors) ==== // Functions function f1(arguments: number, ...restParameters) { //arguments is error ~~~~~~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error } function f12(i: number, ...arguments) { //arguments is error ~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any[]; // no error } function f1NoError(arguments: number) { // no error @@ -29,14 +35,14 @@ function f4(arguments: string, ...rest); // no codegen no error function f4(arguments: any, ...rest) { // error ~~~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any; // No error } function f42(i: number, ...arguments); // no codegen no error function f42(i: string, ...arguments); // no codegen no error function f42(i: any, ...arguments) { // error ~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any[]; // No error } function f4NoError(arguments: number); // no error diff --git a/tests/baselines/reference/collisionArgumentsFunctionExpressions.errors.txt b/tests/baselines/reference/collisionArgumentsFunctionExpressions.errors.txt index d4b8bbd9e94..fda61160717 100644 --- a/tests/baselines/reference/collisionArgumentsFunctionExpressions.errors.txt +++ b/tests/baselines/reference/collisionArgumentsFunctionExpressions.errors.txt @@ -1,13 +1,19 @@ +tests/cases/compiler/collisionArgumentsFunctionExpressions.ts(2,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsFunctionExpressions.ts(5,29): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsFunctionExpressions.ts(21,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsFunctionExpressions.ts(26,26): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + + ==== tests/cases/compiler/collisionArgumentsFunctionExpressions.ts (4 errors) ==== function foo() { function f1(arguments: number, ...restParameters) { //arguments is error ~~~~~~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error } function f12(i: number, ...arguments) { //arguments is error ~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any[]; // no error } function f1NoError(arguments: number) { // no error @@ -25,14 +31,14 @@ function f4(arguments: string, ...rest); // no codegen no error function f4(arguments: any, ...rest) { // error ~~~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any; // No error } function f42(i: number, ...arguments); // no codegen no error function f42(i: string, ...arguments); // no codegen no error function f42(i: any, ...arguments) { // error ~~~~~~~~~~~~ -!!! Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any[]; // No error } function f4NoError(arguments: number); // no error diff --git a/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.errors.txt b/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.errors.txt index 23c7fe49f73..9ba074a1cae 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.errors.txt +++ b/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/collisionCodeGenModuleWithAccessorChildren.ts(5,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionCodeGenModuleWithAccessorChildren.ts(14,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionCodeGenModuleWithAccessorChildren.ts(24,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionCodeGenModuleWithAccessorChildren.ts(32,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionCodeGenModuleWithAccessorChildren.ts(41,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/collisionCodeGenModuleWithAccessorChildren.ts (5 errors) ==== module M { export var x = 3; @@ -5,7 +12,7 @@ private y; set Z(M) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. this.y = x; } } @@ -16,7 +23,7 @@ private y; set Z(p) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var M = 10; this.y = x; } @@ -28,7 +35,7 @@ private y; set M(p) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. this.y = x; } } @@ -38,7 +45,7 @@ class f { get Z() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var M = 10; return x; } @@ -49,7 +56,7 @@ class e { get M() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return x; } } diff --git a/tests/baselines/reference/collisionExportsRequireAndAlias.errors.txt b/tests/baselines/reference/collisionExportsRequireAndAlias.errors.txt index 2ed2ee5d10e..e782abd08b8 100644 --- a/tests/baselines/reference/collisionExportsRequireAndAlias.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndAlias.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/collisionExportsRequireAndAlias_file2.ts(1,8): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +tests/cases/compiler/collisionExportsRequireAndAlias_file2.ts(2,8): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. + + ==== tests/cases/compiler/collisionExportsRequireAndAlias_file2.ts (2 errors) ==== import require = require('collisionExportsRequireAndAlias_file1'); // Error ~~~~~~~ -!!! Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. import exports = require('collisionExportsRequireAndAlias_file3333'); // Error ~~~~~~~ -!!! Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. export function foo() { require.bar(); } diff --git a/tests/baselines/reference/collisionExportsRequireAndClass.errors.txt b/tests/baselines/reference/collisionExportsRequireAndClass.errors.txt index 8fea5b475f2..ef0a9018f1d 100644 --- a/tests/baselines/reference/collisionExportsRequireAndClass.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndClass.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/collisionExportsRequireAndClass_externalmodule.ts(1,14): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +tests/cases/compiler/collisionExportsRequireAndClass_externalmodule.ts(3,14): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. + + ==== tests/cases/compiler/collisionExportsRequireAndClass_externalmodule.ts (2 errors) ==== export class require { ~~~~~~~ -!!! Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. } export class exports { ~~~~~~~ -!!! Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. } module m1 { class require { diff --git a/tests/baselines/reference/collisionExportsRequireAndEnum.errors.txt b/tests/baselines/reference/collisionExportsRequireAndEnum.errors.txt index 782e4958363..d421cbe4d4b 100644 --- a/tests/baselines/reference/collisionExportsRequireAndEnum.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndEnum.errors.txt @@ -1,13 +1,17 @@ +tests/cases/compiler/collisionExportsRequireAndEnum_externalmodule.ts(1,13): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +tests/cases/compiler/collisionExportsRequireAndEnum_externalmodule.ts(5,13): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. + + ==== tests/cases/compiler/collisionExportsRequireAndEnum_externalmodule.ts (2 errors) ==== export enum require { // Error ~~~~~~~ -!!! Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. _thisVal1, _thisVal2, } export enum exports { // Error ~~~~~~~ -!!! Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. _thisVal1, _thisVal2, } diff --git a/tests/baselines/reference/collisionExportsRequireAndFunction.errors.txt b/tests/baselines/reference/collisionExportsRequireAndFunction.errors.txt index 49c6355c480..f52390ec28c 100644 --- a/tests/baselines/reference/collisionExportsRequireAndFunction.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndFunction.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/collisionExportsRequireAndFunction.ts(1,17): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. +tests/cases/compiler/collisionExportsRequireAndFunction.ts(4,17): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. + + ==== tests/cases/compiler/collisionExportsRequireAndFunction.ts (2 errors) ==== export function exports() { ~~~~~~~ -!!! Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. return 1; } export function require() { ~~~~~~~ -!!! Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. return "require"; } module m1 { diff --git a/tests/baselines/reference/collisionExportsRequireAndInternalModuleAlias.errors.txt b/tests/baselines/reference/collisionExportsRequireAndInternalModuleAlias.errors.txt index 9facc72da23..4207db04f53 100644 --- a/tests/baselines/reference/collisionExportsRequireAndInternalModuleAlias.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndInternalModuleAlias.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts(5,8): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. +tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts(6,8): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. + + ==== tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts (2 errors) ==== export module m { export class c { @@ -5,10 +9,10 @@ } import exports = m.c; ~~~~~~~ -!!! Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. import require = m.c; ~~~~~~~ -!!! Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. new exports(); new require(); diff --git a/tests/baselines/reference/collisionExportsRequireAndModule.errors.txt b/tests/baselines/reference/collisionExportsRequireAndModule.errors.txt index 4f1f9c4cd4d..cb11155718e 100644 --- a/tests/baselines/reference/collisionExportsRequireAndModule.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndModule.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/collisionExportsRequireAndModule_externalmodule.ts(1,15): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +tests/cases/compiler/collisionExportsRequireAndModule_externalmodule.ts(10,15): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. + + ==== tests/cases/compiler/collisionExportsRequireAndModule_externalmodule.ts (2 errors) ==== export module require { ~~~~~~~ -!!! Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. export interface I { } export class C { @@ -12,7 +16,7 @@ } export module exports { ~~~~~~~ -!!! Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. export interface I { } export class C { diff --git a/tests/baselines/reference/collisionExportsRequireAndVar.errors.txt b/tests/baselines/reference/collisionExportsRequireAndVar.errors.txt index d5106a0fe50..2efc84d5436 100644 --- a/tests/baselines/reference/collisionExportsRequireAndVar.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndVar.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/collisionExportsRequireAndVar_externalmodule.ts(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. +tests/cases/compiler/collisionExportsRequireAndVar_externalmodule.ts(4,5): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. + + ==== tests/cases/compiler/collisionExportsRequireAndVar_externalmodule.ts (2 errors) ==== export function foo() { } var exports = 1; ~~~~~~~ -!!! Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module. var require = "require"; ~~~~~~~ -!!! Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. +!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module. module m1 { var exports = 0; var require = "require"; diff --git a/tests/baselines/reference/collisionRestParameterArrowFunctions.errors.txt b/tests/baselines/reference/collisionRestParameterArrowFunctions.errors.txt index 223565f664b..5c585e5a6c3 100644 --- a/tests/baselines/reference/collisionRestParameterArrowFunctions.errors.txt +++ b/tests/baselines/reference/collisionRestParameterArrowFunctions.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/collisionRestParameterArrowFunctions.ts(1,11): error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. + + ==== tests/cases/compiler/collisionRestParameterArrowFunctions.ts (1 errors) ==== var f1 = (_i: number, ...restParameters) => { //_i is error ~~~~~~~~~~ -!!! Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +!!! error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. var _i = 10; // no error } var f1NoError = (_i: number) => { // no error diff --git a/tests/baselines/reference/collisionRestParameterClassConstructor.errors.txt b/tests/baselines/reference/collisionRestParameterClassConstructor.errors.txt index d64474d412b..a30b6d11d4b 100644 --- a/tests/baselines/reference/collisionRestParameterClassConstructor.errors.txt +++ b/tests/baselines/reference/collisionRestParameterClassConstructor.errors.txt @@ -1,9 +1,14 @@ +tests/cases/compiler/collisionRestParameterClassConstructor.ts(3,17): error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +tests/cases/compiler/collisionRestParameterClassConstructor.ts(25,17): error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +tests/cases/compiler/collisionRestParameterClassConstructor.ts(45,17): error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. + + ==== tests/cases/compiler/collisionRestParameterClassConstructor.ts (3 errors) ==== // Constructors class c1 { constructor(_i: number, ...restParameters) { //_i is error ~~~~~~~~~~ -!!! Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +!!! error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. var _i = 10; // no error } } @@ -27,7 +32,7 @@ class c3 { constructor(public _i: number, ...restParameters) { //_i is error ~~~~~~~~~~~~~~~~~ -!!! Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +!!! error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. var _i = 10; // no error } } @@ -49,7 +54,7 @@ constructor(_i: string, ...rest); // no codegen no error constructor(_i: any, ...rest) { // error ~~~~~~~ -!!! Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +!!! error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. var _i: any; // no error } } diff --git a/tests/baselines/reference/collisionRestParameterClassMethod.errors.txt b/tests/baselines/reference/collisionRestParameterClassMethod.errors.txt index 789901bc54e..ac3fb1a5561 100644 --- a/tests/baselines/reference/collisionRestParameterClassMethod.errors.txt +++ b/tests/baselines/reference/collisionRestParameterClassMethod.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/collisionRestParameterClassMethod.ts(2,16): error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +tests/cases/compiler/collisionRestParameterClassMethod.ts(10,15): error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. + + ==== tests/cases/compiler/collisionRestParameterClassMethod.ts (2 errors) ==== class c1 { public foo(_i: number, ...restParameters) { //_i is error ~~~~~~~~~~ -!!! Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +!!! error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. var _i = 10; // no error } public fooNoError(_i: number) { // no error @@ -12,7 +16,7 @@ public f4(_i: string, ...rest); // no codegen no error public f4(_i: any, ...rest) { // error ~~~~~~~ -!!! Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +!!! error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. var _i: any; // no error } diff --git a/tests/baselines/reference/collisionRestParameterFunction.errors.txt b/tests/baselines/reference/collisionRestParameterFunction.errors.txt index 3b3cb2a66ae..88a98b9c778 100644 --- a/tests/baselines/reference/collisionRestParameterFunction.errors.txt +++ b/tests/baselines/reference/collisionRestParameterFunction.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/collisionRestParameterFunction.ts(2,13): error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +tests/cases/compiler/collisionRestParameterFunction.ts(21,13): error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. + + ==== tests/cases/compiler/collisionRestParameterFunction.ts (2 errors) ==== // Functions function f1(_i: number, ...restParameters) { //_i is error ~~~~~~~~~~ -!!! Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +!!! error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. var _i = 10; // no error } function f1NoError(_i: number) { // no error @@ -23,7 +27,7 @@ function f4(_i: string, ...rest); // no codegen no error function f4(_i: any, ...rest) { // error ~~~~~~~ -!!! Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +!!! error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. } function f4NoError(_i: number); // no error diff --git a/tests/baselines/reference/collisionRestParameterFunctionExpressions.errors.txt b/tests/baselines/reference/collisionRestParameterFunctionExpressions.errors.txt index 102693b2fcc..c2c237f98b3 100644 --- a/tests/baselines/reference/collisionRestParameterFunctionExpressions.errors.txt +++ b/tests/baselines/reference/collisionRestParameterFunctionExpressions.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/collisionRestParameterFunctionExpressions.ts(2,17): error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +tests/cases/compiler/collisionRestParameterFunctionExpressions.ts(17,17): error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. + + ==== tests/cases/compiler/collisionRestParameterFunctionExpressions.ts (2 errors) ==== function foo() { function f1(_i: number, ...restParameters) { //_i is error ~~~~~~~~~~ -!!! Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +!!! error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. var _i = 10; // no error } function f1NoError(_i: number) { // no error @@ -19,7 +23,7 @@ function f4(_i: string, ...rest); // no codegen no error function f4(_i: any, ...rest) { // error ~~~~~~~ -!!! Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. +!!! error TS2397: Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter. } function f4NoError(_i: number); // no error diff --git a/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.errors.txt b/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.errors.txt index cf43c5433e7..08df732096b 100644 --- a/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.errors.txt +++ b/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/collisionRestParameterUnderscoreIUsage.ts(5,21): error TS2398: Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter. + + ==== tests/cases/compiler/collisionRestParameterUnderscoreIUsage.ts (1 errors) ==== declare var console: { log(msg?: string): void; }; var _i = "This is what I'd expect to see"; @@ -5,7 +8,7 @@ constructor(...args: any[]) { console.log(_i); // This should result in error ~~ -!!! Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter. +!!! error TS2398: Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter. } } new Foo(); \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt index 05b000677db..15ad1e0e8e7 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt @@ -1,17 +1,29 @@ +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(20,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(33,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(16,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(21,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(28,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(35,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts (10 errors) ==== function _super() { // No error } class Foo { get prop1(): number { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. function _super() { // No error } return 10; } set prop1(val: number) { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. function _super() { // No error } } @@ -19,46 +31,46 @@ class b extends Foo { get prop2(): number { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. function _super() { // Should be error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. return 10; } set prop2(val: number) { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. function _super() { // Should be error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } class c extends Foo { get prop2(): number { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = () => { function _super() { // Should be error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } return 10; } set prop2(val: number) { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = () => { function _super() { // Should be error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.errors.txt b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.errors.txt index e6b0a98a4a7..8fce8f63f9d 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/collisionSuperAndLocalFunctionInConstructor.ts(12,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInConstructor.ts(20,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndLocalFunctionInConstructor.ts (2 errors) ==== function _super() { // No error } @@ -14,7 +18,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } class c extends Foo { @@ -25,7 +29,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.errors.txt b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.errors.txt index c4ba64b811c..e45219e43c3 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/collisionSuperAndLocalFunctionInMethod.ts(13,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInMethod.ts(22,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndLocalFunctionInMethod.ts (2 errors) ==== function _super() { // No error } @@ -15,7 +19,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } _super() { // No Error } @@ -27,7 +31,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } _super() { // No error diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.errors.txt b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.errors.txt index 17ffba88341..6313eb2d830 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/collisionSuperAndLocalFunctionInProperty.ts(14,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndLocalFunctionInProperty.ts (1 errors) ==== function _super() { // No error } @@ -16,7 +19,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt index 1a09105b30c..47c52c2582e 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt @@ -1,53 +1,65 @@ +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(21,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(27,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(13,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(17,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(23,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(29,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts (10 errors) ==== var _super = 10; // No Error class Foo { get prop1(): number { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var _super = 10; // No error return 10; } set prop1(val: number) { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var _super = 10; // No error } } class b extends Foo { get prop2(): number { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var _super = 10; // Should be error ~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. return 10; } set prop2(val: number) { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var _super = 10; // Should be error ~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } class c extends Foo { get prop2(): number { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = () => { var _super = 10; // Should be error ~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } return 10; } set prop2(val: number) { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = () => { var _super = 10; // Should be error ~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.errors.txt b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.errors.txt index 7274264ffeb..4097187c3bf 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/collisionSuperAndLocalVarInConstructor.ts(10,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInConstructor.ts(17,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndLocalVarInConstructor.ts (2 errors) ==== var _super = 10; // No Error class Foo { @@ -10,7 +14,7 @@ super(); var _super = 10; // Should be error ~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } class c extends Foo { @@ -19,7 +23,7 @@ var x = () => { var _super = 10; // Should be error ~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.errors.txt b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.errors.txt index c7bed578121..72e19e20094 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/collisionSuperAndLocalVarInMethod.ts(9,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInMethod.ts(15,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndLocalVarInMethod.ts (2 errors) ==== var _super = 10; // No Error class Foo { @@ -9,7 +13,7 @@ public foo() { var _super = 10; // Should be error ~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } class c extends Foo { @@ -17,7 +21,7 @@ var x = () => { var _super = 10; // Should be error ~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.errors.txt b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.errors.txt index 481f080357e..6c786c83d8a 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/collisionSuperAndLocalVarInProperty.ts(13,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndLocalVarInProperty.ts (1 errors) ==== var _super = 10; // No Error class Foo { @@ -13,7 +16,7 @@ doStuff: () => { var _super = 10; // Should be error ~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } public _super = 10; // No error diff --git a/tests/baselines/reference/collisionSuperAndNameResolution.errors.txt b/tests/baselines/reference/collisionSuperAndNameResolution.errors.txt index 74fdc3ea68e..ea874952320 100644 --- a/tests/baselines/reference/collisionSuperAndNameResolution.errors.txt +++ b/tests/baselines/reference/collisionSuperAndNameResolution.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/collisionSuperAndNameResolution.ts(9,21): error TS2402: Expression resolves to '_super' that compiler uses to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndNameResolution.ts (1 errors) ==== var console: { log(message: any); @@ -9,6 +12,6 @@ x() { console.log(_super); // Error as this doesnt not resolve to user defined _super ~~~~~~ -!!! Expression resolves to '_super' that compiler uses to capture base class reference. +!!! error TS2402: Expression resolves to '_super' that compiler uses to capture base class reference. } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndParameter.errors.txt b/tests/baselines/reference/collisionSuperAndParameter.errors.txt index 4c6c0079fcc..b3dcdbf1be8 100644 --- a/tests/baselines/reference/collisionSuperAndParameter.errors.txt +++ b/tests/baselines/reference/collisionSuperAndParameter.errors.txt @@ -1,3 +1,14 @@ +tests/cases/compiler/collisionSuperAndParameter.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndParameter.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionSuperAndParameter.ts(17,22): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndParameter.ts(21,7): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndParameter.ts(26,11): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndParameter.ts(32,19): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndParameter.ts(35,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndParameter.ts(52,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndParameter.ts(57,7): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndParameter.ts (9 errors) ==== class Foo { a() { @@ -12,29 +23,29 @@ } set c(_super: number) { // No error ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } class Foo2 extends Foo { x() { var lamda = (_super: number) => { // Error ~~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. return x => this; // New scope. So should inject new _this capture } } y(_super: number) { // Error ~~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. var lambda = () => { return x => this; // New scope. So should inject new _this capture } } set z(_super: number) { // Error ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } public prop3: { doStuff: (_super: number) => void; // no error - no code gen @@ -42,12 +53,12 @@ public prop4 = { doStuff: (_super: number) => { // should be error ~~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } constructor(_super: number) { // should be error ~~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. super(); } } @@ -66,14 +77,14 @@ constructor(_super: string);// no code gen - no error constructor(_super: any) { // should be error ~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. super(); } y(_super: number); // no code gen - no error y(_super: string); // no code gen - no error y(_super: any) { // Error ~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. var lambda = () => { return x => this; // New scope. So should inject new _this capture } diff --git a/tests/baselines/reference/collisionSuperAndParameter1.errors.txt b/tests/baselines/reference/collisionSuperAndParameter1.errors.txt index ea3c3d9b420..361ecc1668e 100644 --- a/tests/baselines/reference/collisionSuperAndParameter1.errors.txt +++ b/tests/baselines/reference/collisionSuperAndParameter1.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/collisionSuperAndParameter1.ts(6,23): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndParameter1.ts (1 errors) ==== class Foo { } @@ -6,7 +9,7 @@ x() { var lambda = (_super: number) => { // Error ~~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. } } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.errors.txt b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.errors.txt index 5eed3b86bbc..20e71ee1b7a 100644 --- a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.errors.txt +++ b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/collisionSuperAndPropertyNameAsConstuctorParameter.ts(5,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndPropertyNameAsConstuctorParameter.ts(11,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndPropertyNameAsConstuctorParameter.ts(19,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndPropertyNameAsConstuctorParameter.ts(27,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + + ==== tests/cases/compiler/collisionSuperAndPropertyNameAsConstuctorParameter.ts (4 errors) ==== class a { } @@ -5,7 +11,7 @@ class b1 extends a { constructor(_super: number) { // should be error ~~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. super(); } } @@ -13,7 +19,7 @@ class b2 extends a { constructor(private _super: number) { // should be error ~~~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. super(); } } @@ -23,7 +29,7 @@ constructor(_super: string);// no code gen - no error constructor(_super: any) { // should be error ~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. super(); } } @@ -33,7 +39,7 @@ constructor(_super: string);// no code gen - no error constructor(private _super: any) { // should be error ~~~~~~~~~~~~~~~~~~~ -!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +!!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. super(); } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionThisExpressionAndAliasInGlobal.errors.txt b/tests/baselines/reference/collisionThisExpressionAndAliasInGlobal.errors.txt index d12256f4199..96f05d6bfcc 100644 --- a/tests/baselines/reference/collisionThisExpressionAndAliasInGlobal.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndAliasInGlobal.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/collisionThisExpressionAndAliasInGlobal.ts(5,8): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndAliasInGlobal.ts (1 errors) ==== module a { export var b = 10; @@ -5,4 +8,4 @@ var f = () => this; import _this = a; // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. \ No newline at end of file +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. \ No newline at end of file diff --git a/tests/baselines/reference/collisionThisExpressionAndAmbientClassInGlobal.errors.txt b/tests/baselines/reference/collisionThisExpressionAndAmbientClassInGlobal.errors.txt index 0c6a7955e13..562f0d2a94a 100644 --- a/tests/baselines/reference/collisionThisExpressionAndAmbientClassInGlobal.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndAmbientClassInGlobal.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/collisionThisExpressionAndAmbientClassInGlobal.ts(4,13): error TS2400: Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndAmbientClassInGlobal.ts (1 errors) ==== declare class _this { // no error - as no code generation } var f = () => this; var a = new _this(); // Error ~~~~~ -!!! Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference. \ No newline at end of file +!!! error TS2400: Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference. \ No newline at end of file diff --git a/tests/baselines/reference/collisionThisExpressionAndAmbientVarInGlobal.errors.txt b/tests/baselines/reference/collisionThisExpressionAndAmbientVarInGlobal.errors.txt index 77439118c9a..412b2c8e18d 100644 --- a/tests/baselines/reference/collisionThisExpressionAndAmbientVarInGlobal.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndAmbientVarInGlobal.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/collisionThisExpressionAndAmbientVarInGlobal.ts(3,1): error TS2400: Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndAmbientVarInGlobal.ts (1 errors) ==== declare var _this: number; // no error as no code gen var f = () => this; _this = 10; // Error ~~~~~ -!!! Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference. \ No newline at end of file +!!! error TS2400: Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference. \ No newline at end of file diff --git a/tests/baselines/reference/collisionThisExpressionAndClassInGlobal.errors.txt b/tests/baselines/reference/collisionThisExpressionAndClassInGlobal.errors.txt index e4256953b85..26e37d4b327 100644 --- a/tests/baselines/reference/collisionThisExpressionAndClassInGlobal.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndClassInGlobal.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/collisionThisExpressionAndClassInGlobal.ts(1,7): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndClassInGlobal.ts (1 errors) ==== class _this { ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. } var f = () => this; \ No newline at end of file diff --git a/tests/baselines/reference/collisionThisExpressionAndEnumInGlobal.errors.txt b/tests/baselines/reference/collisionThisExpressionAndEnumInGlobal.errors.txt index 8e31ac24291..e6c7b70216c 100644 --- a/tests/baselines/reference/collisionThisExpressionAndEnumInGlobal.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndEnumInGlobal.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/collisionThisExpressionAndEnumInGlobal.ts(1,6): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndEnumInGlobal.ts (1 errors) ==== enum _this { // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. _thisVal1, _thisVal2, } diff --git a/tests/baselines/reference/collisionThisExpressionAndFunctionInGlobal.errors.txt b/tests/baselines/reference/collisionThisExpressionAndFunctionInGlobal.errors.txt index d76412ccad5..30fa4a444e2 100644 --- a/tests/baselines/reference/collisionThisExpressionAndFunctionInGlobal.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndFunctionInGlobal.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/collisionThisExpressionAndFunctionInGlobal.ts(1,10): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndFunctionInGlobal.ts (1 errors) ==== function _this() { //Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return 10; } var f = () => this; \ No newline at end of file diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt b/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt index 5b84e2b779f..951a349be2b 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt @@ -1,13 +1,23 @@ +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(24,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(34,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(5,21): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(15,21): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(25,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(35,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts (8 errors) ==== class class1 { get a(): number { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x2 = { doStuff: (callback) => () => { var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return callback(this); } } @@ -16,12 +26,12 @@ } set a(val: number) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x2 = { doStuff: (callback) => () => { var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return callback(this); } } @@ -32,10 +42,10 @@ class class2 { get a(): number { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var x2 = { doStuff: (callback) => () => { return callback(this); @@ -46,10 +56,10 @@ } set a(val: number) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var x2 = { doStuff: (callback) => () => { return callback(this); diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInConstructor.errors.txt b/tests/baselines/reference/collisionThisExpressionAndLocalVarInConstructor.errors.txt index 17689e7d434..af1b43786a4 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInConstructor.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInConstructor.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/collisionThisExpressionAndLocalVarInConstructor.ts(5,21): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInConstructor.ts(14,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndLocalVarInConstructor.ts (2 errors) ==== class class1 { constructor() { @@ -5,7 +9,7 @@ doStuff: (callback) => () => { var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return callback(this); } } @@ -16,7 +20,7 @@ constructor() { var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var x2 = { doStuff: (callback) => () => { return callback(this); diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.errors.txt b/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.errors.txt index 171f41fa107..3dd4f6e31a3 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/collisionThisExpressionAndLocalVarInFunction.ts(5,9): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndLocalVarInFunction.ts (1 errors) ==== var console: { log(val: any); @@ -5,6 +8,6 @@ function x() { var _this = 5; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. x => { console.log(this.x); }; } \ No newline at end of file diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInLambda.errors.txt b/tests/baselines/reference/collisionThisExpressionAndLocalVarInLambda.errors.txt index 5e734c998ae..3b6e8cb4cca 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInLambda.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInLambda.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/collisionThisExpressionAndLocalVarInLambda.ts(5,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndLocalVarInLambda.ts (1 errors) ==== declare function alert(message?: any): void; @@ -5,7 +8,7 @@ doStuff: (callback) => () => { var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return callback(this); } } diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInMethod.errors.txt b/tests/baselines/reference/collisionThisExpressionAndLocalVarInMethod.errors.txt index da6a81be808..018f3bb49d2 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInMethod.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInMethod.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/collisionThisExpressionAndLocalVarInMethod.ts(5,21): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInMethod.ts(11,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndLocalVarInMethod.ts (2 errors) ==== class a { method1() { @@ -5,7 +9,7 @@ doStuff: (callback) => () => { var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return callback(this); } } @@ -13,7 +17,7 @@ method2() { var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return { doStuff: (callback) => () => { return callback(this); diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInProperty.errors.txt b/tests/baselines/reference/collisionThisExpressionAndLocalVarInProperty.errors.txt index 57a768213a3..4c166ac13ac 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInProperty.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInProperty.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/collisionThisExpressionAndLocalVarInProperty.ts(4,17): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInProperty.ts(12,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndLocalVarInProperty.ts (2 errors) ==== class class1 { public prop1 = { doStuff: (callback) => () => { var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return callback(this); } } @@ -14,7 +18,7 @@ constructor() { var _this = 2; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. } public prop1 = { doStuff: (callback) => () => { diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.errors.txt b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.errors.txt index 307c829c986..df308b894f1 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/collisionThisExpressionAndLocalVarWithSuperExperssion.ts(7,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarWithSuperExperssion.ts(14,17): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndLocalVarWithSuperExperssion.ts (2 errors) ==== class a { public foo() { @@ -7,7 +11,7 @@ public foo() { var _this = 10; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var f = () => super.foo(); } } @@ -16,7 +20,7 @@ var f = () => { var _this = 10; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return super.foo() } } diff --git a/tests/baselines/reference/collisionThisExpressionAndModuleInGlobal.errors.txt b/tests/baselines/reference/collisionThisExpressionAndModuleInGlobal.errors.txt index 7bd8fd289b4..bcc719972dc 100644 --- a/tests/baselines/reference/collisionThisExpressionAndModuleInGlobal.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndModuleInGlobal.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/collisionThisExpressionAndModuleInGlobal.ts(1,8): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndModuleInGlobal.ts (1 errors) ==== module _this { //Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. class c { } } diff --git a/tests/baselines/reference/collisionThisExpressionAndNameResolution.errors.txt b/tests/baselines/reference/collisionThisExpressionAndNameResolution.errors.txt index 7684f5293bc..76875f46e46 100644 --- a/tests/baselines/reference/collisionThisExpressionAndNameResolution.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndNameResolution.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/collisionThisExpressionAndNameResolution.ts(8,25): error TS2400: Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndNameResolution.ts (1 errors) ==== var console : { log(message: any); @@ -8,7 +11,7 @@ function inner() { console.log(_this); // Error as this doesnt not resolve to user defined _this ~~~~~ -!!! Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference. +!!! error TS2400: Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference. return x => this; // New scope. So should inject new _this capture into function inner } } diff --git a/tests/baselines/reference/collisionThisExpressionAndParameter.errors.txt b/tests/baselines/reference/collisionThisExpressionAndParameter.errors.txt index 0e3d5945887..d2bf00483e4 100644 --- a/tests/baselines/reference/collisionThisExpressionAndParameter.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndParameter.errors.txt @@ -1,23 +1,33 @@ +tests/cases/compiler/collisionThisExpressionAndParameter.ts(4,24): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndParameter.ts(9,22): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndParameter.ts(13,7): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndParameter.ts(34,17): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndParameter.ts(46,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndParameter.ts(59,17): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndParameter.ts(69,7): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndParameter.ts(81,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndParameter.ts (8 errors) ==== class Foo { x() { var _this = 10; // Local var. No this capture in x(), so no conflict. function inner(_this: number) { // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return x => this; // New scope. So should inject new _this capture into function inner } } y() { var lamda = (_this: number) => { // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. return x => this; // New scope. So should inject new _this capture } } z(_this: number) { // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var lambda = () => { return x => this; // New scope. So should inject new _this capture } @@ -40,7 +50,7 @@ class Foo1 { constructor(_this: number) { // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var x2 = { doStuff: (callback) => () => { return callback(this); @@ -54,7 +64,7 @@ function f1(_this: number) { ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. x => { console.log(this.x); }; } @@ -69,7 +79,7 @@ constructor(_this: number); // no code gen - no error constructor(_this: any) { // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var x2 = { doStuff: (callback) => () => { return callback(this); @@ -81,7 +91,7 @@ z(_this: number); // no code gen - no error z(_this: any) { // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var lambda = () => { return x => this; // New scope. So should inject new _this capture } @@ -95,7 +105,7 @@ function f3(_this: string); // no code gen - no error function f3(_this: any) { ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. x => { console.log(this.x); }; } diff --git a/tests/baselines/reference/collisionThisExpressionAndPropertyNameAsConstuctorParameter.errors.txt b/tests/baselines/reference/collisionThisExpressionAndPropertyNameAsConstuctorParameter.errors.txt index bc60fffd80c..fda0ebc930d 100644 --- a/tests/baselines/reference/collisionThisExpressionAndPropertyNameAsConstuctorParameter.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndPropertyNameAsConstuctorParameter.errors.txt @@ -1,8 +1,14 @@ +tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts(2,17): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts(10,25): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts(20,17): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts(30,25): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts (4 errors) ==== class Foo2 { constructor(_this: number) { //Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var lambda = () => { return x => this; // New scope. So should inject new _this capture } @@ -12,7 +18,7 @@ class Foo3 { constructor(private _this: number) { // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var lambda = () => { return x => this; // New scope. So should inject new _this capture } @@ -24,7 +30,7 @@ constructor(_this: string); // No code gen - no error constructor(_this: any) { // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var lambda = () => { return x => this; // New scope. So should inject new _this capture } @@ -36,7 +42,7 @@ constructor(_this: string); // No code gen - no error constructor(private _this: any) { // Error ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var lambda = () => { return x => this; // New scope. So should inject new _this capture } diff --git a/tests/baselines/reference/collisionThisExpressionAndVarInGlobal.errors.txt b/tests/baselines/reference/collisionThisExpressionAndVarInGlobal.errors.txt index c1c7e43f927..31e37f9c255 100644 --- a/tests/baselines/reference/collisionThisExpressionAndVarInGlobal.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndVarInGlobal.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/collisionThisExpressionAndVarInGlobal.ts(1,5): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. + + ==== tests/cases/compiler/collisionThisExpressionAndVarInGlobal.ts (1 errors) ==== var _this = 1; ~~~~~ -!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. var f = () => this; \ No newline at end of file diff --git a/tests/baselines/reference/commaOperatorInvalidAssignmentType.errors.txt b/tests/baselines/reference/commaOperatorInvalidAssignmentType.errors.txt index d426c3f5eb0..5d0d67067e5 100644 --- a/tests/baselines/reference/commaOperatorInvalidAssignmentType.errors.txt +++ b/tests/baselines/reference/commaOperatorInvalidAssignmentType.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/expressions/commaOperator/commaOperatorInvalidAssignmentType.ts(10,1): error TS2323: Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/expressions/commaOperator/commaOperatorInvalidAssignmentType.ts(11,1): error TS2323: Type 'number' is not assignable to type 'boolean'. +tests/cases/conformance/expressions/commaOperator/commaOperatorInvalidAssignmentType.ts(13,1): error TS2323: Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/expressions/commaOperator/commaOperatorInvalidAssignmentType.ts(14,1): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/commaOperator/commaOperatorInvalidAssignmentType.ts(16,1): error TS2323: Type 'boolean' is not assignable to type 'string'. +tests/cases/conformance/expressions/commaOperator/commaOperatorInvalidAssignmentType.ts(17,1): error TS2323: Type 'number' is not assignable to type 'string'. + + ==== tests/cases/conformance/expressions/commaOperator/commaOperatorInvalidAssignmentType.ts (6 errors) ==== var BOOLEAN: boolean; var NUMBER: number; @@ -10,22 +18,22 @@ //Expect errors when the results type is different form the second operand resultIsBoolean = (BOOLEAN, STRING); ~~~~~~~~~~~~~~~ -!!! Type 'string' is not assignable to type 'boolean'. +!!! error TS2323: Type 'string' is not assignable to type 'boolean'. resultIsBoolean = (BOOLEAN, NUMBER); ~~~~~~~~~~~~~~~ -!!! Type 'number' is not assignable to type 'boolean'. +!!! error TS2323: Type 'number' is not assignable to type 'boolean'. resultIsNumber = (NUMBER, BOOLEAN); ~~~~~~~~~~~~~~ -!!! Type 'boolean' is not assignable to type 'number'. +!!! error TS2323: Type 'boolean' is not assignable to type 'number'. resultIsNumber = (NUMBER, STRING); ~~~~~~~~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. resultIsString = (STRING, BOOLEAN); ~~~~~~~~~~~~~~ -!!! Type 'boolean' is not assignable to type 'string'. +!!! error TS2323: Type 'boolean' is not assignable to type 'string'. resultIsString = (STRING, NUMBER); ~~~~~~~~~~~~~~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt b/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt index e8a8027eab8..75cd76e407e 100644 --- a/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt +++ b/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts(6,5): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts(12,9): error TS2323: Type 'T2' is not assignable to type 'T1'. + + ==== tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts (2 errors) ==== //Expect to have compiler errors //Comma operator in fuction arguments and return @@ -6,7 +10,7 @@ } var resultIsString: number = foo(1, "123"); //error here ~~~~~~~~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. //TypeParameters function foo1() { @@ -14,5 +18,5 @@ var y: T2; var result: T1 = (x, y); //error here ~~~~~~ -!!! Type 'T2' is not assignable to type 'T1'. +!!! error TS2323: Type 'T2' is not assignable to type 'T1'. } \ No newline at end of file diff --git a/tests/baselines/reference/commaOperatorWithoutOperand.errors.txt b/tests/baselines/reference/commaOperatorWithoutOperand.errors.txt index a213d416492..7120a827042 100644 --- a/tests/baselines/reference/commaOperatorWithoutOperand.errors.txt +++ b/tests/baselines/reference/commaOperatorWithoutOperand.errors.txt @@ -1,3 +1,17 @@ +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(9,7): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(10,11): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(11,10): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(12,10): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(13,10): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(16,2): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(17,2): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(18,2): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(19,2): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(20,2): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(23,3): error TS1109: Expression expected. +tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts(23,5): error TS1109: Expression expected. + + ==== tests/cases/conformance/expressions/commaOperator/commaOperatorWithoutOperand.ts (12 errors) ==== var ANY: any; var BOOLEAN: boolean; @@ -9,40 +23,40 @@ // Missing the second operand (ANY, ); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. (BOOLEAN, ); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. (NUMBER, ); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. (STRING, ); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. (OBJECT, ); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. // Missing the first operand (, ANY); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. (, BOOLEAN); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. (, NUMBER); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. (, STRING); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. (, OBJECT); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. // Missing all operands ( , ); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~ -!!! Expression expected. \ No newline at end of file +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/commentOnClassAccessor1.errors.txt b/tests/baselines/reference/commentOnClassAccessor1.errors.txt index b434f9fc57d..4ec9a1e1052 100644 --- a/tests/baselines/reference/commentOnClassAccessor1.errors.txt +++ b/tests/baselines/reference/commentOnClassAccessor1.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/commentOnClassAccessor1.ts(5,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/commentOnClassAccessor1.ts (1 errors) ==== class C { /** @@ -5,5 +8,5 @@ */ get bar(): number { return 1;} ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/commentOnClassAccessor2.errors.txt b/tests/baselines/reference/commentOnClassAccessor2.errors.txt index 137490042a7..959a708e05c 100644 --- a/tests/baselines/reference/commentOnClassAccessor2.errors.txt +++ b/tests/baselines/reference/commentOnClassAccessor2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/commentOnClassAccessor2.ts(5,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/commentOnClassAccessor2.ts(10,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/commentOnClassAccessor2.ts (2 errors) ==== class C { /** @@ -5,12 +9,12 @@ */ get bar(): number { return 1;} ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. /** * Setter. */ set bar(v) { } ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/commentOnImportStatement1.errors.txt b/tests/baselines/reference/commentOnImportStatement1.errors.txt index 580b96bd61e..26a725a8f7c 100644 --- a/tests/baselines/reference/commentOnImportStatement1.errors.txt +++ b/tests/baselines/reference/commentOnImportStatement1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/commentOnImportStatement1.ts(3,22): error TS2307: Cannot find external module './foo'. + + ==== tests/cases/compiler/commentOnImportStatement1.ts (1 errors) ==== /* Copyright */ import foo = require('./foo'); ~~~~~~~ -!!! Cannot find external module './foo'. +!!! error TS2307: Cannot find external module './foo'. \ No newline at end of file diff --git a/tests/baselines/reference/commentOnImportStatement2.errors.txt b/tests/baselines/reference/commentOnImportStatement2.errors.txt index 5b600cf4bcf..a2ea6c19d6e 100644 --- a/tests/baselines/reference/commentOnImportStatement2.errors.txt +++ b/tests/baselines/reference/commentOnImportStatement2.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/commentOnImportStatement2.ts(2,22): error TS2307: Cannot find external module './foo'. + + ==== tests/cases/compiler/commentOnImportStatement2.ts (1 errors) ==== /* not copyright */ import foo = require('./foo'); ~~~~~~~ -!!! Cannot find external module './foo'. \ No newline at end of file +!!! error TS2307: Cannot find external module './foo'. \ No newline at end of file diff --git a/tests/baselines/reference/commentOnImportStatement3.errors.txt b/tests/baselines/reference/commentOnImportStatement3.errors.txt index dede9f0f713..427bcf3aef7 100644 --- a/tests/baselines/reference/commentOnImportStatement3.errors.txt +++ b/tests/baselines/reference/commentOnImportStatement3.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/commentOnImportStatement3.ts(4,22): error TS2307: Cannot find external module './foo'. + + ==== tests/cases/compiler/commentOnImportStatement3.ts (1 errors) ==== /* copyright */ /* not copyright */ import foo = require('./foo'); ~~~~~~~ -!!! Cannot find external module './foo'. \ No newline at end of file +!!! error TS2307: Cannot find external module './foo'. \ No newline at end of file diff --git a/tests/baselines/reference/commentsOnObjectLiteral1.errors.txt b/tests/baselines/reference/commentsOnObjectLiteral1.errors.txt index dd737b2b54a..3c80588c2fa 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral1.errors.txt +++ b/tests/baselines/reference/commentsOnObjectLiteral1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/commentsOnObjectLiteral1.ts(1,14): error TS2304: Cannot find name 'makeClass'. + + ==== tests/cases/compiler/commentsOnObjectLiteral1.ts (1 errors) ==== var Person = makeClass( ~~~~~~~~~ -!!! Cannot find name 'makeClass'. +!!! error TS2304: Cannot find name 'makeClass'. /** @scope Person */ diff --git a/tests/baselines/reference/commentsOnObjectLiteral2.errors.txt b/tests/baselines/reference/commentsOnObjectLiteral2.errors.txt index aa338e31db4..2a2394ced48 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral2.errors.txt +++ b/tests/baselines/reference/commentsOnObjectLiteral2.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/commentsOnObjectLiteral2.ts(1,14): error TS2304: Cannot find name 'makeClass'. + + ==== tests/cases/compiler/commentsOnObjectLiteral2.ts (1 errors) ==== var Person = makeClass( ~~~~~~~~~ -!!! Cannot find name 'makeClass'. +!!! error TS2304: Cannot find name 'makeClass'. { /** This is just another way to define a constructor. diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.errors.txt b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.errors.txt index c866a79e23c..2563baf1c72 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.errors.txt @@ -1,3 +1,101 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(35,12): error TS2365: Operator '<' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(36,12): error TS2365: Operator '<' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(37,12): error TS2365: Operator '<' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(38,12): error TS2365: Operator '<' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(39,12): error TS2365: Operator '<' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(40,12): error TS2365: Operator '<' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(43,12): error TS2365: Operator '<' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(44,12): error TS2365: Operator '<' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(45,12): error TS2365: Operator '<' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(46,12): error TS2365: Operator '<' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(47,12): error TS2365: Operator '<' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(48,12): error TS2365: Operator '<' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(52,12): error TS2365: Operator '>' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(53,12): error TS2365: Operator '>' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(54,12): error TS2365: Operator '>' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(55,12): error TS2365: Operator '>' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(56,12): error TS2365: Operator '>' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(57,12): error TS2365: Operator '>' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(60,12): error TS2365: Operator '>' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(61,12): error TS2365: Operator '>' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(62,12): error TS2365: Operator '>' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(63,12): error TS2365: Operator '>' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(64,12): error TS2365: Operator '>' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(65,12): error TS2365: Operator '>' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(69,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(70,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(71,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(72,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(73,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(74,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(77,12): error TS2365: Operator '<=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(78,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(79,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(80,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(81,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(82,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(86,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(87,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(88,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(89,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(90,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(91,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(94,12): error TS2365: Operator '>=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(95,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(96,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(97,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(98,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(99,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(103,12): error TS2365: Operator '==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(104,12): error TS2365: Operator '==' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(105,12): error TS2365: Operator '==' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(106,12): error TS2365: Operator '==' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(107,12): error TS2365: Operator '==' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(108,12): error TS2365: Operator '==' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(111,12): error TS2365: Operator '==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(112,12): error TS2365: Operator '==' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(113,12): error TS2365: Operator '==' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(114,12): error TS2365: Operator '==' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(115,12): error TS2365: Operator '==' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(116,12): error TS2365: Operator '==' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(120,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(121,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(122,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(123,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(124,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(125,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(128,12): error TS2365: Operator '!=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(129,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(130,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(131,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(132,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(133,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(137,12): error TS2365: Operator '===' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(138,12): error TS2365: Operator '===' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(139,12): error TS2365: Operator '===' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(140,12): error TS2365: Operator '===' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(141,12): error TS2365: Operator '===' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(142,12): error TS2365: Operator '===' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(145,12): error TS2365: Operator '===' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(146,12): error TS2365: Operator '===' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(147,12): error TS2365: Operator '===' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(148,12): error TS2365: Operator '===' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(149,12): error TS2365: Operator '===' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(150,12): error TS2365: Operator '===' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(154,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(155,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(156,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(157,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(158,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(159,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(162,12): error TS2365: Operator '!==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(163,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(164,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(165,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(166,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts(167,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts (96 errors) ==== class Base { public a: string; @@ -35,327 +133,327 @@ // operator < var r1a1 = a1 < b1; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r1a2 = a2 < b2; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. var r1a3 = a3 < b3; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. var r1a4 = a4 < b4; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. var r1a5 = a5 < b5; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. var r1a6 = a6 < b6; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. var r1a7 = a7 < b7; var r1b1 = b1 < a1; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '<' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r1b2 = b2 < a2; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. var r1b3 = b3 < a3; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. var r1b4 = b4 < a4; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. var r1b5 = b5 < a5; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. var r1b6 = b6 < a6; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. var r1b7 = b7 < a7; // operator > var r2a1 = a1 > b1; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r2a2 = a2 > b2; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. var r2a3 = a3 > b3; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. var r2a4 = a4 > b4; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. var r2a5 = a5 > b5; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. var r2a6 = a6 > b6; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. var r2a7 = a7 > b7; var r2b1 = b1 > a1; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '>' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r2b2 = b2 > a2; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. var r2b3 = b3 > a3; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. var r2b4 = b4 > a4; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. var r2b5 = b5 > a5; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. var r2b6 = b6 > a6; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. var r2b7 = b7 > a7; // operator <= var r3a1 = a1 <= b1; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r3a2 = a2 <= b2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. var r3a3 = a3 <= b3; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. var r3a4 = a4 <= b4; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. var r3a5 = a5 <= b5; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. var r3a6 = a6 <= b6; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. var r3a7 = a7 <= b7; var r3b1 = b1 <= a1; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r3b2 = b2 <= a2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. var r3b3 = b3 <= a3; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. var r3b4 = b4 <= a4; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. var r3b5 = b5 <= a5; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. var r3b6 = b6 <= a6; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. var r3b7 = b7 <= a7; // operator >= var r4a1 = a1 >= b1; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r4a2 = a2 >= b2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. var r4a3 = a3 >= b3; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. var r4a4 = a4 >= b4; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. var r4a5 = a5 >= b5; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. var r4a6 = a6 >= b6; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. var r4a7 = a7 >= b7; var r4b1 = b1 >= a1; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r4b2 = b2 >= a2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. var r4b3 = b3 >= a3; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. var r4b4 = b4 >= a4; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. var r4b5 = b5 >= a5; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. var r4b6 = b6 >= a6; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. var r4b7 = b7 >= a7; // operator == var r5a1 = a1 == b1; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r5a2 = a2 == b2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. var r5a3 = a3 == b3; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. var r5a4 = a4 == b4; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. var r5a5 = a5 == b5; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. var r5a6 = a6 == b6; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. var r5a7 = a7 == b7; var r5b1 = b1 == a1; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r5b2 = b2 == a2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. var r5b3 = b3 == a3; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. var r5b4 = b4 == a4; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. var r5b5 = b5 == a5; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. var r5b6 = b6 == a6; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. var r5b7 = b7 == a7; // operator != var r6a1 = a1 != b1; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r6a2 = a2 != b2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. var r6a3 = a3 != b3; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. var r6a4 = a4 != b4; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. var r6a5 = a5 != b5; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. var r6a6 = a6 != b6; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. var r6a7 = a7 != b7; var r6b1 = b1 != a1; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r6b2 = b2 != a2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. var r6b3 = b3 != a3; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. var r6b4 = b4 != a4; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. var r6b5 = b5 != a5; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. var r6b6 = b6 != a6; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. var r6b7 = b7 != a7; // operator === var r7a1 = a1 === b1; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r7a2 = a2 === b2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. var r7a3 = a3 === b3; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. var r7a4 = a4 === b4; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. var r7a5 = a5 === b5; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. var r7a6 = a6 === b6; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. var r7a7 = a7 === b7; var r7b1 = b1 === a1; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '===' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r7b2 = b2 === a2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. var r7b3 = b3 === a3; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. var r7b4 = b4 === a4; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. var r7b5 = b5 === a5; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. var r7b6 = b6 === a6; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. var r7b7 = b7 === a7; // operator !== var r8a1 = a1 !== b1; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r8a2 = a2 !== b2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(a: number, b: string): void; }' and '{ fn(a: string): void; }'. var r8a3 = a3 !== b3; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(a: Base, b: string): void; }' and '{ fn(a: Derived, b: Base): void; }'. var r8a4 = a4 !== b4; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(): Base; }' and '{ fn(): C; }'. var r8a5 = a5 !== b5; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(a?: Base): void; }' and '{ fn(a?: C): void; }'. var r8a6 = a6 !== b6; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(...a: Base[]): void; }' and '{ fn(...a: C[]): void; }'. var r8a7 = a7 !== b7; var r8b1 = b1 !== a1; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r8b2 = b2 !== a2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(a: string): void; }' and '{ fn(a: number, b: string): void; }'. var r8b3 = b3 !== a3; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(a: Derived, b: Base): void; }' and '{ fn(a: Base, b: string): void; }'. var r8b4 = b4 !== a4; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(): C; }' and '{ fn(): Base; }'. var r8b5 = b5 !== a5; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(a?: C): void; }' and '{ fn(a?: Base): void; }'. var r8b6 = b6 !== a6; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(...a: C[]): void; }' and '{ fn(...a: Base[]): void; }'. var r8b7 = b7 !== a7; \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.errors.txt b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.errors.txt index d0cfd9493b8..cdfd199c0fa 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.errors.txt @@ -1,3 +1,101 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(35,12): error TS2365: Operator '<' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(36,12): error TS2365: Operator '<' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(37,12): error TS2365: Operator '<' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(38,12): error TS2365: Operator '<' cannot be applied to types 'new () => Base' and 'new () => C'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(39,12): error TS2365: Operator '<' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(40,12): error TS2365: Operator '<' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(43,12): error TS2365: Operator '<' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(44,12): error TS2365: Operator '<' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(45,12): error TS2365: Operator '<' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(46,12): error TS2365: Operator '<' cannot be applied to types 'new () => C' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(47,12): error TS2365: Operator '<' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(48,12): error TS2365: Operator '<' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(52,12): error TS2365: Operator '>' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(53,12): error TS2365: Operator '>' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(54,12): error TS2365: Operator '>' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(55,12): error TS2365: Operator '>' cannot be applied to types 'new () => Base' and 'new () => C'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(56,12): error TS2365: Operator '>' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(57,12): error TS2365: Operator '>' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(60,12): error TS2365: Operator '>' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(61,12): error TS2365: Operator '>' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(62,12): error TS2365: Operator '>' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(63,12): error TS2365: Operator '>' cannot be applied to types 'new () => C' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(64,12): error TS2365: Operator '>' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(65,12): error TS2365: Operator '>' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(69,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(70,12): error TS2365: Operator '<=' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(71,12): error TS2365: Operator '<=' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(72,12): error TS2365: Operator '<=' cannot be applied to types 'new () => Base' and 'new () => C'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(73,12): error TS2365: Operator '<=' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(74,12): error TS2365: Operator '<=' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(77,12): error TS2365: Operator '<=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(78,12): error TS2365: Operator '<=' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(79,12): error TS2365: Operator '<=' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(80,12): error TS2365: Operator '<=' cannot be applied to types 'new () => C' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(81,12): error TS2365: Operator '<=' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(82,12): error TS2365: Operator '<=' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(86,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(87,12): error TS2365: Operator '>=' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(88,12): error TS2365: Operator '>=' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(89,12): error TS2365: Operator '>=' cannot be applied to types 'new () => Base' and 'new () => C'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(90,12): error TS2365: Operator '>=' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(91,12): error TS2365: Operator '>=' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(94,12): error TS2365: Operator '>=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(95,12): error TS2365: Operator '>=' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(96,12): error TS2365: Operator '>=' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(97,12): error TS2365: Operator '>=' cannot be applied to types 'new () => C' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(98,12): error TS2365: Operator '>=' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(99,12): error TS2365: Operator '>=' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(103,12): error TS2365: Operator '==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(104,12): error TS2365: Operator '==' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(105,12): error TS2365: Operator '==' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(106,12): error TS2365: Operator '==' cannot be applied to types 'new () => Base' and 'new () => C'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(107,12): error TS2365: Operator '==' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(108,12): error TS2365: Operator '==' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(111,12): error TS2365: Operator '==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(112,12): error TS2365: Operator '==' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(113,12): error TS2365: Operator '==' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(114,12): error TS2365: Operator '==' cannot be applied to types 'new () => C' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(115,12): error TS2365: Operator '==' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(116,12): error TS2365: Operator '==' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(120,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(121,12): error TS2365: Operator '!=' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(122,12): error TS2365: Operator '!=' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(123,12): error TS2365: Operator '!=' cannot be applied to types 'new () => Base' and 'new () => C'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(124,12): error TS2365: Operator '!=' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(125,12): error TS2365: Operator '!=' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(128,12): error TS2365: Operator '!=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(129,12): error TS2365: Operator '!=' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(130,12): error TS2365: Operator '!=' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(131,12): error TS2365: Operator '!=' cannot be applied to types 'new () => C' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(132,12): error TS2365: Operator '!=' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(133,12): error TS2365: Operator '!=' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(137,12): error TS2365: Operator '===' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(138,12): error TS2365: Operator '===' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(139,12): error TS2365: Operator '===' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(140,12): error TS2365: Operator '===' cannot be applied to types 'new () => Base' and 'new () => C'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(141,12): error TS2365: Operator '===' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(142,12): error TS2365: Operator '===' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(145,12): error TS2365: Operator '===' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(146,12): error TS2365: Operator '===' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(147,12): error TS2365: Operator '===' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(148,12): error TS2365: Operator '===' cannot be applied to types 'new () => C' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(149,12): error TS2365: Operator '===' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(150,12): error TS2365: Operator '===' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(154,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(155,12): error TS2365: Operator '!==' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(156,12): error TS2365: Operator '!==' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(157,12): error TS2365: Operator '!==' cannot be applied to types 'new () => Base' and 'new () => C'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(158,12): error TS2365: Operator '!==' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(159,12): error TS2365: Operator '!==' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(162,12): error TS2365: Operator '!==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(163,12): error TS2365: Operator '!==' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(164,12): error TS2365: Operator '!==' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(165,12): error TS2365: Operator '!==' cannot be applied to types 'new () => C' and 'new () => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(166,12): error TS2365: Operator '!==' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts(167,12): error TS2365: Operator '!==' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts (96 errors) ==== class Base { public a: string; @@ -35,327 +133,327 @@ // operator < var r1a1 = a1 < b1; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r1a2 = a2 < b2; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +!!! error TS2365: Operator '<' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. var r1a3 = a3 < b3; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +!!! error TS2365: Operator '<' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. var r1a4 = a4 < b4; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new () => Base' and 'new () => C'. +!!! error TS2365: Operator '<' cannot be applied to types 'new () => Base' and 'new () => C'. var r1a5 = a5 < b5; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +!!! error TS2365: Operator '<' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. var r1a6 = a6 < b6; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +!!! error TS2365: Operator '<' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. var r1a7 = a7 < b7; var r1b1 = b1 < a1; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '<' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r1b2 = b2 < a2; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +!!! error TS2365: Operator '<' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. var r1b3 = b3 < a3; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +!!! error TS2365: Operator '<' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. var r1b4 = b4 < a4; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new () => C' and 'new () => Base'. +!!! error TS2365: Operator '<' cannot be applied to types 'new () => C' and 'new () => Base'. var r1b5 = b5 < a5; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +!!! error TS2365: Operator '<' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. var r1b6 = b6 < a6; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +!!! error TS2365: Operator '<' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. var r1b7 = b7 < a7; // operator > var r2a1 = a1 > b1; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r2a2 = a2 > b2; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +!!! error TS2365: Operator '>' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. var r2a3 = a3 > b3; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +!!! error TS2365: Operator '>' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. var r2a4 = a4 > b4; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new () => Base' and 'new () => C'. +!!! error TS2365: Operator '>' cannot be applied to types 'new () => Base' and 'new () => C'. var r2a5 = a5 > b5; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +!!! error TS2365: Operator '>' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. var r2a6 = a6 > b6; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +!!! error TS2365: Operator '>' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. var r2a7 = a7 > b7; var r2b1 = b1 > a1; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '>' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r2b2 = b2 > a2; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +!!! error TS2365: Operator '>' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. var r2b3 = b3 > a3; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +!!! error TS2365: Operator '>' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. var r2b4 = b4 > a4; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new () => C' and 'new () => Base'. +!!! error TS2365: Operator '>' cannot be applied to types 'new () => C' and 'new () => Base'. var r2b5 = b5 > a5; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +!!! error TS2365: Operator '>' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. var r2b6 = b6 > a6; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +!!! error TS2365: Operator '>' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. var r2b7 = b7 > a7; // operator <= var r3a1 = a1 <= b1; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r3a2 = a2 <= b2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. var r3a3 = a3 <= b3; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. var r3a4 = a4 <= b4; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new () => Base' and 'new () => C'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new () => Base' and 'new () => C'. var r3a5 = a5 <= b5; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. var r3a6 = a6 <= b6; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. var r3a7 = a7 <= b7; var r3b1 = b1 <= a1; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r3b2 = b2 <= a2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. var r3b3 = b3 <= a3; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. var r3b4 = b4 <= a4; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new () => C' and 'new () => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new () => C' and 'new () => Base'. var r3b5 = b5 <= a5; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. var r3b6 = b6 <= a6; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. var r3b7 = b7 <= a7; // operator >= var r4a1 = a1 >= b1; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r4a2 = a2 >= b2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. var r4a3 = a3 >= b3; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. var r4a4 = a4 >= b4; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new () => Base' and 'new () => C'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new () => Base' and 'new () => C'. var r4a5 = a5 >= b5; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. var r4a6 = a6 >= b6; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. var r4a7 = a7 >= b7; var r4b1 = b1 >= a1; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r4b2 = b2 >= a2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. var r4b3 = b3 >= a3; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. var r4b4 = b4 >= a4; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new () => C' and 'new () => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new () => C' and 'new () => Base'. var r4b5 = b5 >= a5; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. var r4b6 = b6 >= a6; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. var r4b7 = b7 >= a7; // operator == var r5a1 = a1 == b1; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r5a2 = a2 == b2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +!!! error TS2365: Operator '==' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. var r5a3 = a3 == b3; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +!!! error TS2365: Operator '==' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. var r5a4 = a4 == b4; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new () => Base' and 'new () => C'. +!!! error TS2365: Operator '==' cannot be applied to types 'new () => Base' and 'new () => C'. var r5a5 = a5 == b5; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +!!! error TS2365: Operator '==' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. var r5a6 = a6 == b6; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +!!! error TS2365: Operator '==' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. var r5a7 = a7 == b7; var r5b1 = b1 == a1; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r5b2 = b2 == a2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +!!! error TS2365: Operator '==' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. var r5b3 = b3 == a3; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +!!! error TS2365: Operator '==' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. var r5b4 = b4 == a4; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new () => C' and 'new () => Base'. +!!! error TS2365: Operator '==' cannot be applied to types 'new () => C' and 'new () => Base'. var r5b5 = b5 == a5; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +!!! error TS2365: Operator '==' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. var r5b6 = b6 == a6; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +!!! error TS2365: Operator '==' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. var r5b7 = b7 == a7; // operator != var r6a1 = a1 != b1; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r6a2 = a2 != b2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. var r6a3 = a3 != b3; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. var r6a4 = a4 != b4; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new () => Base' and 'new () => C'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new () => Base' and 'new () => C'. var r6a5 = a5 != b5; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. var r6a6 = a6 != b6; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. var r6a7 = a7 != b7; var r6b1 = b1 != a1; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r6b2 = b2 != a2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. var r6b3 = b3 != a3; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. var r6b4 = b4 != a4; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new () => C' and 'new () => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new () => C' and 'new () => Base'. var r6b5 = b5 != a5; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. var r6b6 = b6 != a6; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. var r6b7 = b7 != a7; // operator === var r7a1 = a1 === b1; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r7a2 = a2 === b2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +!!! error TS2365: Operator '===' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. var r7a3 = a3 === b3; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +!!! error TS2365: Operator '===' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. var r7a4 = a4 === b4; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new () => Base' and 'new () => C'. +!!! error TS2365: Operator '===' cannot be applied to types 'new () => Base' and 'new () => C'. var r7a5 = a5 === b5; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +!!! error TS2365: Operator '===' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. var r7a6 = a6 === b6; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +!!! error TS2365: Operator '===' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. var r7a7 = a7 === b7; var r7b1 = b1 === a1; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '===' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r7b2 = b2 === a2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +!!! error TS2365: Operator '===' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. var r7b3 = b3 === a3; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +!!! error TS2365: Operator '===' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. var r7b4 = b4 === a4; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new () => C' and 'new () => Base'. +!!! error TS2365: Operator '===' cannot be applied to types 'new () => C' and 'new () => Base'. var r7b5 = b5 === a5; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +!!! error TS2365: Operator '===' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. var r7b6 = b6 === a6; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +!!! error TS2365: Operator '===' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. var r7b7 = b7 === a7; // operator !== var r8a1 = a1 !== b1; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(): Base; }' and 'new () => Base'. var r8a2 = a2 !== b2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new (a: number, b: string) => Base' and 'new (a: string) => Base'. var r8a3 = a3 !== b3; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new (a: Base, b: string) => Base' and 'new (a: Derived, b: Base) => Base'. var r8a4 = a4 !== b4; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new () => Base' and 'new () => C'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new () => Base' and 'new () => C'. var r8a5 = a5 !== b5; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new (a?: Base) => Base' and 'new (a?: C) => Base'. var r8a6 = a6 !== b6; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new (...a: Base[]) => Base' and 'new (...a: C[]) => Base'. var r8a7 = a7 !== b7; var r8b1 = b1 !== a1; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new () => Base' and '{ fn(): Base; }'. var r8b2 = b2 !== a2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new (a: string) => Base' and 'new (a: number, b: string) => Base'. var r8b3 = b3 !== a3; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new (a: Derived, b: Base) => Base' and 'new (a: Base, b: string) => Base'. var r8b4 = b4 !== a4; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new () => C' and 'new () => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new () => C' and 'new () => Base'. var r8b5 = b5 !== a5; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new (a?: C) => Base' and 'new (a?: Base) => Base'. var r8b6 = b6 !== a6; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new (...a: C[]) => Base' and 'new (...a: Base[]) => Base'. var r8b7 = b7 !== a7; \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.errors.txt b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.errors.txt index dda19ceaa18..5bb7772e75f 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.errors.txt @@ -1,3 +1,69 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(26,12): error TS2365: Operator '<' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(27,12): error TS2365: Operator '<' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(28,12): error TS2365: Operator '<' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(29,12): error TS2365: Operator '<' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(31,12): error TS2365: Operator '<' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(32,12): error TS2365: Operator '<' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(33,12): error TS2365: Operator '<' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(34,12): error TS2365: Operator '<' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(37,12): error TS2365: Operator '>' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(38,12): error TS2365: Operator '>' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(39,12): error TS2365: Operator '>' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(40,12): error TS2365: Operator '>' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(42,12): error TS2365: Operator '>' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(43,12): error TS2365: Operator '>' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(44,12): error TS2365: Operator '>' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(45,12): error TS2365: Operator '>' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(48,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(49,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(50,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(51,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(53,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(54,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(55,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(56,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(59,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(60,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(61,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(62,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(64,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(65,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(66,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(67,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(70,12): error TS2365: Operator '==' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(71,12): error TS2365: Operator '==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(72,12): error TS2365: Operator '==' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(73,12): error TS2365: Operator '==' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(75,12): error TS2365: Operator '==' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(76,12): error TS2365: Operator '==' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(77,12): error TS2365: Operator '==' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(78,12): error TS2365: Operator '==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(81,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(82,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(83,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(84,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(86,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(87,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(88,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(89,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(92,12): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(93,12): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(94,12): error TS2365: Operator '===' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(95,12): error TS2365: Operator '===' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(97,12): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(98,12): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(99,12): error TS2365: Operator '===' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(100,12): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(103,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(104,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(105,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(106,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(108,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(109,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(110,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(111,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts (64 errors) ==== class Base { public a: string; @@ -26,215 +92,215 @@ // operator < var r1a1 = a1 < b1; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. var r1a2 = a2 < b2; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. var r1a3 = a3 < b3; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. var r1a4 = a4 < b4; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. var r1b1 = b1 < a1; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. var r1b2 = b2 < a2; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. var r1b3 = b3 < a3; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. var r1b4 = b4 < a4; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. // operator > var r2a1 = a1 > b1; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. var r2a2 = a2 > b2; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. var r2a3 = a3 > b3; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. var r2a4 = a4 > b4; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. var r2b1 = b1 > a1; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. var r2b2 = b2 > a2; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. var r2b3 = b3 > a3; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. var r2b4 = b4 > a4; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. // operator <= var r3a1 = a1 <= b1; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. var r3a2 = a2 <= b2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. var r3a3 = a3 <= b3; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. var r3a4 = a4 <= b4; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. var r3b1 = b1 <= a1; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. var r3b2 = b2 <= a2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. var r3b3 = b3 <= a3; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. var r3b4 = b4 <= a4; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. // operator >= var r4a1 = a1 >= b1; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. var r4a2 = a2 >= b2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. var r4a3 = a3 >= b3; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. var r4a4 = a4 >= b4; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. var r4b1 = b1 >= a1; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. var r4b2 = b2 >= a2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. var r4b3 = b3 >= a3; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. var r4b4 = b4 >= a4; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. // operator == var r5a1 = a1 == b1; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. var r5a2 = a2 == b2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. var r5a3 = a3 == b3; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. var r5a4 = a4 == b4; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. var r5b1 = b1 == a1; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. var r5b2 = b2 == a2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. var r5b3 = b3 == a3; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. var r5b4 = b4 == a4; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. // operator != var r6a1 = a1 != b1; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. var r6a2 = a2 != b2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. var r6a3 = a3 != b3; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. var r6a4 = a4 != b4; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. var r6b1 = b1 != a1; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. var r6b2 = b2 != a2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. var r6b3 = b3 != a3; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. var r6b4 = b4 != a4; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. // operator === var r7a1 = a1 === b1; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. var r7a2 = a2 === b2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. var r7a3 = a3 === b3; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. var r7a4 = a4 === b4; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. var r7b1 = b1 === a1; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. var r7b2 = b2 === a2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. var r7b3 = b3 === a3; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. var r7b4 = b4 === a4; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. // operator !== var r8a1 = a1 !== b1; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'. var r8a2 = a2 !== b2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'. var r8a3 = a3 !== b3; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'. var r8a4 = a4 !== b4; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'. var r8b1 = b1 !== a1; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'. var r8b2 = b2 !== a2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'. var r8b3 = b3 !== a3; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'. var r8b4 = b4 !== a4; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. \ No newline at end of file +!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'. \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.errors.txt b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.errors.txt index 79da7a1389b..908f97345a1 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts(28,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts (1 errors) ==== class Base { public a: string; @@ -28,7 +31,7 @@ var a6: { fn(x: T, y: U): T }; ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var b6: { fn(x: Base, y: C): Base }; // operator < diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.errors.txt b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.errors.txt index 870a40fa0a3..5364fea089c 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts(28,19): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts (1 errors) ==== class Base { public a: string; @@ -28,7 +31,7 @@ var a6: { new (x: T, y: U): T }; ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var b6: { new (x: Base, y: C): Base }; // operator < diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.errors.txt b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.errors.txt index fd3be68dee0..5e700926eb5 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.errors.txt @@ -1,3 +1,21 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(13,11): error TS2365: Operator '<' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(14,11): error TS2365: Operator '<' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(17,11): error TS2365: Operator '>' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(18,11): error TS2365: Operator '>' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(21,11): error TS2365: Operator '<=' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(22,11): error TS2365: Operator '<=' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(25,11): error TS2365: Operator '>=' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(26,11): error TS2365: Operator '>=' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(29,11): error TS2365: Operator '==' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(30,11): error TS2365: Operator '==' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(33,11): error TS2365: Operator '!=' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(34,11): error TS2365: Operator '!=' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(37,11): error TS2365: Operator '===' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(38,11): error TS2365: Operator '===' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(41,11): error TS2365: Operator '!==' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts(42,11): error TS2365: Operator '!==' cannot be applied to types 'B1' and 'A1'. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts (16 errors) ==== interface A1 { b?: number; @@ -13,63 +31,63 @@ // operator < var ra1 = a < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '<' cannot be applied to types 'A1' and 'B1'. var ra2 = b < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '<' cannot be applied to types 'B1' and 'A1'. // operator > var rb1 = a > b; ~~~~~ -!!! Operator '>' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '>' cannot be applied to types 'A1' and 'B1'. var rb2 = b > a; ~~~~~ -!!! Operator '>' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '>' cannot be applied to types 'B1' and 'A1'. // operator <= var rc1 = a <= b; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '<=' cannot be applied to types 'A1' and 'B1'. var rc2 = b <= a; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '<=' cannot be applied to types 'B1' and 'A1'. // operator >= var rd1 = a >= b; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '>=' cannot be applied to types 'A1' and 'B1'. var rd2 = b >= a; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '>=' cannot be applied to types 'B1' and 'A1'. // operator == var re1 = a == b; ~~~~~~ -!!! Operator '==' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '==' cannot be applied to types 'A1' and 'B1'. var re2 = b == a; ~~~~~~ -!!! Operator '==' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '==' cannot be applied to types 'B1' and 'A1'. // operator != var rf1 = a != b; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '!=' cannot be applied to types 'A1' and 'B1'. var rf2 = b != a; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '!=' cannot be applied to types 'B1' and 'A1'. // operator === var rg1 = a === b; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '===' cannot be applied to types 'A1' and 'B1'. var rg2 = b === a; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '===' cannot be applied to types 'B1' and 'A1'. // operator !== var rh1 = a !== b; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '!==' cannot be applied to types 'A1' and 'B1'. var rh2 = b !== a; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'B1' and 'A1'. \ No newline at end of file +!!! error TS2365: Operator '!==' cannot be applied to types 'B1' and 'A1'. \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnProperty.errors.txt b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnProperty.errors.txt index c8d6dd24fa3..10033087946 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnProperty.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnProperty.errors.txt @@ -1,3 +1,37 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(23,12): error TS2365: Operator '<' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(24,12): error TS2365: Operator '<' cannot be applied to types 'A2' and 'B2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(26,12): error TS2365: Operator '<' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(27,12): error TS2365: Operator '<' cannot be applied to types 'B2' and 'A2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(30,12): error TS2365: Operator '>' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(31,12): error TS2365: Operator '>' cannot be applied to types 'A2' and 'B2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(33,12): error TS2365: Operator '>' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(34,12): error TS2365: Operator '>' cannot be applied to types 'B2' and 'A2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(37,12): error TS2365: Operator '<=' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(38,12): error TS2365: Operator '<=' cannot be applied to types 'A2' and 'B2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(40,12): error TS2365: Operator '<=' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(41,12): error TS2365: Operator '<=' cannot be applied to types 'B2' and 'A2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(44,12): error TS2365: Operator '>=' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(45,12): error TS2365: Operator '>=' cannot be applied to types 'A2' and 'B2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(47,12): error TS2365: Operator '>=' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(48,12): error TS2365: Operator '>=' cannot be applied to types 'B2' and 'A2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(51,12): error TS2365: Operator '==' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(52,12): error TS2365: Operator '==' cannot be applied to types 'A2' and 'B2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(54,12): error TS2365: Operator '==' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(55,12): error TS2365: Operator '==' cannot be applied to types 'B2' and 'A2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(58,12): error TS2365: Operator '!=' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(59,12): error TS2365: Operator '!=' cannot be applied to types 'A2' and 'B2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(61,12): error TS2365: Operator '!=' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(62,12): error TS2365: Operator '!=' cannot be applied to types 'B2' and 'A2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(65,12): error TS2365: Operator '===' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(66,12): error TS2365: Operator '===' cannot be applied to types 'A2' and 'B2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(68,12): error TS2365: Operator '===' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(69,12): error TS2365: Operator '===' cannot be applied to types 'B2' and 'A2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(72,12): error TS2365: Operator '!==' cannot be applied to types 'A1' and 'B1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(73,12): error TS2365: Operator '!==' cannot be applied to types 'A2' and 'B2'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(75,12): error TS2365: Operator '!==' cannot be applied to types 'B1' and 'A1'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts(76,12): error TS2365: Operator '!==' cannot be applied to types 'B2' and 'A2'. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts (32 errors) ==== class A1 { public a: number; @@ -23,119 +57,119 @@ // operator < var r1a1 = a1 < b1; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '<' cannot be applied to types 'A1' and 'B1'. var r1a2 = a2 < b2; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'A2' and 'B2'. +!!! error TS2365: Operator '<' cannot be applied to types 'A2' and 'B2'. var r1b1 = b1 < a1; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '<' cannot be applied to types 'B1' and 'A1'. var r1b2 = b2 < a2; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'B2' and 'A2'. +!!! error TS2365: Operator '<' cannot be applied to types 'B2' and 'A2'. // operator > var r2a1 = a1 > b1; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '>' cannot be applied to types 'A1' and 'B1'. var r2a2 = a2 > b2; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'A2' and 'B2'. +!!! error TS2365: Operator '>' cannot be applied to types 'A2' and 'B2'. var r2b1 = b1 > a1; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '>' cannot be applied to types 'B1' and 'A1'. var r2b2 = b2 > a2; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'B2' and 'A2'. +!!! error TS2365: Operator '>' cannot be applied to types 'B2' and 'A2'. // operator <= var r3a1 = a1 <= b1; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '<=' cannot be applied to types 'A1' and 'B1'. var r3a2 = a2 <= b2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'A2' and 'B2'. +!!! error TS2365: Operator '<=' cannot be applied to types 'A2' and 'B2'. var r3b1 = b1 <= a1; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '<=' cannot be applied to types 'B1' and 'A1'. var r3b2 = b2 <= a2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'B2' and 'A2'. +!!! error TS2365: Operator '<=' cannot be applied to types 'B2' and 'A2'. // operator >= var r4a1 = a1 >= b1; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '>=' cannot be applied to types 'A1' and 'B1'. var r4a2 = a2 >= b2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'A2' and 'B2'. +!!! error TS2365: Operator '>=' cannot be applied to types 'A2' and 'B2'. var r4b1 = b1 >= a1; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '>=' cannot be applied to types 'B1' and 'A1'. var r4b2 = b2 >= a2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'B2' and 'A2'. +!!! error TS2365: Operator '>=' cannot be applied to types 'B2' and 'A2'. // operator == var r5a1 = a1 == b1; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '==' cannot be applied to types 'A1' and 'B1'. var r5a2 = a2 == b2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'A2' and 'B2'. +!!! error TS2365: Operator '==' cannot be applied to types 'A2' and 'B2'. var r5b1 = b1 == a1; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '==' cannot be applied to types 'B1' and 'A1'. var r5b2 = b2 == a2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'B2' and 'A2'. +!!! error TS2365: Operator '==' cannot be applied to types 'B2' and 'A2'. // operator != var r6a1 = a1 != b1; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '!=' cannot be applied to types 'A1' and 'B1'. var r6a2 = a2 != b2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'A2' and 'B2'. +!!! error TS2365: Operator '!=' cannot be applied to types 'A2' and 'B2'. var r6b1 = b1 != a1; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '!=' cannot be applied to types 'B1' and 'A1'. var r6b2 = b2 != a2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'B2' and 'A2'. +!!! error TS2365: Operator '!=' cannot be applied to types 'B2' and 'A2'. // operator === var r7a1 = a1 === b1; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '===' cannot be applied to types 'A1' and 'B1'. var r7a2 = a2 === b2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'A2' and 'B2'. +!!! error TS2365: Operator '===' cannot be applied to types 'A2' and 'B2'. var r7b1 = b1 === a1; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '===' cannot be applied to types 'B1' and 'A1'. var r7b2 = b2 === a2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'B2' and 'A2'. +!!! error TS2365: Operator '===' cannot be applied to types 'B2' and 'A2'. // operator !== var r8a1 = a1 !== b1; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'A1' and 'B1'. +!!! error TS2365: Operator '!==' cannot be applied to types 'A1' and 'B1'. var r8a2 = a2 !== b2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'A2' and 'B2'. +!!! error TS2365: Operator '!==' cannot be applied to types 'A2' and 'B2'. var r8b1 = b1 !== a1; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'B1' and 'A1'. +!!! error TS2365: Operator '!==' cannot be applied to types 'B1' and 'A1'. var r8b2 = b2 !== a2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'B2' and 'A2'. \ No newline at end of file +!!! error TS2365: Operator '!==' cannot be applied to types 'B2' and 'A2'. \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipPrimitiveType.errors.txt b/tests/baselines/reference/comparisonOperatorWithNoRelationshipPrimitiveType.errors.txt index d614662c0a1..ec511069130 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipPrimitiveType.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipPrimitiveType.errors.txt @@ -1,3 +1,149 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(10,12): error TS2365: Operator '<' cannot be applied to types 'number' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(11,12): error TS2365: Operator '<' cannot be applied to types 'number' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(12,12): error TS2365: Operator '<' cannot be applied to types 'number' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(15,12): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(16,12): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(17,12): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(18,12): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(20,12): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(21,12): error TS2365: Operator '<' cannot be applied to types 'string' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(22,12): error TS2365: Operator '<' cannot be applied to types 'string' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(23,12): error TS2365: Operator '<' cannot be applied to types 'string' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(25,12): error TS2365: Operator '<' cannot be applied to types 'void' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(26,12): error TS2365: Operator '<' cannot be applied to types 'void' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(27,12): error TS2365: Operator '<' cannot be applied to types 'void' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(28,12): error TS2365: Operator '<' cannot be applied to types 'void' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(31,12): error TS2365: Operator '<' cannot be applied to types 'E' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(32,12): error TS2365: Operator '<' cannot be applied to types 'E' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(33,12): error TS2365: Operator '<' cannot be applied to types 'E' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(36,12): error TS2365: Operator '>' cannot be applied to types 'number' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(37,12): error TS2365: Operator '>' cannot be applied to types 'number' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(38,12): error TS2365: Operator '>' cannot be applied to types 'number' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(41,12): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(42,12): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(43,12): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(44,12): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(46,12): error TS2365: Operator '>' cannot be applied to types 'string' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(47,12): error TS2365: Operator '>' cannot be applied to types 'string' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(48,12): error TS2365: Operator '>' cannot be applied to types 'string' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(49,12): error TS2365: Operator '>' cannot be applied to types 'string' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(51,12): error TS2365: Operator '>' cannot be applied to types 'void' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(52,12): error TS2365: Operator '>' cannot be applied to types 'void' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(53,12): error TS2365: Operator '>' cannot be applied to types 'void' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(54,12): error TS2365: Operator '>' cannot be applied to types 'void' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(57,12): error TS2365: Operator '>' cannot be applied to types 'E' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(58,12): error TS2365: Operator '>' cannot be applied to types 'E' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(59,12): error TS2365: Operator '>' cannot be applied to types 'E' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(62,12): error TS2365: Operator '<=' cannot be applied to types 'number' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(63,12): error TS2365: Operator '<=' cannot be applied to types 'number' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(64,12): error TS2365: Operator '<=' cannot be applied to types 'number' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(67,12): error TS2365: Operator '<=' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(68,12): error TS2365: Operator '<=' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(69,12): error TS2365: Operator '<=' cannot be applied to types 'boolean' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(70,12): error TS2365: Operator '<=' cannot be applied to types 'boolean' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(72,12): error TS2365: Operator '<=' cannot be applied to types 'string' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(73,12): error TS2365: Operator '<=' cannot be applied to types 'string' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(74,12): error TS2365: Operator '<=' cannot be applied to types 'string' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(75,12): error TS2365: Operator '<=' cannot be applied to types 'string' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(77,12): error TS2365: Operator '<=' cannot be applied to types 'void' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(78,12): error TS2365: Operator '<=' cannot be applied to types 'void' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(79,12): error TS2365: Operator '<=' cannot be applied to types 'void' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(80,12): error TS2365: Operator '<=' cannot be applied to types 'void' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(83,12): error TS2365: Operator '<=' cannot be applied to types 'E' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(84,12): error TS2365: Operator '<=' cannot be applied to types 'E' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(85,12): error TS2365: Operator '<=' cannot be applied to types 'E' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(88,12): error TS2365: Operator '>=' cannot be applied to types 'number' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(89,12): error TS2365: Operator '>=' cannot be applied to types 'number' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(90,12): error TS2365: Operator '>=' cannot be applied to types 'number' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(93,12): error TS2365: Operator '>=' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(94,12): error TS2365: Operator '>=' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(95,12): error TS2365: Operator '>=' cannot be applied to types 'boolean' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(96,12): error TS2365: Operator '>=' cannot be applied to types 'boolean' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(98,12): error TS2365: Operator '>=' cannot be applied to types 'string' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(99,12): error TS2365: Operator '>=' cannot be applied to types 'string' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(100,12): error TS2365: Operator '>=' cannot be applied to types 'string' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(101,12): error TS2365: Operator '>=' cannot be applied to types 'string' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(103,12): error TS2365: Operator '>=' cannot be applied to types 'void' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(104,12): error TS2365: Operator '>=' cannot be applied to types 'void' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(105,12): error TS2365: Operator '>=' cannot be applied to types 'void' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(106,12): error TS2365: Operator '>=' cannot be applied to types 'void' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(109,12): error TS2365: Operator '>=' cannot be applied to types 'E' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(110,12): error TS2365: Operator '>=' cannot be applied to types 'E' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(111,12): error TS2365: Operator '>=' cannot be applied to types 'E' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(114,12): error TS2365: Operator '==' cannot be applied to types 'number' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(115,12): error TS2365: Operator '==' cannot be applied to types 'number' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(116,12): error TS2365: Operator '==' cannot be applied to types 'number' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(119,12): error TS2365: Operator '==' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(120,12): error TS2365: Operator '==' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(121,12): error TS2365: Operator '==' cannot be applied to types 'boolean' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(122,12): error TS2365: Operator '==' cannot be applied to types 'boolean' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(124,12): error TS2365: Operator '==' cannot be applied to types 'string' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(125,12): error TS2365: Operator '==' cannot be applied to types 'string' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(126,12): error TS2365: Operator '==' cannot be applied to types 'string' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(127,12): error TS2365: Operator '==' cannot be applied to types 'string' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(129,12): error TS2365: Operator '==' cannot be applied to types 'void' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(130,12): error TS2365: Operator '==' cannot be applied to types 'void' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(131,12): error TS2365: Operator '==' cannot be applied to types 'void' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(132,12): error TS2365: Operator '==' cannot be applied to types 'void' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(135,12): error TS2365: Operator '==' cannot be applied to types 'E' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(136,12): error TS2365: Operator '==' cannot be applied to types 'E' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(137,12): error TS2365: Operator '==' cannot be applied to types 'E' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(140,12): error TS2365: Operator '!=' cannot be applied to types 'number' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(141,12): error TS2365: Operator '!=' cannot be applied to types 'number' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(142,12): error TS2365: Operator '!=' cannot be applied to types 'number' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(145,12): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(146,12): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(147,12): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(148,12): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(150,12): error TS2365: Operator '!=' cannot be applied to types 'string' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(151,12): error TS2365: Operator '!=' cannot be applied to types 'string' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(152,12): error TS2365: Operator '!=' cannot be applied to types 'string' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(153,12): error TS2365: Operator '!=' cannot be applied to types 'string' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(155,12): error TS2365: Operator '!=' cannot be applied to types 'void' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(156,12): error TS2365: Operator '!=' cannot be applied to types 'void' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(157,12): error TS2365: Operator '!=' cannot be applied to types 'void' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(158,12): error TS2365: Operator '!=' cannot be applied to types 'void' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(161,12): error TS2365: Operator '!=' cannot be applied to types 'E' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(162,12): error TS2365: Operator '!=' cannot be applied to types 'E' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(163,12): error TS2365: Operator '!=' cannot be applied to types 'E' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(166,12): error TS2365: Operator '===' cannot be applied to types 'number' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(167,12): error TS2365: Operator '===' cannot be applied to types 'number' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(168,12): error TS2365: Operator '===' cannot be applied to types 'number' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(171,12): error TS2365: Operator '===' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(172,12): error TS2365: Operator '===' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(173,12): error TS2365: Operator '===' cannot be applied to types 'boolean' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(174,12): error TS2365: Operator '===' cannot be applied to types 'boolean' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(176,12): error TS2365: Operator '===' cannot be applied to types 'string' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(177,12): error TS2365: Operator '===' cannot be applied to types 'string' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(178,12): error TS2365: Operator '===' cannot be applied to types 'string' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(179,12): error TS2365: Operator '===' cannot be applied to types 'string' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(181,12): error TS2365: Operator '===' cannot be applied to types 'void' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(182,12): error TS2365: Operator '===' cannot be applied to types 'void' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(183,12): error TS2365: Operator '===' cannot be applied to types 'void' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(184,12): error TS2365: Operator '===' cannot be applied to types 'void' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(187,12): error TS2365: Operator '===' cannot be applied to types 'E' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(188,12): error TS2365: Operator '===' cannot be applied to types 'E' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(189,12): error TS2365: Operator '===' cannot be applied to types 'E' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(192,12): error TS2365: Operator '!==' cannot be applied to types 'number' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(193,12): error TS2365: Operator '!==' cannot be applied to types 'number' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(194,12): error TS2365: Operator '!==' cannot be applied to types 'number' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(197,12): error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(198,12): error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(199,12): error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(200,12): error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(202,12): error TS2365: Operator '!==' cannot be applied to types 'string' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(203,12): error TS2365: Operator '!==' cannot be applied to types 'string' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(204,12): error TS2365: Operator '!==' cannot be applied to types 'string' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(205,12): error TS2365: Operator '!==' cannot be applied to types 'string' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(207,12): error TS2365: Operator '!==' cannot be applied to types 'void' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(208,12): error TS2365: Operator '!==' cannot be applied to types 'void' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(209,12): error TS2365: Operator '!==' cannot be applied to types 'void' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(210,12): error TS2365: Operator '!==' cannot be applied to types 'void' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(213,12): error TS2365: Operator '!==' cannot be applied to types 'E' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(214,12): error TS2365: Operator '!==' cannot be applied to types 'E' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(215,12): error TS2365: Operator '!==' cannot be applied to types 'E' and 'void'. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts (144 errors) ==== enum E { a, b, c } @@ -10,495 +156,495 @@ // operator < var r1a1 = a < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'boolean'. var r1a1 = a < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'string'. var r1a1 = a < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'void'. var r1a1 = a < e; // no error, expected var r1b1 = b < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'. var r1b1 = b < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'string'. var r1b1 = b < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'void'. var r1b1 = b < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'E'. var r1c1 = c < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. var r1c1 = c < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'boolean'. var r1c1 = c < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'void'. var r1c1 = c < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'E'. var r1d1 = d < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'number'. var r1d1 = d < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'boolean'. var r1d1 = d < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'string'. var r1d1 = d < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'E'. var r1e1 = e < a; // no error, expected var r1e1 = e < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'boolean'. var r1e1 = e < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'string'. var r1e1 = e < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'void'. // operator > var r2a1 = a > b; ~~~~~ -!!! Operator '>' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'boolean'. var r2a1 = a > c; ~~~~~ -!!! Operator '>' cannot be applied to types 'number' and 'string'. +!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'string'. var r2a1 = a > d; ~~~~~ -!!! Operator '>' cannot be applied to types 'number' and 'void'. +!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'void'. var r2a1 = a > e; // no error, expected var r2b1 = b > a; ~~~~~ -!!! Operator '>' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. var r2b1 = b > c; ~~~~~ -!!! Operator '>' cannot be applied to types 'boolean' and 'string'. +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. var r2b1 = b > d; ~~~~~ -!!! Operator '>' cannot be applied to types 'boolean' and 'void'. +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'void'. var r2b1 = b > e; ~~~~~ -!!! Operator '>' cannot be applied to types 'boolean' and 'E'. +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'E'. var r2c1 = c > a; ~~~~~ -!!! Operator '>' cannot be applied to types 'string' and 'number'. +!!! error TS2365: Operator '>' cannot be applied to types 'string' and 'number'. var r2c1 = c > b; ~~~~~ -!!! Operator '>' cannot be applied to types 'string' and 'boolean'. +!!! error TS2365: Operator '>' cannot be applied to types 'string' and 'boolean'. var r2c1 = c > d; ~~~~~ -!!! Operator '>' cannot be applied to types 'string' and 'void'. +!!! error TS2365: Operator '>' cannot be applied to types 'string' and 'void'. var r2c1 = c > e; ~~~~~ -!!! Operator '>' cannot be applied to types 'string' and 'E'. +!!! error TS2365: Operator '>' cannot be applied to types 'string' and 'E'. var r2d1 = d > a; ~~~~~ -!!! Operator '>' cannot be applied to types 'void' and 'number'. +!!! error TS2365: Operator '>' cannot be applied to types 'void' and 'number'. var r2d1 = d > b; ~~~~~ -!!! Operator '>' cannot be applied to types 'void' and 'boolean'. +!!! error TS2365: Operator '>' cannot be applied to types 'void' and 'boolean'. var r2d1 = d > c; ~~~~~ -!!! Operator '>' cannot be applied to types 'void' and 'string'. +!!! error TS2365: Operator '>' cannot be applied to types 'void' and 'string'. var r2d1 = d > e; ~~~~~ -!!! Operator '>' cannot be applied to types 'void' and 'E'. +!!! error TS2365: Operator '>' cannot be applied to types 'void' and 'E'. var r2e1 = e > a; // no error, expected var r2e1 = e > b; ~~~~~ -!!! Operator '>' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '>' cannot be applied to types 'E' and 'boolean'. var r2e1 = e > c; ~~~~~ -!!! Operator '>' cannot be applied to types 'E' and 'string'. +!!! error TS2365: Operator '>' cannot be applied to types 'E' and 'string'. var r2e1 = e > d; ~~~~~ -!!! Operator '>' cannot be applied to types 'E' and 'void'. +!!! error TS2365: Operator '>' cannot be applied to types 'E' and 'void'. // operator <= var r3a1 = a <= b; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'boolean'. var r3a1 = a <= c; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'number' and 'string'. +!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'string'. var r3a1 = a <= d; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'number' and 'void'. +!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'void'. var r3a1 = a <= e; // no error, expected var r3b1 = b <= a; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '<=' cannot be applied to types 'boolean' and 'number'. var r3b1 = b <= c; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'boolean' and 'string'. +!!! error TS2365: Operator '<=' cannot be applied to types 'boolean' and 'string'. var r3b1 = b <= d; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'boolean' and 'void'. +!!! error TS2365: Operator '<=' cannot be applied to types 'boolean' and 'void'. var r3b1 = b <= e; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'boolean' and 'E'. +!!! error TS2365: Operator '<=' cannot be applied to types 'boolean' and 'E'. var r3c1 = c <= a; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'string' and 'number'. +!!! error TS2365: Operator '<=' cannot be applied to types 'string' and 'number'. var r3c1 = c <= b; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'string' and 'boolean'. +!!! error TS2365: Operator '<=' cannot be applied to types 'string' and 'boolean'. var r3c1 = c <= d; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'string' and 'void'. +!!! error TS2365: Operator '<=' cannot be applied to types 'string' and 'void'. var r3c1 = c <= e; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'string' and 'E'. +!!! error TS2365: Operator '<=' cannot be applied to types 'string' and 'E'. var r3d1 = d <= a; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'void' and 'number'. +!!! error TS2365: Operator '<=' cannot be applied to types 'void' and 'number'. var r3d1 = d <= b; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'void' and 'boolean'. +!!! error TS2365: Operator '<=' cannot be applied to types 'void' and 'boolean'. var r3d1 = d <= c; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'void' and 'string'. +!!! error TS2365: Operator '<=' cannot be applied to types 'void' and 'string'. var r3d1 = d <= e; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'void' and 'E'. +!!! error TS2365: Operator '<=' cannot be applied to types 'void' and 'E'. var r3e1 = e <= a; // no error, expected var r3e1 = e <= b; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '<=' cannot be applied to types 'E' and 'boolean'. var r3e1 = e <= c; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'E' and 'string'. +!!! error TS2365: Operator '<=' cannot be applied to types 'E' and 'string'. var r3e1 = e <= d; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'E' and 'void'. +!!! error TS2365: Operator '<=' cannot be applied to types 'E' and 'void'. // operator >= var r4a1 = a >= b; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'boolean'. var r4a1 = a >= c; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'number' and 'string'. +!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'string'. var r4a1 = a >= d; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'number' and 'void'. +!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'void'. var r4a1 = a >= e; // no error, expected var r4b1 = b >= a; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '>=' cannot be applied to types 'boolean' and 'number'. var r4b1 = b >= c; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'boolean' and 'string'. +!!! error TS2365: Operator '>=' cannot be applied to types 'boolean' and 'string'. var r4b1 = b >= d; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'boolean' and 'void'. +!!! error TS2365: Operator '>=' cannot be applied to types 'boolean' and 'void'. var r4b1 = b >= e; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'boolean' and 'E'. +!!! error TS2365: Operator '>=' cannot be applied to types 'boolean' and 'E'. var r4c1 = c >= a; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'string' and 'number'. +!!! error TS2365: Operator '>=' cannot be applied to types 'string' and 'number'. var r4c1 = c >= b; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'string' and 'boolean'. +!!! error TS2365: Operator '>=' cannot be applied to types 'string' and 'boolean'. var r4c1 = c >= d; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'string' and 'void'. +!!! error TS2365: Operator '>=' cannot be applied to types 'string' and 'void'. var r4c1 = c >= e; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'string' and 'E'. +!!! error TS2365: Operator '>=' cannot be applied to types 'string' and 'E'. var r4d1 = d >= a; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'void' and 'number'. +!!! error TS2365: Operator '>=' cannot be applied to types 'void' and 'number'. var r4d1 = d >= b; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'void' and 'boolean'. +!!! error TS2365: Operator '>=' cannot be applied to types 'void' and 'boolean'. var r4d1 = d >= c; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'void' and 'string'. +!!! error TS2365: Operator '>=' cannot be applied to types 'void' and 'string'. var r4d1 = d >= e; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'void' and 'E'. +!!! error TS2365: Operator '>=' cannot be applied to types 'void' and 'E'. var r4e1 = e >= a; // no error, expected var r4e1 = e >= b; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '>=' cannot be applied to types 'E' and 'boolean'. var r4e1 = e >= c; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'E' and 'string'. +!!! error TS2365: Operator '>=' cannot be applied to types 'E' and 'string'. var r4e1 = e >= d; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'E' and 'void'. +!!! error TS2365: Operator '>=' cannot be applied to types 'E' and 'void'. // operator == var r5a1 = a == b; ~~~~~~ -!!! Operator '==' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '==' cannot be applied to types 'number' and 'boolean'. var r5a1 = a == c; ~~~~~~ -!!! Operator '==' cannot be applied to types 'number' and 'string'. +!!! error TS2365: Operator '==' cannot be applied to types 'number' and 'string'. var r5a1 = a == d; ~~~~~~ -!!! Operator '==' cannot be applied to types 'number' and 'void'. +!!! error TS2365: Operator '==' cannot be applied to types 'number' and 'void'. var r5a1 = a == e; // no error, expected var r5b1 = b == a; ~~~~~~ -!!! Operator '==' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '==' cannot be applied to types 'boolean' and 'number'. var r5b1 = b == c; ~~~~~~ -!!! Operator '==' cannot be applied to types 'boolean' and 'string'. +!!! error TS2365: Operator '==' cannot be applied to types 'boolean' and 'string'. var r5b1 = b == d; ~~~~~~ -!!! Operator '==' cannot be applied to types 'boolean' and 'void'. +!!! error TS2365: Operator '==' cannot be applied to types 'boolean' and 'void'. var r5b1 = b == e; ~~~~~~ -!!! Operator '==' cannot be applied to types 'boolean' and 'E'. +!!! error TS2365: Operator '==' cannot be applied to types 'boolean' and 'E'. var r5c1 = c == a; ~~~~~~ -!!! Operator '==' cannot be applied to types 'string' and 'number'. +!!! error TS2365: Operator '==' cannot be applied to types 'string' and 'number'. var r5c1 = c == b; ~~~~~~ -!!! Operator '==' cannot be applied to types 'string' and 'boolean'. +!!! error TS2365: Operator '==' cannot be applied to types 'string' and 'boolean'. var r5c1 = c == d; ~~~~~~ -!!! Operator '==' cannot be applied to types 'string' and 'void'. +!!! error TS2365: Operator '==' cannot be applied to types 'string' and 'void'. var r5c1 = c == e; ~~~~~~ -!!! Operator '==' cannot be applied to types 'string' and 'E'. +!!! error TS2365: Operator '==' cannot be applied to types 'string' and 'E'. var r5d1 = d == a; ~~~~~~ -!!! Operator '==' cannot be applied to types 'void' and 'number'. +!!! error TS2365: Operator '==' cannot be applied to types 'void' and 'number'. var r5d1 = d == b; ~~~~~~ -!!! Operator '==' cannot be applied to types 'void' and 'boolean'. +!!! error TS2365: Operator '==' cannot be applied to types 'void' and 'boolean'. var r5d1 = d == c; ~~~~~~ -!!! Operator '==' cannot be applied to types 'void' and 'string'. +!!! error TS2365: Operator '==' cannot be applied to types 'void' and 'string'. var r5d1 = d == e; ~~~~~~ -!!! Operator '==' cannot be applied to types 'void' and 'E'. +!!! error TS2365: Operator '==' cannot be applied to types 'void' and 'E'. var r5e1 = e == a; // no error, expected var r5e1 = e == b; ~~~~~~ -!!! Operator '==' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '==' cannot be applied to types 'E' and 'boolean'. var r5e1 = e == c; ~~~~~~ -!!! Operator '==' cannot be applied to types 'E' and 'string'. +!!! error TS2365: Operator '==' cannot be applied to types 'E' and 'string'. var r5e1 = e == d; ~~~~~~ -!!! Operator '==' cannot be applied to types 'E' and 'void'. +!!! error TS2365: Operator '==' cannot be applied to types 'E' and 'void'. // operator != var r6a1 = a != b; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '!=' cannot be applied to types 'number' and 'boolean'. var r6a1 = a != c; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'number' and 'string'. +!!! error TS2365: Operator '!=' cannot be applied to types 'number' and 'string'. var r6a1 = a != d; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'number' and 'void'. +!!! error TS2365: Operator '!=' cannot be applied to types 'number' and 'void'. var r6a1 = a != e; // no error, expected var r6b1 = b != a; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. var r6b1 = b != c; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'boolean' and 'string'. +!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'string'. var r6b1 = b != d; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'boolean' and 'void'. +!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'void'. var r6b1 = b != e; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'boolean' and 'E'. +!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'E'. var r6c1 = c != a; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'string' and 'number'. +!!! error TS2365: Operator '!=' cannot be applied to types 'string' and 'number'. var r6c1 = c != b; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'string' and 'boolean'. +!!! error TS2365: Operator '!=' cannot be applied to types 'string' and 'boolean'. var r6c1 = c != d; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'string' and 'void'. +!!! error TS2365: Operator '!=' cannot be applied to types 'string' and 'void'. var r6c1 = c != e; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'string' and 'E'. +!!! error TS2365: Operator '!=' cannot be applied to types 'string' and 'E'. var r6d1 = d != a; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'void' and 'number'. +!!! error TS2365: Operator '!=' cannot be applied to types 'void' and 'number'. var r6d1 = d != b; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'void' and 'boolean'. +!!! error TS2365: Operator '!=' cannot be applied to types 'void' and 'boolean'. var r6d1 = d != c; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'void' and 'string'. +!!! error TS2365: Operator '!=' cannot be applied to types 'void' and 'string'. var r6d1 = d != e; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'void' and 'E'. +!!! error TS2365: Operator '!=' cannot be applied to types 'void' and 'E'. var r6e1 = e != a; // no error, expected var r6e1 = e != b; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '!=' cannot be applied to types 'E' and 'boolean'. var r6e1 = e != c; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'E' and 'string'. +!!! error TS2365: Operator '!=' cannot be applied to types 'E' and 'string'. var r6e1 = e != d; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'E' and 'void'. +!!! error TS2365: Operator '!=' cannot be applied to types 'E' and 'void'. // operator === var r7a1 = a === b; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '===' cannot be applied to types 'number' and 'boolean'. var r7a1 = a === c; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'number' and 'string'. +!!! error TS2365: Operator '===' cannot be applied to types 'number' and 'string'. var r7a1 = a === d; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'number' and 'void'. +!!! error TS2365: Operator '===' cannot be applied to types 'number' and 'void'. var r7a1 = a === e; // no error, expected var r7b1 = b === a; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '===' cannot be applied to types 'boolean' and 'number'. var r7b1 = b === c; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'boolean' and 'string'. +!!! error TS2365: Operator '===' cannot be applied to types 'boolean' and 'string'. var r7b1 = b === d; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'boolean' and 'void'. +!!! error TS2365: Operator '===' cannot be applied to types 'boolean' and 'void'. var r7b1 = b === e; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'boolean' and 'E'. +!!! error TS2365: Operator '===' cannot be applied to types 'boolean' and 'E'. var r7c1 = c === a; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'string' and 'number'. +!!! error TS2365: Operator '===' cannot be applied to types 'string' and 'number'. var r7c1 = c === b; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'string' and 'boolean'. +!!! error TS2365: Operator '===' cannot be applied to types 'string' and 'boolean'. var r7c1 = c === d; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'string' and 'void'. +!!! error TS2365: Operator '===' cannot be applied to types 'string' and 'void'. var r7c1 = c === e; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'string' and 'E'. +!!! error TS2365: Operator '===' cannot be applied to types 'string' and 'E'. var r7d1 = d === a; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'void' and 'number'. +!!! error TS2365: Operator '===' cannot be applied to types 'void' and 'number'. var r7d1 = d === b; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'void' and 'boolean'. +!!! error TS2365: Operator '===' cannot be applied to types 'void' and 'boolean'. var r7d1 = d === c; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'void' and 'string'. +!!! error TS2365: Operator '===' cannot be applied to types 'void' and 'string'. var r7d1 = d === e; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'void' and 'E'. +!!! error TS2365: Operator '===' cannot be applied to types 'void' and 'E'. var r7e1 = e === a; // no error, expected var r7e1 = e === b; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '===' cannot be applied to types 'E' and 'boolean'. var r7e1 = e === c; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'E' and 'string'. +!!! error TS2365: Operator '===' cannot be applied to types 'E' and 'string'. var r7e1 = e === d; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'E' and 'void'. +!!! error TS2365: Operator '===' cannot be applied to types 'E' and 'void'. // operator !== var r8a1 = a !== b; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '!==' cannot be applied to types 'number' and 'boolean'. var r8a1 = a !== c; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'number' and 'string'. +!!! error TS2365: Operator '!==' cannot be applied to types 'number' and 'string'. var r8a1 = a !== d; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'number' and 'void'. +!!! error TS2365: Operator '!==' cannot be applied to types 'number' and 'void'. var r8a1 = a !== e; // no error, expected var r8b1 = b !== a; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'number'. var r8b1 = b !== c; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'boolean' and 'string'. +!!! error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'string'. var r8b1 = b !== d; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'boolean' and 'void'. +!!! error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'void'. var r8b1 = b !== e; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'boolean' and 'E'. +!!! error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'E'. var r8c1 = c !== a; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'string' and 'number'. +!!! error TS2365: Operator '!==' cannot be applied to types 'string' and 'number'. var r8c1 = c !== b; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'string' and 'boolean'. +!!! error TS2365: Operator '!==' cannot be applied to types 'string' and 'boolean'. var r8c1 = c !== d; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'string' and 'void'. +!!! error TS2365: Operator '!==' cannot be applied to types 'string' and 'void'. var r8c1 = c !== e; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'string' and 'E'. +!!! error TS2365: Operator '!==' cannot be applied to types 'string' and 'E'. var r8d1 = d !== a; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'void' and 'number'. +!!! error TS2365: Operator '!==' cannot be applied to types 'void' and 'number'. var r8d1 = d !== b; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'void' and 'boolean'. +!!! error TS2365: Operator '!==' cannot be applied to types 'void' and 'boolean'. var r8d1 = d !== c; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'void' and 'string'. +!!! error TS2365: Operator '!==' cannot be applied to types 'void' and 'string'. var r8d1 = d !== e; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'void' and 'E'. +!!! error TS2365: Operator '!==' cannot be applied to types 'void' and 'E'. var r8e1 = e !== a; // no error, expected var r8e1 = e !== b; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '!==' cannot be applied to types 'E' and 'boolean'. var r8e1 = e !== c; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'E' and 'string'. +!!! error TS2365: Operator '!==' cannot be applied to types 'E' and 'string'. var r8e1 = e !== d; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'E' and 'void'. \ No newline at end of file +!!! error TS2365: Operator '!==' cannot be applied to types 'E' and 'void'. \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipTypeParameter.errors.txt b/tests/baselines/reference/comparisonOperatorWithNoRelationshipTypeParameter.errors.txt index 6114521d63c..6bd8c30b205 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipTypeParameter.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipTypeParameter.errors.txt @@ -1,3 +1,125 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(12,14): error TS2365: Operator '<' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(13,14): error TS2365: Operator '>' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(14,14): error TS2365: Operator '<=' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(15,14): error TS2365: Operator '>=' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(16,14): error TS2365: Operator '==' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(17,14): error TS2365: Operator '!=' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(18,14): error TS2365: Operator '===' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(19,14): error TS2365: Operator '!==' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(22,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(23,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(24,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(25,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(26,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(27,16): error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(28,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(30,16): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(31,16): error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(32,16): error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(33,16): error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(34,16): error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(35,16): error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(36,16): error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(39,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(40,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(41,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(42,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(43,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(44,16): error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(45,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(47,16): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(48,16): error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(49,16): error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(50,16): error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(51,16): error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(52,16): error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(53,16): error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(56,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(57,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(58,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(59,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(60,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(61,16): error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(62,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(64,16): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(65,16): error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(66,16): error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(67,16): error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(68,16): error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(69,16): error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(70,16): error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(73,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(74,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(75,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(76,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(77,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(78,16): error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(79,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(81,16): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(82,16): error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(83,16): error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(84,16): error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(85,16): error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(86,16): error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(87,16): error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(90,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(91,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(92,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(93,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(94,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(95,16): error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(96,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(98,16): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(99,16): error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(100,16): error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(101,16): error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(102,16): error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(103,16): error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(104,16): error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(107,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(108,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(109,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(110,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(111,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(112,16): error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(113,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(115,16): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(116,16): error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(117,16): error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(118,16): error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(119,16): error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(120,16): error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(121,16): error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(124,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(125,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(126,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(127,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(128,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(129,16): error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(130,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(132,16): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(133,16): error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(134,16): error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(135,16): error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(136,16): error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(137,16): error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(138,16): error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(141,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(142,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(143,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(144,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(145,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(146,16): error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(147,16): error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(149,16): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(150,16): error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(151,16): error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(152,16): error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(153,16): error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(154,16): error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts(155,16): error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter.ts (120 errors) ==== enum E { a, b, c } @@ -12,386 +134,386 @@ function foo(t: T, u: U) { var r1 = t < u; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'U'. var r2 = t > u; ~~~~~ -!!! Operator '>' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '>' cannot be applied to types 'T' and 'U'. var r3 = t <= u; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '<=' cannot be applied to types 'T' and 'U'. var r4 = t >= u; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '>=' cannot be applied to types 'T' and 'U'. var r5 = t == u; ~~~~~~ -!!! Operator '==' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '==' cannot be applied to types 'T' and 'U'. var r6 = t != u; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '!=' cannot be applied to types 'T' and 'U'. var r7 = t === u; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '===' cannot be applied to types 'T' and 'U'. var r8 = t !== u; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '!==' cannot be applied to types 'T' and 'U'. // operator < var r1a1 = t < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. var r1a2 = t < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. var r1a3 = t < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. var r1a4 = t < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. var r1a5 = t < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. var r1a6 = t < f; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. var r1a7 = t < g; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'any[]'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. var r1b1 = a < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. var r1b2 = b < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. var r1b3 = c < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. var r1b4 = d < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. var r1b5 = e < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. var r1b6 = f < t; ~~~~~ -!!! Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. var r1b7 = g < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'any[]' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. // operator > var r2a1 = t < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. var r2a2 = t < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. var r2a3 = t < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. var r2a4 = t < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. var r2a5 = t < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. var r2a6 = t < f; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. var r2a7 = t < g; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'any[]'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. var r2b1 = a < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. var r2b2 = b < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. var r2b3 = c < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. var r2b4 = d < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. var r2b5 = e < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. var r2b6 = f < t; ~~~~~ -!!! Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. var r2b7 = g < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'any[]' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. // operator <= var r3a1 = t < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. var r3a2 = t < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. var r3a3 = t < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. var r3a4 = t < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. var r3a5 = t < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. var r3a6 = t < f; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. var r3a7 = t < g; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'any[]'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. var r3b1 = a < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. var r3b2 = b < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. var r3b3 = c < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. var r3b4 = d < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. var r3b5 = e < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. var r3b6 = f < t; ~~~~~ -!!! Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. var r3b7 = g < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'any[]' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. // operator >= var r4a1 = t < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. var r4a2 = t < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. var r4a3 = t < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. var r4a4 = t < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. var r4a5 = t < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. var r4a6 = t < f; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. var r4a7 = t < g; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'any[]'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. var r4b1 = a < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. var r4b2 = b < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. var r4b3 = c < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. var r4b4 = d < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. var r4b5 = e < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. var r4b6 = f < t; ~~~~~ -!!! Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. var r4b7 = g < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'any[]' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. // operator == var r5a1 = t < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. var r5a2 = t < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. var r5a3 = t < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. var r5a4 = t < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. var r5a5 = t < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. var r5a6 = t < f; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. var r5a7 = t < g; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'any[]'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. var r5b1 = a < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. var r5b2 = b < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. var r5b3 = c < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. var r5b4 = d < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. var r5b5 = e < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. var r5b6 = f < t; ~~~~~ -!!! Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. var r5b7 = g < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'any[]' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. // operator != var r6a1 = t < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. var r6a2 = t < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. var r6a3 = t < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. var r6a4 = t < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. var r6a5 = t < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. var r6a6 = t < f; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. var r6a7 = t < g; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'any[]'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. var r6b1 = a < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. var r6b2 = b < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. var r6b3 = c < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. var r6b4 = d < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. var r6b5 = e < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. var r6b6 = f < t; ~~~~~ -!!! Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. var r6b7 = g < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'any[]' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. // operator === var r7a1 = t < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. var r7a2 = t < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. var r7a3 = t < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. var r7a4 = t < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. var r7a5 = t < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. var r7a6 = t < f; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. var r7a7 = t < g; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'any[]'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. var r7b1 = a < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. var r7b2 = b < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. var r7b3 = c < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. var r7b4 = d < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. var r7b5 = e < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. var r7b6 = f < t; ~~~~~ -!!! Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. var r7b7 = g < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'any[]' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. // operator !== var r8a1 = t < a; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'boolean'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'boolean'. var r8a2 = t < b; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'number'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'number'. var r8a3 = t < c; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'string'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'string'. var r8a4 = t < d; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'void'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'void'. var r8a5 = t < e; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'E'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'E'. var r8a6 = t < f; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and '{ a: string; }'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and '{ a: string; }'. var r8a7 = t < g; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'any[]'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'any[]'. var r8b1 = a < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'boolean' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'T'. var r8b2 = b < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'number' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'T'. var r8b3 = c < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'string' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'T'. var r8b4 = d < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'void' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'void' and 'T'. var r8b5 = e < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'E' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'E' and 'T'. var r8b6 = f < t; ~~~~~ -!!! Operator '<' cannot be applied to types '{ a: string; }' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types '{ a: string; }' and 'T'. var r8b7 = g < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'any[]' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'any[]' and 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.errors.txt b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.errors.txt index 33fcc439e0a..2e63bf0a795 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.errors.txt @@ -1,3 +1,21 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(32,12): error TS2365: Operator '<' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(40,12): error TS2365: Operator '<' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(49,12): error TS2365: Operator '>' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(57,12): error TS2365: Operator '>' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(66,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(74,12): error TS2365: Operator '<=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(83,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(91,12): error TS2365: Operator '>=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(100,12): error TS2365: Operator '==' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(108,12): error TS2365: Operator '==' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(117,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(125,12): error TS2365: Operator '!=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(134,12): error TS2365: Operator '===' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(142,12): error TS2365: Operator '===' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(151,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts(159,12): error TS2365: Operator '!==' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts (16 errors) ==== class Base { public a: string; @@ -32,7 +50,7 @@ var r1a1 = a1 < b1; var r1a2 = a2 < b2; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. var r1a3 = a3 < b3; var r1a4 = a4 < b4; var r1a5 = a5 < b5; @@ -42,7 +60,7 @@ var r1b1 = b1 < a1; var r1b2 = b2 < a2; ~~~~~~~ -!!! Operator '<' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +!!! error TS2365: Operator '<' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. var r1b3 = b3 < a3; var r1b4 = b4 < a4; var r1b5 = b5 < a5; @@ -53,7 +71,7 @@ var r2a1 = a1 > b1; var r2a2 = a2 > b2; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. var r2a3 = a3 > b3; var r2a4 = a4 > b4; var r2a5 = a5 > b5; @@ -63,7 +81,7 @@ var r2b1 = b1 > a1; var r2b2 = b2 > a2; ~~~~~~~ -!!! Operator '>' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +!!! error TS2365: Operator '>' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. var r2b3 = b3 > a3; var r2b4 = b4 > a4; var r2b5 = b5 > a5; @@ -74,7 +92,7 @@ var r3a1 = a1 <= b1; var r3a2 = a2 <= b2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. var r3a3 = a3 <= b3; var r3a4 = a4 <= b4; var r3a5 = a5 <= b5; @@ -84,7 +102,7 @@ var r3b1 = b1 <= a1; var r3b2 = b2 <= a2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +!!! error TS2365: Operator '<=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. var r3b3 = b3 <= a3; var r3b4 = b4 <= a4; var r3b5 = b5 <= a5; @@ -95,7 +113,7 @@ var r4a1 = a1 >= b1; var r4a2 = a2 >= b2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. var r4a3 = a3 >= b3; var r4a4 = a4 >= b4; var r4a5 = a5 >= b5; @@ -105,7 +123,7 @@ var r4b1 = b1 >= a1; var r4b2 = b2 >= a2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +!!! error TS2365: Operator '>=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. var r4b3 = b3 >= a3; var r4b4 = b4 >= a4; var r4b5 = b5 >= a5; @@ -116,7 +134,7 @@ var r5a1 = a1 == b1; var r5a2 = a2 == b2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. var r5a3 = a3 == b3; var r5a4 = a4 == b4; var r5a5 = a5 == b5; @@ -126,7 +144,7 @@ var r5b1 = b1 == a1; var r5b2 = b2 == a2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +!!! error TS2365: Operator '==' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. var r5b3 = b3 == a3; var r5b4 = b4 == a4; var r5b5 = b5 == a5; @@ -137,7 +155,7 @@ var r6a1 = a1 != b1; var r6a2 = a2 != b2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. var r6a3 = a3 != b3; var r6a4 = a4 != b4; var r6a5 = a5 != b5; @@ -147,7 +165,7 @@ var r6b1 = b1 != a1; var r6b2 = b2 != a2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +!!! error TS2365: Operator '!=' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. var r6b3 = b3 != a3; var r6b4 = b4 != a4; var r6b5 = b5 != a5; @@ -158,7 +176,7 @@ var r7a1 = a1 === b1; var r7a2 = a2 === b2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. var r7a3 = a3 === b3; var r7a4 = a4 === b4; var r7a5 = a5 === b5; @@ -168,7 +186,7 @@ var r7b1 = b1 === a1; var r7b2 = b2 === a2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +!!! error TS2365: Operator '===' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. var r7b3 = b3 === a3; var r7b4 = b4 === a4; var r7b5 = b5 === a5; @@ -179,7 +197,7 @@ var r8a1 = a1 !== b1; var r8a2 = a2 !== b2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(x: T): T; }' and '{ fn(x: string, y: number): string; }'. var r8a3 = a3 !== b3; var r8a4 = a4 !== b4; var r8a5 = a5 !== b5; @@ -189,7 +207,7 @@ var r8b1 = b1 !== a1; var r8b2 = b2 !== a2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. +!!! error TS2365: Operator '!==' cannot be applied to types '{ fn(x: string, y: number): string; }' and '{ fn(x: T): T; }'. var r8b3 = b3 !== a3; var r8b4 = b4 !== a4; var r8b5 = b5 !== a5; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.errors.txt b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.errors.txt index 573322f8d66..0e352ebcc9d 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.errors.txt @@ -1,3 +1,21 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(32,12): error TS2365: Operator '<' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(40,12): error TS2365: Operator '<' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(49,12): error TS2365: Operator '>' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(57,12): error TS2365: Operator '>' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(66,12): error TS2365: Operator '<=' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(74,12): error TS2365: Operator '<=' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(83,12): error TS2365: Operator '>=' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(91,12): error TS2365: Operator '>=' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(100,12): error TS2365: Operator '==' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(108,12): error TS2365: Operator '==' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(117,12): error TS2365: Operator '!=' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(125,12): error TS2365: Operator '!=' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(134,12): error TS2365: Operator '===' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(142,12): error TS2365: Operator '===' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(151,12): error TS2365: Operator '!==' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts(159,12): error TS2365: Operator '!==' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts (16 errors) ==== class Base { public a: string; @@ -32,7 +50,7 @@ var r1a1 = a1 < b1; var r1a2 = a2 < b2; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +!!! error TS2365: Operator '<' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. var r1a3 = a3 < b3; var r1a4 = a4 < b4; var r1a5 = a5 < b5; @@ -42,7 +60,7 @@ var r1b1 = b1 < a1; var r1b2 = b2 < a2; ~~~~~~~ -!!! Operator '<' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +!!! error TS2365: Operator '<' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. var r1b3 = b3 < a3; var r1b4 = b4 < a4; var r1b5 = b5 < a5; @@ -53,7 +71,7 @@ var r2a1 = a1 > b1; var r2a2 = a2 > b2; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +!!! error TS2365: Operator '>' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. var r2a3 = a3 > b3; var r2a4 = a4 > b4; var r2a5 = a5 > b5; @@ -63,7 +81,7 @@ var r2b1 = b1 > a1; var r2b2 = b2 > a2; ~~~~~~~ -!!! Operator '>' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +!!! error TS2365: Operator '>' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. var r2b3 = b3 > a3; var r2b4 = b4 > a4; var r2b5 = b5 > a5; @@ -74,7 +92,7 @@ var r3a1 = a1 <= b1; var r3a2 = a2 <= b2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. var r3a3 = a3 <= b3; var r3a4 = a4 <= b4; var r3a5 = a5 <= b5; @@ -84,7 +102,7 @@ var r3b1 = b1 <= a1; var r3b2 = b2 <= a2; ~~~~~~~~ -!!! Operator '<=' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +!!! error TS2365: Operator '<=' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. var r3b3 = b3 <= a3; var r3b4 = b4 <= a4; var r3b5 = b5 <= a5; @@ -95,7 +113,7 @@ var r4a1 = a1 >= b1; var r4a2 = a2 >= b2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. var r4a3 = a3 >= b3; var r4a4 = a4 >= b4; var r4a5 = a5 >= b5; @@ -105,7 +123,7 @@ var r4b1 = b1 >= a1; var r4b2 = b2 >= a2; ~~~~~~~~ -!!! Operator '>=' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +!!! error TS2365: Operator '>=' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. var r4b3 = b3 >= a3; var r4b4 = b4 >= a4; var r4b5 = b5 >= a5; @@ -116,7 +134,7 @@ var r5a1 = a1 == b1; var r5a2 = a2 == b2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +!!! error TS2365: Operator '==' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. var r5a3 = a3 == b3; var r5a4 = a4 == b4; var r5a5 = a5 == b5; @@ -126,7 +144,7 @@ var r5b1 = b1 == a1; var r5b2 = b2 == a2; ~~~~~~~~ -!!! Operator '==' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +!!! error TS2365: Operator '==' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. var r5b3 = b3 == a3; var r5b4 = b4 == a4; var r5b5 = b5 == a5; @@ -137,7 +155,7 @@ var r6a1 = a1 != b1; var r6a2 = a2 != b2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. var r6a3 = a3 != b3; var r6a4 = a4 != b4; var r6a5 = a5 != b5; @@ -147,7 +165,7 @@ var r6b1 = b1 != a1; var r6b2 = b2 != a2; ~~~~~~~~ -!!! Operator '!=' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +!!! error TS2365: Operator '!=' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. var r6b3 = b3 != a3; var r6b4 = b4 != a4; var r6b5 = b5 != a5; @@ -158,7 +176,7 @@ var r7a1 = a1 === b1; var r7a2 = a2 === b2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +!!! error TS2365: Operator '===' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. var r7a3 = a3 === b3; var r7a4 = a4 === b4; var r7a5 = a5 === b5; @@ -168,7 +186,7 @@ var r7b1 = b1 === a1; var r7b2 = b2 === a2; ~~~~~~~~~ -!!! Operator '===' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +!!! error TS2365: Operator '===' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. var r7b3 = b3 === a3; var r7b4 = b4 === a4; var r7b5 = b5 === a5; @@ -179,7 +197,7 @@ var r8a1 = a1 !== b1; var r8a2 = a2 !== b2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new (x: T) => T' and 'new (x: string, y: number) => string'. var r8a3 = a3 !== b3; var r8a4 = a4 !== b4; var r8a5 = a5 !== b5; @@ -189,7 +207,7 @@ var r8b1 = b1 !== a1; var r8b2 = b2 !== a2; ~~~~~~~~~ -!!! Operator '!==' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. +!!! error TS2365: Operator '!==' cannot be applied to types 'new (x: string, y: number) => string' and 'new (x: T) => T'. var r8b3 = b3 !== a3; var r8b4 = b4 !== a4; var r8b5 = b5 !== a5; diff --git a/tests/baselines/reference/comparisonOperatorWithTypeParameter.errors.txt b/tests/baselines/reference/comparisonOperatorWithTypeParameter.errors.txt index 139efbbfc99..e8193e91a0f 100644 --- a/tests/baselines/reference/comparisonOperatorWithTypeParameter.errors.txt +++ b/tests/baselines/reference/comparisonOperatorWithTypeParameter.errors.txt @@ -1,3 +1,37 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(6,15): error TS2365: Operator '<' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(7,15): error TS2365: Operator '>' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(8,15): error TS2365: Operator '<=' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(9,15): error TS2365: Operator '>=' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(10,15): error TS2365: Operator '==' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(11,15): error TS2365: Operator '!=' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(12,15): error TS2365: Operator '===' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(13,15): error TS2365: Operator '!==' cannot be applied to types 'T' and 'U'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(15,15): error TS2365: Operator '<' cannot be applied to types 'U' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(16,15): error TS2365: Operator '>' cannot be applied to types 'U' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(17,15): error TS2365: Operator '<=' cannot be applied to types 'U' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(18,15): error TS2365: Operator '>=' cannot be applied to types 'U' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(19,15): error TS2365: Operator '==' cannot be applied to types 'U' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(20,15): error TS2365: Operator '!=' cannot be applied to types 'U' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(21,15): error TS2365: Operator '===' cannot be applied to types 'U' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(22,15): error TS2365: Operator '!==' cannot be applied to types 'U' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(24,15): error TS2365: Operator '<' cannot be applied to types 'T' and 'V'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(25,15): error TS2365: Operator '>' cannot be applied to types 'T' and 'V'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(26,15): error TS2365: Operator '<=' cannot be applied to types 'T' and 'V'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(27,15): error TS2365: Operator '>=' cannot be applied to types 'T' and 'V'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(28,15): error TS2365: Operator '==' cannot be applied to types 'T' and 'V'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(29,15): error TS2365: Operator '!=' cannot be applied to types 'T' and 'V'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(30,15): error TS2365: Operator '===' cannot be applied to types 'T' and 'V'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(31,15): error TS2365: Operator '!==' cannot be applied to types 'T' and 'V'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(33,15): error TS2365: Operator '<' cannot be applied to types 'V' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(34,15): error TS2365: Operator '>' cannot be applied to types 'V' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(35,15): error TS2365: Operator '<=' cannot be applied to types 'V' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(36,15): error TS2365: Operator '>=' cannot be applied to types 'V' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(37,15): error TS2365: Operator '==' cannot be applied to types 'V' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(38,15): error TS2365: Operator '!=' cannot be applied to types 'V' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(39,15): error TS2365: Operator '===' cannot be applied to types 'V' and 'T'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts(40,15): error TS2365: Operator '!==' cannot be applied to types 'V' and 'T'. + + ==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithTypeParameter.ts (32 errors) ==== var a: {}; var b: Object; @@ -6,103 +40,103 @@ // errors var ra1 = t < u; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'U'. var ra2 = t > u; ~~~~~ -!!! Operator '>' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '>' cannot be applied to types 'T' and 'U'. var ra3 = t <= u; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '<=' cannot be applied to types 'T' and 'U'. var ra4 = t >= u; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '>=' cannot be applied to types 'T' and 'U'. var ra5 = t == u; ~~~~~~ -!!! Operator '==' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '==' cannot be applied to types 'T' and 'U'. var ra6 = t != u; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '!=' cannot be applied to types 'T' and 'U'. var ra7 = t === u; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '===' cannot be applied to types 'T' and 'U'. var ra8 = t !== u; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'T' and 'U'. +!!! error TS2365: Operator '!==' cannot be applied to types 'T' and 'U'. var rb1 = u < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'U' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'U' and 'T'. var rb2 = u > t; ~~~~~ -!!! Operator '>' cannot be applied to types 'U' and 'T'. +!!! error TS2365: Operator '>' cannot be applied to types 'U' and 'T'. var rb3 = u <= t; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'U' and 'T'. +!!! error TS2365: Operator '<=' cannot be applied to types 'U' and 'T'. var rb4 = u >= t; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'U' and 'T'. +!!! error TS2365: Operator '>=' cannot be applied to types 'U' and 'T'. var rb5 = u == t; ~~~~~~ -!!! Operator '==' cannot be applied to types 'U' and 'T'. +!!! error TS2365: Operator '==' cannot be applied to types 'U' and 'T'. var rb6 = u != t; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'U' and 'T'. +!!! error TS2365: Operator '!=' cannot be applied to types 'U' and 'T'. var rb7 = u === t; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'U' and 'T'. +!!! error TS2365: Operator '===' cannot be applied to types 'U' and 'T'. var rb8 = u !== t; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'U' and 'T'. +!!! error TS2365: Operator '!==' cannot be applied to types 'U' and 'T'. var rc1 = t < v; ~~~~~ -!!! Operator '<' cannot be applied to types 'T' and 'V'. +!!! error TS2365: Operator '<' cannot be applied to types 'T' and 'V'. var rc2 = t > v; ~~~~~ -!!! Operator '>' cannot be applied to types 'T' and 'V'. +!!! error TS2365: Operator '>' cannot be applied to types 'T' and 'V'. var rc3 = t <= v; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'T' and 'V'. +!!! error TS2365: Operator '<=' cannot be applied to types 'T' and 'V'. var rc4 = t >= v; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'T' and 'V'. +!!! error TS2365: Operator '>=' cannot be applied to types 'T' and 'V'. var rc5 = t == v; ~~~~~~ -!!! Operator '==' cannot be applied to types 'T' and 'V'. +!!! error TS2365: Operator '==' cannot be applied to types 'T' and 'V'. var rc6 = t != v; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'T' and 'V'. +!!! error TS2365: Operator '!=' cannot be applied to types 'T' and 'V'. var rc7 = t === v; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'T' and 'V'. +!!! error TS2365: Operator '===' cannot be applied to types 'T' and 'V'. var rc8 = t !== v; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'T' and 'V'. +!!! error TS2365: Operator '!==' cannot be applied to types 'T' and 'V'. var rd1 = v < t; ~~~~~ -!!! Operator '<' cannot be applied to types 'V' and 'T'. +!!! error TS2365: Operator '<' cannot be applied to types 'V' and 'T'. var rd2 = v > t; ~~~~~ -!!! Operator '>' cannot be applied to types 'V' and 'T'. +!!! error TS2365: Operator '>' cannot be applied to types 'V' and 'T'. var rd3 = v <= t; ~~~~~~ -!!! Operator '<=' cannot be applied to types 'V' and 'T'. +!!! error TS2365: Operator '<=' cannot be applied to types 'V' and 'T'. var rd4 = v >= t; ~~~~~~ -!!! Operator '>=' cannot be applied to types 'V' and 'T'. +!!! error TS2365: Operator '>=' cannot be applied to types 'V' and 'T'. var rd5 = v == t; ~~~~~~ -!!! Operator '==' cannot be applied to types 'V' and 'T'. +!!! error TS2365: Operator '==' cannot be applied to types 'V' and 'T'. var rd6 = v != t; ~~~~~~ -!!! Operator '!=' cannot be applied to types 'V' and 'T'. +!!! error TS2365: Operator '!=' cannot be applied to types 'V' and 'T'. var rd7 = v === t; ~~~~~~~ -!!! Operator '===' cannot be applied to types 'V' and 'T'. +!!! error TS2365: Operator '===' cannot be applied to types 'V' and 'T'. var rd8 = v !== t; ~~~~~~~ -!!! Operator '!==' cannot be applied to types 'V' and 'T'. +!!! error TS2365: Operator '!==' cannot be applied to types 'V' and 'T'. // ok var re1 = t < a; diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.errors.txt b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.errors.txt index 3aa94844f14..204a7d4c21a 100644 --- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.errors.txt +++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(1,7): error TS2310: Type 'S18' recursively references itself as a base type. +tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(4,2): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts (2 errors) ==== class S18 extends S18 ~~~ -!!! Type 'S18' recursively references itself as a base type. +!!! error TS2310: Type 'S18' recursively references itself as a base type. { } (new S18(123)).S18 = 0; ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/complicatedPrivacy.errors.txt b/tests/baselines/reference/complicatedPrivacy.errors.txt index 443fefd9487..e4867f0d2f5 100644 --- a/tests/baselines/reference/complicatedPrivacy.errors.txt +++ b/tests/baselines/reference/complicatedPrivacy.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/complicatedPrivacy.ts(11,24): error TS1054: A 'get' accessor cannot have parameters. +tests/cases/compiler/complicatedPrivacy.ts(24,38): error TS1005: ';' expected. +tests/cases/compiler/complicatedPrivacy.ts(35,6): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5' has no exported member 'i6'. + + ==== tests/cases/compiler/complicatedPrivacy.ts (4 errors) ==== module m1 { export module m2 { @@ -11,7 +17,7 @@ export class C2 implements m3.i3 { public get p1(arg) { ~~ -!!! A 'get' accessor cannot have parameters. +!!! error TS1054: A 'get' accessor cannot have parameters. return new C1(); } @@ -26,7 +32,7 @@ export function f2(arg1: { x?: C1, y: number }) { ~ -!!! ';' expected. +!!! error TS1005: ';' expected. } export function f3(): { @@ -39,7 +45,7 @@ { [number]: C1; ~~~~~~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. }) { } @@ -79,7 +85,7 @@ export class c_pr implements mglo5.i5, mglo5.i6 { ~~~~~~~~ -!!! Module 'mglo5' has no exported member 'i6'. +!!! error TS2305: Module 'mglo5' has no exported member 'i6'. f1() { return "Hello"; } diff --git a/tests/baselines/reference/compoundAdditionAssignmentLHSCannotBeAssigned.errors.txt b/tests/baselines/reference/compoundAdditionAssignmentLHSCannotBeAssigned.errors.txt index 6313e08471c..2055bbc2b34 100644 --- a/tests/baselines/reference/compoundAdditionAssignmentLHSCannotBeAssigned.errors.txt +++ b/tests/baselines/reference/compoundAdditionAssignmentLHSCannotBeAssigned.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(5,1): error TS2323: Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(8,1): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(11,1): error TS2323: Type 'string' is not assignable to type 'E'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(14,1): error TS2322: Type 'string' is not assignable to type '{ a: string; }': + Property 'a' is missing in type 'String'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts(17,1): error TS2323: Type 'string' is not assignable to type 'void'. + + ==== tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned.ts (5 errors) ==== // string can add every type, and result string cannot be assigned to below types enum E { a, b, c } @@ -5,25 +13,25 @@ var x1: boolean; x1 += ''; ~~ -!!! Type 'string' is not assignable to type 'boolean'. +!!! error TS2323: Type 'string' is not assignable to type 'boolean'. var x2: number; x2 += ''; ~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. var x3: E; x3 += ''; ~~ -!!! Type 'string' is not assignable to type 'E'. +!!! error TS2323: Type 'string' is not assignable to type 'E'. var x4: {a: string}; x4 += ''; ~~ -!!! Type 'string' is not assignable to type '{ a: string; }': -!!! Property 'a' is missing in type 'String'. +!!! error TS2322: Type 'string' is not assignable to type '{ a: string; }': +!!! error TS2322: Property 'a' is missing in type 'String'. var x5: void; x5 += ''; ~~ -!!! Type 'string' is not assignable to type 'void'. \ No newline at end of file +!!! error TS2323: Type 'string' is not assignable to type 'void'. \ No newline at end of file diff --git a/tests/baselines/reference/compoundAdditionAssignmentWithInvalidOperands.errors.txt b/tests/baselines/reference/compoundAdditionAssignmentWithInvalidOperands.errors.txt index d7a4cca8e99..45be0c3129f 100644 --- a/tests/baselines/reference/compoundAdditionAssignmentWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/compoundAdditionAssignmentWithInvalidOperands.errors.txt @@ -1,3 +1,32 @@ +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(6,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'void'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(7,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(8,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and '{}'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(11,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(12,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(15,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'void'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(16,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'boolean'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(17,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'number'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(18,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'E'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(19,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(20,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(21,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(24,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(25,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'boolean'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(26,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'number'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(27,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'E'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(28,1): error TS2365: Operator '+=' cannot be applied to types 'void' and '{}'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(29,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(30,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(33,1): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(34,1): error TS2365: Operator '+=' cannot be applied to types 'number' and 'boolean'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(35,1): error TS2365: Operator '+=' cannot be applied to types 'number' and '{}'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(38,1): error TS2365: Operator '+=' cannot be applied to types 'E' and 'void'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(39,1): error TS2365: Operator '+=' cannot be applied to types 'E' and 'boolean'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(40,1): error TS2365: Operator '+=' cannot be applied to types 'E' and '{}'. + + ==== tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts (27 errors) ==== enum E { a, b } @@ -6,90 +35,90 @@ var x1: boolean; x1 += a; ~~~~~~~ -!!! Operator '+=' cannot be applied to types 'boolean' and 'void'. +!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'void'. x1 += true; ~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'. x1 += 0; ~~~~~~~ -!!! Operator '+=' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'number'. x1 += E.a; ~~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'boolean' and 'E'. +!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E'. x1 += {}; ~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'boolean' and '{}'. +!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and '{}'. x1 += null; ~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'. x1 += undefined; ~~~~~~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'boolean' and 'boolean'. +!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'. var x2: {}; x2 += a; ~~~~~~~ -!!! Operator '+=' cannot be applied to types '{}' and 'void'. +!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'void'. x2 += true; ~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types '{}' and 'boolean'. +!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'boolean'. x2 += 0; ~~~~~~~ -!!! Operator '+=' cannot be applied to types '{}' and 'number'. +!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'number'. x2 += E.a; ~~~~~~~~~ -!!! Operator '+=' cannot be applied to types '{}' and 'E'. +!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'E'. x2 += {}; ~~~~~~~~ -!!! Operator '+=' cannot be applied to types '{}' and '{}'. +!!! error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. x2 += null; ~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types '{}' and '{}'. +!!! error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. x2 += undefined; ~~~~~~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types '{}' and '{}'. +!!! error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. var x3: void; x3 += a; ~~~~~~~ -!!! Operator '+=' cannot be applied to types 'void' and 'void'. +!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. x3 += true; ~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'void' and 'boolean'. +!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'boolean'. x3 += 0; ~~~~~~~ -!!! Operator '+=' cannot be applied to types 'void' and 'number'. +!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'number'. x3 += E.a; ~~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'void' and 'E'. +!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'E'. x3 += {}; ~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'void' and '{}'. +!!! error TS2365: Operator '+=' cannot be applied to types 'void' and '{}'. x3 += null; ~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'void' and 'void'. +!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. x3 += undefined; ~~~~~~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'void' and 'void'. +!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. var x4: number; x4 += a; ~~~~~~~ -!!! Operator '+=' cannot be applied to types 'number' and 'void'. +!!! error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'. x4 += true; ~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '+=' cannot be applied to types 'number' and 'boolean'. x4 += {}; ~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'number' and '{}'. +!!! error TS2365: Operator '+=' cannot be applied to types 'number' and '{}'. var x5: E; x5 += a; ~~~~~~~ -!!! Operator '+=' cannot be applied to types 'E' and 'void'. +!!! error TS2365: Operator '+=' cannot be applied to types 'E' and 'void'. x5 += true; ~~~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '+=' cannot be applied to types 'E' and 'boolean'. x5 += {}; ~~~~~~~~ -!!! Operator '+=' cannot be applied to types 'E' and '{}'. \ No newline at end of file +!!! error TS2365: Operator '+=' cannot be applied to types 'E' and '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/compoundArithmeticAssignmentWithInvalidOperands.errors.txt b/tests/baselines/reference/compoundArithmeticAssignmentWithInvalidOperands.errors.txt index d0045d92aa0..9367285ef93 100644 --- a/tests/baselines/reference/compoundArithmeticAssignmentWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/compoundArithmeticAssignmentWithInvalidOperands.errors.txt @@ -1,3 +1,73 @@ +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(8,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(9,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(9,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(10,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(11,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(12,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(13,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(14,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(15,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(15,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(19,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(19,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(20,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(20,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(21,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(22,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(22,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(23,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(24,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(24,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(25,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(26,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(26,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(29,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(30,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(31,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(31,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(32,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(33,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(33,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(34,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(35,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(35,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(36,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(36,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(37,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(37,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(40,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(41,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(41,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(42,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(42,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(43,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(44,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(44,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(45,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(46,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(46,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(47,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(47,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(48,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(48,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(51,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(52,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(53,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(54,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(57,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(58,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(59,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(60,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts (68 errors) ==== enum E { a, b } @@ -7,191 +77,191 @@ var x1: boolean; x1 *= a; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x1 *= b; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x1 *= true; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x1 *= 0; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x1 *= '' ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x1 *= E.a; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x1 *= {}; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x1 *= null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x1 *= undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var x2: string; x2 *= a; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x2 *= b; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x2 *= true; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x2 *= 0; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x2 *= '' ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x2 *= E.a; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x2 *= {}; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x2 *= null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x2 *= undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var x3: {}; x3 *= a; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x3 *= b; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x3 *= true; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x3 *= 0; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x3 *= '' ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x3 *= E.a; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x3 *= {}; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x3 *= null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x3 *= undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var x4: void; x4 *= a; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x4 *= b; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x4 *= true; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x4 *= 0; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x4 *= '' ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x4 *= E.a; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x4 *= {}; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x4 *= null; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x4 *= undefined; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var x5: number; x5 *= b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x5 *= true; ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x5 *= '' ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x5 *= {}; ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var x6: E; x6 *= b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x6 *= true; ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x6 *= '' ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. x6 *= {}; ~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt b/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt index 7fe036ef084..b850d0a0d38 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt @@ -1,3 +1,85 @@ +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(58,9): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(59,9): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(69,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(70,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(74,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(75,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(79,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(80,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(85,21): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(86,21): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(87,11): error TS1005: ';' expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(88,11): error TS1005: ';' expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(7,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(8,9): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(11,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(12,9): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(15,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(16,9): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(21,5): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(22,5): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(25,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(26,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(31,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(33,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(34,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(37,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(38,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(40,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(41,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(44,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(45,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(46,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(47,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(48,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(49,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(50,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(51,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(52,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(53,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(54,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(55,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(62,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(63,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(69,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(70,9): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(74,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(75,9): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(79,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(80,9): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(91,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(92,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(95,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(96,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(97,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(98,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(99,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(100,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(101,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(102,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(103,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(104,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(105,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(106,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(107,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(108,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(109,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(110,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(111,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(112,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(113,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(114,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(115,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(116,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(117,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(118,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(119,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(120,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(121,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(122,1): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts (80 errors) ==== // expected error for all the LHS of compound assignments (arithmetic and addition) var value; @@ -7,129 +89,129 @@ constructor() { this *= value; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. this += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } foo() { this *= value; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. this += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } static sfoo() { this *= value; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. this += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } } function foo() { this *= value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. this += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } this *= value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. this += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. // identifiers: module, class, enum, function module M { export var a; } M *= value; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. M += value; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. C *= value; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. C += value; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. enum E { } E *= value; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. E += value; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. foo *= value; ~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. foo += value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. // literals null *= value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. null += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. true *= value; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. true += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. false *= value; ~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. false += value; ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. 0 *= value; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. 0 += value; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. '' *= value; ~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. '' += value; ~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. /d+/ *= value; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. /d+/ += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. // object literals { a: 0} *= value; ~~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. { a: 0} += value; ~~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. // array literals ['', ''] *= value; ~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ['', ''] += value; ~~~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. // super class Derived extends C { @@ -137,147 +219,147 @@ super(); super *= value; ~~ -!!! 'super' must be followed by an argument list or member access. +!!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. super += value; ~~ -!!! 'super' must be followed by an argument list or member access. +!!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } foo() { super *= value; ~~ -!!! 'super' must be followed by an argument list or member access. +!!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. super += value; ~~ -!!! 'super' must be followed by an argument list or member access. +!!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } static sfoo() { super *= value; ~~ -!!! 'super' must be followed by an argument list or member access. +!!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. super += value; ~~ -!!! 'super' must be followed by an argument list or member access. +!!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. } } // function expression function bar1() { } *= value; ~~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. function bar2() { } += value; ~~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. () => { } *= value; ~~ -!!! ';' expected. +!!! error TS1005: ';' expected. () => { } += value; ~~ -!!! ';' expected. +!!! error TS1005: ';' expected. // function calls foo() *= value; ~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. foo() += value; ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. // parentheses, the containted expression is value (this) *= value; ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (this) += value; ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (M) *= value; ~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. (M) += value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (C) *= value; ~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. (C) += value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (E) *= value; ~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. (E) += value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (foo) *= value; ~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. (foo) += value; ~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (null) *= value; ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (null) += value; ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (true) *= value; ~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. (true) += value; ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (0) *= value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (0) += value; ~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. ('') *= value; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ('') += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (/d+/) *= value; ~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. (/d+/) += value; ~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. ({}) *= value; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ({}) += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. ([]) *= value; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ([]) += value; ~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (function baz1() { }) *= value; ~~~~~~~~~~~~~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. (function baz2() { }) += value; ~~~~~~~~~~~~~~~~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. (foo()) *= value; ~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. (foo()) += value; ~~~~~~~ -!!! Invalid left-hand side of assignment expression. \ No newline at end of file +!!! error TS2364: Invalid left-hand side of assignment expression. \ No newline at end of file diff --git a/tests/baselines/reference/concatClassAndString.errors.txt b/tests/baselines/reference/concatClassAndString.errors.txt index e97ff01d754..623c213181f 100644 --- a/tests/baselines/reference/concatClassAndString.errors.txt +++ b/tests/baselines/reference/concatClassAndString.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/concatClassAndString.ts(4,1): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/compiler/concatClassAndString.ts (1 errors) ==== // Shouldn't compile (the long form f = f + ""; doesn't): class f { } f += ''; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. \ No newline at end of file diff --git a/tests/baselines/reference/conditionalExpression1.errors.txt b/tests/baselines/reference/conditionalExpression1.errors.txt index 0ae4814113d..30703c7169e 100644 --- a/tests/baselines/reference/conditionalExpression1.errors.txt +++ b/tests/baselines/reference/conditionalExpression1.errors.txt @@ -1,6 +1,9 @@ -==== tests/cases/compiler/conditionalExpression1.ts (2 errors) ==== +tests/cases/compiler/conditionalExpression1.ts(1,5): error TS2322: Type 'string | number' is not assignable to type 'boolean': + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/compiler/conditionalExpression1.ts (1 errors) ==== var x: boolean = (true ? 1 : ""); // should be an error ~ -!!! Type '{}' is not assignable to type 'boolean'. - ~~~~~~~~~~~~~ -!!! No best common type exists between 'number' and 'string'. \ No newline at end of file +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean': +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types index 8ad918936d2..edef88acfc3 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types @@ -80,7 +80,7 @@ var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA; >result4 : (t: A) => any >t : A >A : A ->true ? (m) => m.propertyX : (n) => n.propertyA : (t: A) => any +>true ? (m) => m.propertyX : (n) => n.propertyA : (m: A) => any >(m) => m.propertyX : (m: A) => any >m : A >m.propertyX : any @@ -144,7 +144,7 @@ var result8: (t: A) => any = true ? (m) => m.propertyA : (n) => n.propertyX; >result8 : (t: A) => any >t : A >A : A ->true ? (m) => m.propertyA : (n) => n.propertyX : (t: A) => any +>true ? (m) => m.propertyA : (n) => n.propertyX : (n: A) => any >(m) => m.propertyA : (m: A) => number >m : A >m.propertyA : number @@ -161,7 +161,7 @@ var result8: (t: A) => any = true ? (m) => m.propertyA : (n) => n.propertyX; var resultIsX3: X = true ? a : b; >resultIsX3 : X >X : X ->true ? a : b : X +>true ? a : b : A | B >a : A >b : B @@ -169,7 +169,7 @@ var result10: (t: X) => any = true ? (m) => m.propertyX1 : (n) => n.propertyX2; >result10 : (t: X) => any >t : X >X : X ->true ? (m) => m.propertyX1 : (n) => n.propertyX2 : (t: X) => any +>true ? (m) => m.propertyX1 : (n) => n.propertyX2 : { (m: X): number; } | { (n: X): string; } >(m) => m.propertyX1 : (m: X) => number >m : X >m.propertyX1 : number @@ -184,5 +184,5 @@ var result10: (t: X) => any = true ? (m) => m.propertyX1 : (n) => n.propertyX2; //Expr1 and Expr2 are literals var result11: any = true ? 1 : 'string'; >result11 : any ->true ? 1 : 'string' : any +>true ? 1 : 'string' : string | number diff --git a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.errors.txt b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.errors.txt index 4a34e042b1e..fb2c02d1c28 100644 --- a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.errors.txt +++ b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.errors.txt @@ -1,4 +1,21 @@ -==== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts (12 errors) ==== +tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(15,5): error TS2322: Type 'A | B' is not assignable to type 'A': + Type 'B' is not assignable to type 'A': + Property 'propertyA' is missing in type 'B'. +tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(16,5): error TS2322: Type 'A | B' is not assignable to type 'B': + Type 'A' is not assignable to type 'B': + Property 'propertyB' is missing in type 'A'. +tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(18,5): error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => number': + Type '(n: X) => string' is not assignable to type '(t: X) => number': + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(19,5): error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => string': + Type '(m: X) => number' is not assignable to type '(t: X) => string': + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts(20,5): error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => boolean': + Type '(m: X) => number' is not assignable to type '(t: X) => boolean': + Type 'number' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithoutIdenticalBCT.ts (5 errors) ==== //Cond ? Expr1 : Expr2, Expr1 and Expr2 have no identical best common type class X { propertyX: any; propertyX1: number; propertyX2: string }; class A extends X { propertyA: number }; @@ -8,41 +25,34 @@ var a: A; var b: B; - //Expect to have compiler errors - //Be not contextually typed + // No errors anymore, uses union types true ? a : b; - ~~~~~~~~~~~~ -!!! No best common type exists between 'A' and 'B'. var result1 = true ? a : b; - ~~~~~~~~~~~~ -!!! No best common type exists between 'A' and 'B'. - //Be contextually typed and and bct is not identical + //Be contextually typed and and bct is not identical, results in errors that union type is not assignable to target var result2: A = true ? a : b; ~~~~~~~ -!!! Type '{}' is not assignable to type 'A': -!!! Property 'propertyA' is missing in type '{}'. - ~~~~~~~~~~~~ -!!! No best common type exists between 'A', 'A', and 'B'. +!!! error TS2322: Type 'A | B' is not assignable to type 'A': +!!! error TS2322: Type 'B' is not assignable to type 'A': +!!! error TS2322: Property 'propertyA' is missing in type 'B'. var result3: B = true ? a : b; ~~~~~~~ -!!! Type '{}' is not assignable to type 'B': -!!! Property 'propertyB' is missing in type '{}'. - ~~~~~~~~~~~~ -!!! No best common type exists between 'B', 'A', and 'B'. +!!! error TS2322: Type 'A | B' is not assignable to type 'B': +!!! error TS2322: Type 'A' is not assignable to type 'B': +!!! error TS2322: Property 'propertyB' is missing in type 'A'. var result4: (t: X) => number = true ? (m) => m.propertyX1 : (n) => n.propertyX2; ~~~~~~~ -!!! Type '{}' is not assignable to type '(t: X) => number'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! No best common type exists between '(t: X) => number', '(m: X) => number', and '(n: X) => string'. +!!! error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => number': +!!! error TS2322: Type '(n: X) => string' is not assignable to type '(t: X) => number': +!!! error TS2322: Type 'string' is not assignable to type 'number'. var result5: (t: X) => string = true ? (m) => m.propertyX1 : (n) => n.propertyX2; ~~~~~~~ -!!! Type '{}' is not assignable to type '(t: X) => string'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! No best common type exists between '(t: X) => string', '(m: X) => number', and '(n: X) => string'. +!!! error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => string': +!!! error TS2322: Type '(m: X) => number' is not assignable to type '(t: X) => string': +!!! error TS2322: Type 'number' is not assignable to type 'string'. var result6: (t: X) => boolean = true ? (m) => m.propertyX1 : (n) => n.propertyX2; ~~~~~~~ -!!! Type '{}' is not assignable to type '(t: X) => boolean'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! No best common type exists between '(t: X) => boolean', '(m: X) => number', and '(n: X) => string'. \ No newline at end of file +!!! error TS2322: Type '{ (m: X): number; } | { (n: X): string; }' is not assignable to type '(t: X) => boolean': +!!! error TS2322: Type '(m: X) => number' is not assignable to type '(t: X) => boolean': +!!! error TS2322: Type 'number' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js index 90125d4ebf6..b6376dd781f 100644 --- a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js @@ -8,12 +8,11 @@ var x: X; var a: A; var b: B; -//Expect to have compiler errors -//Be not contextually typed +// No errors anymore, uses union types true ? a : b; var result1 = true ? a : b; -//Be contextually typed and and bct is not identical +//Be contextually typed and and bct is not identical, results in errors that union type is not assignable to target var result2: A = true ? a : b; var result3: B = true ? a : b; @@ -54,11 +53,10 @@ var B = (function (_super) { var x; var a; var b; -//Expect to have compiler errors -//Be not contextually typed +// No errors anymore, uses union types true ? a : b; var result1 = true ? a : b; -//Be contextually typed and and bct is not identical +//Be contextually typed and and bct is not identical, results in errors that union type is not assignable to target var result2 = true ? a : b; var result3 = true ? a : b; var result4 = true ? function (m) { return m.propertyX1; } : function (n) { return n.propertyX2; }; diff --git a/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt b/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt index 9bf1480f8bb..dfd87465894 100644 --- a/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt +++ b/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D': + Named properties 'm' of types 'B' and 'D' are not identical. + + ==== tests/cases/compiler/conflictingMemberTypesInBases.ts (1 errors) ==== interface A { m: string; @@ -12,7 +16,7 @@ interface E extends B { } // Error here for extending B and D ~ -!!! Interface 'E' cannot simultaneously extend types 'B' and 'D': -!!! Named properties 'm' of types 'B' and 'D' are not identical. +!!! error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D': +!!! error TS2320: Named properties 'm' of types 'B' and 'D' are not identical. interface E extends D { } // No duplicate error here \ No newline at end of file diff --git a/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt b/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt index 6bb45b67ee7..0b667108b5f 100644 --- a/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt +++ b/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt @@ -1,12 +1,21 @@ -==== tests/cases/compiler/conflictingTypeAnnotatedVar.ts (4 errors) ==== +tests/cases/compiler/conflictingTypeAnnotatedVar.ts(1,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/conflictingTypeAnnotatedVar.ts(2,10): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/conflictingTypeAnnotatedVar.ts(2,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +tests/cases/compiler/conflictingTypeAnnotatedVar.ts(3,10): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/conflictingTypeAnnotatedVar.ts(3,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. + + +==== tests/cases/compiler/conflictingTypeAnnotatedVar.ts (5 errors) ==== var foo: string; + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. function foo(): number { } ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. ~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. function foo(): number { } ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. ~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. \ No newline at end of file +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. \ No newline at end of file diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt index 3501f1b79be..b0a4a871f21 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(7,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(8,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts (3 errors) ==== class Base { foo() { } } class Derived1 extends Base { bar() { } } @@ -6,13 +11,13 @@ function foo(tagName: 'canvas'): Derived3; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(tagName: 'div'): Derived2; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(tagName: 'span'): Derived1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(tagName: number): Base; function foo(tagName: any): Base { diff --git a/tests/baselines/reference/constraintErrors1.errors.txt b/tests/baselines/reference/constraintErrors1.errors.txt index f081959d028..2a6ef4f120f 100644 --- a/tests/baselines/reference/constraintErrors1.errors.txt +++ b/tests/baselines/reference/constraintErrors1.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/constraintErrors1.ts(1,25): error TS2304: Cannot find name 'hm'. + + ==== tests/cases/compiler/constraintErrors1.ts (1 errors) ==== function foo5(test: T) { } ~~ -!!! Cannot find name 'hm'. \ No newline at end of file +!!! error TS2304: Cannot find name 'hm'. \ No newline at end of file diff --git a/tests/baselines/reference/constraintReferencingTypeParameterFromSameTypeParameterList.errors.txt b/tests/baselines/reference/constraintReferencingTypeParameterFromSameTypeParameterList.errors.txt index 09a54bb89e9..15293f3953a 100644 --- a/tests/baselines/reference/constraintReferencingTypeParameterFromSameTypeParameterList.errors.txt +++ b/tests/baselines/reference/constraintReferencingTypeParameterFromSameTypeParameterList.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/constraintReferencingTypeParameterFromSameTypeParameterList.ts(5,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/constraintReferencingTypeParameterFromSameTypeParameterList.ts(8,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/constraintReferencingTypeParameterFromSameTypeParameterList.ts(10,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/constraintReferencingTypeParameterFromSameTypeParameterList.ts(13,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/constraintReferencingTypeParameterFromSameTypeParameterList.ts(21,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/constraintReferencingTypeParameterFromSameTypeParameterList.ts(21,28): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/constraintReferencingTypeParameterFromSameTypeParameterList.ts (6 errors) ==== // used to be valid, now an error to do this @@ -5,21 +13,21 @@ } function f>() { ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } interface I1> { // Error, any does not satisfy the constraint I1 ~~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } interface I2 { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } interface I4 T> { ~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } // No error @@ -29,9 +37,9 @@ function foo(v: V) => void>() { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } \ No newline at end of file diff --git a/tests/baselines/reference/constraintSatisfactionWithAny2.errors.txt b/tests/baselines/reference/constraintSatisfactionWithAny2.errors.txt index c3f3b04a441..b297d2be970 100644 --- a/tests/baselines/reference/constraintSatisfactionWithAny2.errors.txt +++ b/tests/baselines/reference/constraintSatisfactionWithAny2.errors.txt @@ -1,10 +1,13 @@ +tests/cases/conformance/types/typeParameters/typeArgumentLists/constraintSatisfactionWithAny2.ts(4,25): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/types/typeParameters/typeArgumentLists/constraintSatisfactionWithAny2.ts (1 errors) ==== // errors expected for type parameter cannot be referenced in the constraints of the same list // any is not a valid type argument unless there is no constraint, or the constraint is any declare function foo(x: U) => Z>(y: T): Z; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var a: any; foo(a); diff --git a/tests/baselines/reference/constraints0.errors.txt b/tests/baselines/reference/constraints0.errors.txt index 1ace0a1b18f..ac16118149b 100644 --- a/tests/baselines/reference/constraints0.errors.txt +++ b/tests/baselines/reference/constraints0.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/constraints0.ts(14,9): error TS2343: Type 'B' does not satisfy the constraint 'A': + Property 'a' is missing in type 'B'. + + ==== tests/cases/compiler/constraints0.ts (1 errors) ==== interface A { a: number; @@ -14,7 +18,7 @@ var v1: C
; // should work var v2: C; // should not work ~~~~ -!!! Type 'B' does not satisfy the constraint 'A': -!!! Property 'a' is missing in type 'B'. +!!! error TS2343: Type 'B' does not satisfy the constraint 'A': +!!! error TS2343: Property 'a' is missing in type 'B'. var y = v1.x.a; // 'a' should be of type 'number' \ No newline at end of file diff --git a/tests/baselines/reference/constraintsThatReferenceOtherContstraints1.errors.txt b/tests/baselines/reference/constraintsThatReferenceOtherContstraints1.errors.txt index 13b6be52ae2..b7375989e6b 100644 --- a/tests/baselines/reference/constraintsThatReferenceOtherContstraints1.errors.txt +++ b/tests/baselines/reference/constraintsThatReferenceOtherContstraints1.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/constraintsThatReferenceOtherContstraints1.ts(3,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/constraintsThatReferenceOtherContstraints1.ts(4,29): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/constraintsThatReferenceOtherContstraints1.ts (2 errors) ==== interface Object { } class Foo { } ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. class Bar { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. data: Foo; // Error 1 Type 'Object' does not satisfy the constraint 'T' for type parameter 'U extends T'. } diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt index e33107575e4..373bd49f92d 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance.ts(61,15): error TS2429: Interface 'I2' incorrectly extends interface 'Base2': + Types of property 'a' are incompatible: + Type 'new (x: number) => string' is not assignable to type 'new (x: number) => number': + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance.ts (1 errors) ==== // Checking basic subtype relations with construct signatures @@ -61,10 +67,10 @@ // S's interface I2 extends Base2 { ~~ -!!! Interface 'I2' incorrectly extends interface 'Base2': -!!! Types of property 'a' are incompatible: -!!! Type 'new (x: number) => string' is not assignable to type 'new (x: number) => number': -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2429: Interface 'I2' incorrectly extends interface 'Base2': +!!! error TS2429: Types of property 'a' are incompatible: +!!! error TS2429: Type 'new (x: number) => string' is not assignable to type 'new (x: number) => number': +!!! error TS2429: Type 'string' is not assignable to type 'number'. // N's a: new (x: number) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt index 2d267d5a260..4a2425cf3ac 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt @@ -1,3 +1,19 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(41,19): error TS2429: Interface 'I2' incorrectly extends interface 'A': + Types of property 'a2' are incompatible: + Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]': + Types of parameters 'x' and 'x' are incompatible: + Type 'T' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(50,19): error TS2429: Interface 'I4' incorrectly extends interface 'A': + Types of property 'a8' are incompatible: + Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': + Types of parameters 'y' and 'y' are incompatible: + Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': + Types of parameters 'arg2' and 'arg2' are incompatible: + Type '{ foo: number; }' is not assignable to type 'Base': + Types of property 'foo' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts (2 errors) ==== // checking subtype relations for function types as it relates to contextual signature instantiation // error cases @@ -41,11 +57,11 @@ interface I2 extends A { ~~ -!!! Interface 'I2' incorrectly extends interface 'A': -!!! Types of property 'a2' are incompatible: -!!! Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'T' is not assignable to type 'number'. +!!! error TS2429: Interface 'I2' incorrectly extends interface 'A': +!!! error TS2429: Types of property 'a2' are incompatible: +!!! error TS2429: Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]': +!!! error TS2429: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2429: Type 'T' is not assignable to type 'number'. a2: new (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic } @@ -56,15 +72,15 @@ interface I4 extends A { ~~ -!!! Interface 'I4' incorrectly extends interface 'A': -!!! Types of property 'a8' are incompatible: -!!! Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': -!!! Types of parameters 'arg2' and 'arg2' are incompatible: -!!! Type '{ foo: number; }' is not assignable to type 'Base': -!!! Types of property 'foo' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2429: Interface 'I4' incorrectly extends interface 'A': +!!! error TS2429: Types of property 'a8' are incompatible: +!!! error TS2429: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived': +!!! error TS2429: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2429: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived': +!!! error TS2429: Types of parameters 'arg2' and 'arg2' are incompatible: +!!! error TS2429: Type '{ foo: number; }' is not assignable to type 'Base': +!!! error TS2429: Types of property 'foo' are incompatible: +!!! error TS2429: Type 'number' is not assignable to type 'string'. a8: new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U; // error, type mismatch } diff --git a/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters.errors.txt b/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters.errors.txt index 970bafa4927..d07dcad58c3 100644 --- a/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters.errors.txt +++ b/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters.ts(16,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters.ts(20,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters.ts(24,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters.ts(28,10): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters.ts (4 errors) ==== // Parameter properties are only valid in constructor definitions, not even in other forms of construct signatures @@ -16,23 +22,23 @@ interface I { new (public x); ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } interface I2 { new (private x); ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } var a: { new (public x); ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } var b: { new (private x); ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt b/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt index 5d208c89133..e12f3a59ca1 100644 --- a/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt +++ b/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt @@ -1,67 +1,93 @@ -==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts (15 errors) ==== +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(4,17): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(4,24): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(4,27): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(4,35): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(5,24): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(5,35): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(9,17): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(9,25): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(10,24): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(14,17): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(19,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(20,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(24,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(25,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(29,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(30,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(34,10): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(35,10): error TS2369: A parameter property is only allowed in a constructor implementation. + + +==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts (18 errors) ==== // Parameter properties are not valid in overloads of constructors class C { constructor(public x, private y); ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~ +!!! error TS2300: Duplicate identifier 'x'. ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~ +!!! error TS2300: Duplicate identifier 'y'. constructor(public x, private y) { } ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. ~ -!!! Duplicate identifier 'y'. +!!! error TS2300: Duplicate identifier 'y'. } class C2 { constructor(private x); ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~ +!!! error TS2300: Duplicate identifier 'x'. constructor(public x) { } ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } class C3 { constructor(private x); ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. constructor(private y) { } } interface I { new (public x); ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. new (public x); ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } interface I2 { new (private x); ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. new (private x); ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } var a: { new (public x); ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. new (public y); ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } var b: { new (private x); ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. new (private y); ~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt b/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt index 2d08a7ae1c6..ceb828dd061 100644 --- a/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt +++ b/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(32,11): error TS2428: All declarations of an interface must have identical type parameters. + + ==== tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts (1 errors) ==== // No errors expected for basic overloads of construct signatures with merged declarations @@ -32,7 +35,7 @@ interface I { ~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. new (x: T, y?: number): C2; new (x: T, y: number): C2; } diff --git a/tests/baselines/reference/constructorArgsErrors1.errors.txt b/tests/baselines/reference/constructorArgsErrors1.errors.txt index 2b7754f8600..639a1a8d18a 100644 --- a/tests/baselines/reference/constructorArgsErrors1.errors.txt +++ b/tests/baselines/reference/constructorArgsErrors1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/constructorArgsErrors1.ts(2,18): error TS1090: 'static' modifier cannot appear on a parameter. + + ==== tests/cases/compiler/constructorArgsErrors1.ts (1 errors) ==== class foo { constructor (static a: number) { ~~~~~~ -!!! 'static' modifier cannot appear on a parameter. +!!! error TS1090: 'static' modifier cannot appear on a parameter. } } \ No newline at end of file diff --git a/tests/baselines/reference/constructorArgsErrors2.errors.txt b/tests/baselines/reference/constructorArgsErrors2.errors.txt index 75af2005138..dc60f1803bf 100644 --- a/tests/baselines/reference/constructorArgsErrors2.errors.txt +++ b/tests/baselines/reference/constructorArgsErrors2.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/constructorArgsErrors2.ts(2,25): error TS1090: 'static' modifier cannot appear on a parameter. + + ==== tests/cases/compiler/constructorArgsErrors2.ts (1 errors) ==== class foo { constructor (public static a: number) { ~~~~~~ -!!! 'static' modifier cannot appear on a parameter. +!!! error TS1090: 'static' modifier cannot appear on a parameter. } } \ No newline at end of file diff --git a/tests/baselines/reference/constructorArgsErrors3.errors.txt b/tests/baselines/reference/constructorArgsErrors3.errors.txt index b01950da279..1eb4de31f6b 100644 --- a/tests/baselines/reference/constructorArgsErrors3.errors.txt +++ b/tests/baselines/reference/constructorArgsErrors3.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/constructorArgsErrors3.ts(2,25): error TS1028: Accessibility modifier already seen. + + ==== tests/cases/compiler/constructorArgsErrors3.ts (1 errors) ==== class foo { constructor (public public a: number) { ~~~~~~ -!!! Accessibility modifier already seen. +!!! error TS1028: Accessibility modifier already seen. } } \ No newline at end of file diff --git a/tests/baselines/reference/constructorArgsErrors4.errors.txt b/tests/baselines/reference/constructorArgsErrors4.errors.txt index 431844358ee..44ca10ebff5 100644 --- a/tests/baselines/reference/constructorArgsErrors4.errors.txt +++ b/tests/baselines/reference/constructorArgsErrors4.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/constructorArgsErrors4.ts(2,26): error TS1028: Accessibility modifier already seen. + + ==== tests/cases/compiler/constructorArgsErrors4.ts (1 errors) ==== class foo { constructor (private public a: number) { ~~~~~~ -!!! Accessibility modifier already seen. +!!! error TS1028: Accessibility modifier already seen. } } \ No newline at end of file diff --git a/tests/baselines/reference/constructorArgsErrors5.errors.txt b/tests/baselines/reference/constructorArgsErrors5.errors.txt index 176a2b7db06..04a4ea7fade 100644 --- a/tests/baselines/reference/constructorArgsErrors5.errors.txt +++ b/tests/baselines/reference/constructorArgsErrors5.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/constructorArgsErrors5.ts(2,18): error TS1090: 'export' modifier cannot appear on a parameter. + + ==== tests/cases/compiler/constructorArgsErrors5.ts (1 errors) ==== class foo { constructor (export a: number) { ~~~~~~ -!!! 'export' modifier cannot appear on a parameter. +!!! error TS1090: 'export' modifier cannot appear on a parameter. } } \ No newline at end of file diff --git a/tests/baselines/reference/constructorAsType.errors.txt b/tests/baselines/reference/constructorAsType.errors.txt index 1824ae98c82..ca17d41623d 100644 --- a/tests/baselines/reference/constructorAsType.errors.txt +++ b/tests/baselines/reference/constructorAsType.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/constructorAsType.ts(1,5): error TS2323: Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'. + + ==== tests/cases/compiler/constructorAsType.ts (1 errors) ==== var Person:new () => {name: string;} = function () {return {name:"joe"};}; ~~~~~~ -!!! Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'. +!!! error TS2323: Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'. var Person2:{new() : {name:string;};}; diff --git a/tests/baselines/reference/constructorDefaultValuesReferencingThis.errors.txt b/tests/baselines/reference/constructorDefaultValuesReferencingThis.errors.txt index 07bd240bfab..b7b2ac330ca 100644 --- a/tests/baselines/reference/constructorDefaultValuesReferencingThis.errors.txt +++ b/tests/baselines/reference/constructorDefaultValuesReferencingThis.errors.txt @@ -1,18 +1,23 @@ +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorDefaultValuesReferencingThis.ts(2,21): error TS2333: 'this' cannot be referenced in constructor arguments. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorDefaultValuesReferencingThis.ts(6,21): error TS2333: 'this' cannot be referenced in constructor arguments. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorDefaultValuesReferencingThis.ts(10,28): error TS2333: 'this' cannot be referenced in constructor arguments. + + ==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorDefaultValuesReferencingThis.ts (3 errors) ==== class C { constructor(x = this) { } ~~~~ -!!! 'this' cannot be referenced in constructor arguments. +!!! error TS2333: 'this' cannot be referenced in constructor arguments. } class D { constructor(x = this) { } ~~~~ -!!! 'this' cannot be referenced in constructor arguments. +!!! error TS2333: 'this' cannot be referenced in constructor arguments. } class E { constructor(public x = this) { } ~~~~ -!!! 'this' cannot be referenced in constructor arguments. +!!! error TS2333: 'this' cannot be referenced in constructor arguments. } \ No newline at end of file diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt index 9e25a43bec6..c241aa8096d 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt @@ -1,9 +1,15 @@ +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2323: Type 'number' is not assignable to type 'T'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,27): error TS2323: Type 'T' is not assignable to type 'U'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(17,17): error TS2323: Type 'Date' is not assignable to type 'T'. + + ==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts (4 errors) ==== class C { constructor(x); constructor(public x: string = 1) { // error ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. var y = x; } } @@ -12,9 +18,9 @@ constructor(x: T, y: U); constructor(x: T = 1, public y: U = x) { // error ~~~~~~~~ -!!! Type 'number' is not assignable to type 'T'. +!!! error TS2323: Type 'number' is not assignable to type 'T'. ~~~~~~~~~~~~~~~ -!!! Type 'T' is not assignable to type 'U'. +!!! error TS2323: Type 'T' is not assignable to type 'U'. var z = x; } } @@ -23,7 +29,7 @@ constructor(x); constructor(x: T = new Date()) { // error ~~~~~~~~~~~~~~~~~ -!!! Type 'Date' is not assignable to type 'T'. +!!! error TS2323: Type 'Date' is not assignable to type 'T'. var y = x; } } \ No newline at end of file diff --git a/tests/baselines/reference/constructorInvocationWithTooFewTypeArgs.errors.txt b/tests/baselines/reference/constructorInvocationWithTooFewTypeArgs.errors.txt index c2021bb97f1..8a15123dfc8 100644 --- a/tests/baselines/reference/constructorInvocationWithTooFewTypeArgs.errors.txt +++ b/tests/baselines/reference/constructorInvocationWithTooFewTypeArgs.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/constructorInvocationWithTooFewTypeArgs.ts(9,9): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/constructorInvocationWithTooFewTypeArgs.ts (1 errors) ==== class D { @@ -9,5 +12,5 @@ var d = new D(); ~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/constructorOverloads1.errors.txt b/tests/baselines/reference/constructorOverloads1.errors.txt index c11e69d12bb..2e8c79d159a 100644 --- a/tests/baselines/reference/constructorOverloads1.errors.txt +++ b/tests/baselines/reference/constructorOverloads1.errors.txt @@ -1,17 +1,33 @@ -==== tests/cases/compiler/constructorOverloads1.ts (3 errors) ==== +tests/cases/compiler/constructorOverloads1.ts(2,5): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/constructorOverloads1.ts(3,5): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/constructorOverloads1.ts(4,5): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/constructorOverloads1.ts(7,5): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/constructorOverloads1.ts(16,18): error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'number'. +tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2345: Argument of type 'any[]' is not assignable to parameter of type 'number'. + + +==== tests/cases/compiler/constructorOverloads1.ts (6 errors) ==== class Foo { constructor(s: string); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2392: Multiple constructor implementations are not allowed. constructor(n: number); - constructor(x: any) { - - } + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2392: Multiple constructor implementations are not allowed. constructor(x: any) { ~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! Multiple constructor implementations are not allowed. +!!! error TS2392: Multiple constructor implementations are not allowed. + constructor(x: any) { + ~~~~~~~~~~~~~~~~~~~~~ + + + } + ~~~~~ +!!! error TS2392: Multiple constructor implementations are not allowed. bar1() { /*WScript.Echo("bar1");*/ } bar2() { /*WScript.Echo("bar1");*/ } } @@ -20,10 +36,10 @@ var f2 = new Foo(0); var f3 = new Foo(f1); ~~ -!!! Argument of type 'Foo' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'number'. var f4 = new Foo([f1,f2,f3]); ~~~~~~~~~~ -!!! Argument of type 'unknown[]' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'any[]' is not assignable to parameter of type 'number'. f1.bar1(); f1.bar2(); diff --git a/tests/baselines/reference/constructorOverloads3.errors.txt b/tests/baselines/reference/constructorOverloads3.errors.txt index 0e106af99dc..4662a277f52 100644 --- a/tests/baselines/reference/constructorOverloads3.errors.txt +++ b/tests/baselines/reference/constructorOverloads3.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/constructorOverloads3.ts(12,5): error TS2377: Constructors for derived classes must contain a 'super' call. + + ==== tests/cases/compiler/constructorOverloads3.ts (1 errors) ==== declare class FooBase { constructor(s: string); @@ -12,7 +15,7 @@ constructor(a: any); constructor(x: any, y?: any) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Constructors for derived classes must contain a 'super' call. +!!! error TS2377: Constructors for derived classes must contain a 'super' call. bar1() { /*WScript.Echo("Yo");*/} } diff --git a/tests/baselines/reference/constructorOverloads4.errors.txt b/tests/baselines/reference/constructorOverloads4.errors.txt index 5f46390fae1..d2cc5ecd65b 100644 --- a/tests/baselines/reference/constructorOverloads4.errors.txt +++ b/tests/baselines/reference/constructorOverloads4.errors.txt @@ -1,21 +1,30 @@ -==== tests/cases/compiler/constructorOverloads4.ts (4 errors) ==== +tests/cases/compiler/constructorOverloads4.ts(2,18): error TS2300: Duplicate identifier 'Function'. +tests/cases/compiler/constructorOverloads4.ts(5,21): error TS2300: Duplicate identifier 'Function'. +tests/cases/compiler/constructorOverloads4.ts(6,21): error TS2300: Duplicate identifier 'Function'. +tests/cases/compiler/constructorOverloads4.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/constructorOverloads4.ts(11,1): error TS2348: Value of type 'typeof Function' is not callable. Did you mean to include 'new'? + + +==== tests/cases/compiler/constructorOverloads4.ts (5 errors) ==== declare module M { export class Function { + ~~~~~~~~ +!!! error TS2300: Duplicate identifier 'Function'. constructor(...args: string[]); } export function Function(...args: any[]): any; ~~~~~~~~ -!!! Duplicate identifier 'Function'. +!!! error TS2300: Duplicate identifier 'Function'. export function Function(...args: string[]): Function; ~~~~~~~~ -!!! Duplicate identifier 'Function'. +!!! error TS2300: Duplicate identifier 'Function'. } (new M.Function("return 5"))(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. M.Function("yo"); ~~~~~~~~~~~~~~~~ -!!! Value of type 'typeof Function' is not callable. Did you mean to include 'new'? +!!! error TS2348: Value of type 'typeof Function' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/constructorOverloads5.errors.txt b/tests/baselines/reference/constructorOverloads5.errors.txt index 706d9854e14..0a695fc001c 100644 --- a/tests/baselines/reference/constructorOverloads5.errors.txt +++ b/tests/baselines/reference/constructorOverloads5.errors.txt @@ -1,12 +1,21 @@ -==== tests/cases/compiler/constructorOverloads5.ts (1 errors) ==== +tests/cases/compiler/constructorOverloads5.ts(4,21): error TS2300: Duplicate identifier 'RegExp'. +tests/cases/compiler/constructorOverloads5.ts(5,21): error TS2300: Duplicate identifier 'RegExp'. +tests/cases/compiler/constructorOverloads5.ts(6,18): error TS2300: Duplicate identifier 'RegExp'. + + +==== tests/cases/compiler/constructorOverloads5.ts (3 errors) ==== interface IArguments {} declare module M { export function RegExp(pattern: string): RegExp; + ~~~~~~ +!!! error TS2300: Duplicate identifier 'RegExp'. export function RegExp(pattern: string, flags: string): RegExp; + ~~~~~~ +!!! error TS2300: Duplicate identifier 'RegExp'. export class RegExp { ~~~~~~ -!!! Duplicate identifier 'RegExp'. +!!! error TS2300: Duplicate identifier 'RegExp'. constructor(pattern: string); constructor(pattern: string, flags: string); exec(string: string): string[]; diff --git a/tests/baselines/reference/constructorOverloads6.errors.txt b/tests/baselines/reference/constructorOverloads6.errors.txt index 42256f68f8d..d5cf2486fe1 100644 --- a/tests/baselines/reference/constructorOverloads6.errors.txt +++ b/tests/baselines/reference/constructorOverloads6.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/constructorOverloads6.ts(4,25): error TS1111: A constructor implementation cannot be declared in an ambient context. + + ==== tests/cases/compiler/constructorOverloads6.ts (1 errors) ==== declare class FooBase { constructor(s: string); constructor(n: number); constructor(x: any) { ~ -!!! A constructor implementation cannot be declared in an ambient context. +!!! error TS1111: A constructor implementation cannot be declared in an ambient context. } bar1():void; diff --git a/tests/baselines/reference/constructorOverloads7.errors.txt b/tests/baselines/reference/constructorOverloads7.errors.txt index dab93a3cc27..e3409dbb399 100644 --- a/tests/baselines/reference/constructorOverloads7.errors.txt +++ b/tests/baselines/reference/constructorOverloads7.errors.txt @@ -1,5 +1,12 @@ -==== tests/cases/compiler/constructorOverloads7.ts (2 errors) ==== +tests/cases/compiler/constructorOverloads7.ts(1,15): error TS2300: Duplicate identifier 'Point'. +tests/cases/compiler/constructorOverloads7.ts(15,10): error TS2300: Duplicate identifier 'Point'. +tests/cases/compiler/constructorOverloads7.ts(22,18): error TS2384: Overload signatures must all be ambient or non-ambient. + + +==== tests/cases/compiler/constructorOverloads7.ts (3 errors) ==== declare class Point + ~~~~~ +!!! error TS2300: Duplicate identifier 'Point'. { x: number; y: number; @@ -15,7 +22,7 @@ // to be Point and return type is inferred to be void function Point(x, y) { ~~~~~ -!!! Duplicate identifier 'Point'. +!!! error TS2300: Duplicate identifier 'Point'. this.x = x; this.y = y; @@ -24,7 +31,7 @@ declare function EF1(a:number, b:number):number; ~~~ -!!! Overload signatures must all be ambient or non-ambient. +!!! error TS2384: Overload signatures must all be ambient or non-ambient. function EF1(a,b) { return a+b; } \ No newline at end of file diff --git a/tests/baselines/reference/constructorOverloads8.errors.txt b/tests/baselines/reference/constructorOverloads8.errors.txt index 15f43a432f8..ca79964ad3f 100644 --- a/tests/baselines/reference/constructorOverloads8.errors.txt +++ b/tests/baselines/reference/constructorOverloads8.errors.txt @@ -1,9 +1,15 @@ -==== tests/cases/compiler/constructorOverloads8.ts (1 errors) ==== +tests/cases/compiler/constructorOverloads8.ts(2,5): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/constructorOverloads8.ts(3,5): error TS2392: Multiple constructor implementations are not allowed. + + +==== tests/cases/compiler/constructorOverloads8.ts (2 errors) ==== class C { constructor(x) { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS2392: Multiple constructor implementations are not allowed. constructor(y, x) { } // illegal, 2 constructor implementations ~~~~~~~~~~~~~~~~~~~~~ -!!! Multiple constructor implementations are not allowed. +!!! error TS2392: Multiple constructor implementations are not allowed. } class D { diff --git a/tests/baselines/reference/constructorOverloadsWithDefaultValues.errors.txt b/tests/baselines/reference/constructorOverloadsWithDefaultValues.errors.txt index f594e176269..8bb052da947 100644 --- a/tests/baselines/reference/constructorOverloadsWithDefaultValues.errors.txt +++ b/tests/baselines/reference/constructorOverloadsWithDefaultValues.errors.txt @@ -1,9 +1,13 @@ +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorOverloadsWithDefaultValues.ts(3,17): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorOverloadsWithDefaultValues.ts(10,17): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + + ==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorOverloadsWithDefaultValues.ts (2 errors) ==== class C { foo: string; constructor(x = 1); // error ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. constructor() { } } @@ -12,7 +16,7 @@ foo: string; constructor(x = 1); // error ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. constructor() { } } \ No newline at end of file diff --git a/tests/baselines/reference/constructorParameterProperties.errors.txt b/tests/baselines/reference/constructorParameterProperties.errors.txt index b92f2fd9a8c..ab9bebe9d2d 100644 --- a/tests/baselines/reference/constructorParameterProperties.errors.txt +++ b/tests/baselines/reference/constructorParameterProperties.errors.txt @@ -1,25 +1,39 @@ -==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts (3 errors) ==== +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(8,10): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(9,10): error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(18,10): error TS2341: Property 'x' is private and only accessible within class 'D'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(19,12): error TS2339: Property 'a' does not exist on type 'D'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(20,10): error TS2445: Property 'z' is protected and only accessible within class 'D' and its subclasses. + + +==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts (5 errors) ==== class C { y: string; - constructor(private x: string) { } + constructor(private x: string, protected z: string) { } } var c: C; var r = c.y; var r2 = c.x; // error ~~~ -!!! Property 'C.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. + var r3 = c.z; // error + ~~~ +!!! error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. class D { y: T; - constructor(a: T, private x: T) { } + constructor(a: T, private x: T, protected z: T) { } } var d: D; var r = d.y; var r2 = d.x; // error ~~~ -!!! Property 'D.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'D'. var r3 = d.a; // error ~ -!!! Property 'a' does not exist on type 'D'. \ No newline at end of file +!!! error TS2339: Property 'a' does not exist on type 'D'. + var r4 = d.z; // error + ~~~ +!!! error TS2445: Property 'z' is protected and only accessible within class 'D' and its subclasses. + \ No newline at end of file diff --git a/tests/baselines/reference/constructorParameterProperties.js b/tests/baselines/reference/constructorParameterProperties.js index 37ba30d24b0..11446a316d3 100644 --- a/tests/baselines/reference/constructorParameterProperties.js +++ b/tests/baselines/reference/constructorParameterProperties.js @@ -1,36 +1,42 @@ //// [constructorParameterProperties.ts] class C { y: string; - constructor(private x: string) { } + constructor(private x: string, protected z: string) { } } var c: C; var r = c.y; var r2 = c.x; // error +var r3 = c.z; // error class D { y: T; - constructor(a: T, private x: T) { } + constructor(a: T, private x: T, protected z: T) { } } var d: D; var r = d.y; var r2 = d.x; // error -var r3 = d.a; // error +var r3 = d.a; // error +var r4 = d.z; // error + //// [constructorParameterProperties.js] var C = (function () { - function C(x) { + function C(x, z) { this.x = x; + this.z = z; } return C; })(); var c; var r = c.y; var r2 = c.x; // error +var r3 = c.z; // error var D = (function () { - function D(a, x) { + function D(a, x, z) { this.x = x; + this.z = z; } return D; })(); @@ -38,3 +44,4 @@ var d; var r = d.y; var r2 = d.x; // error var r3 = d.a; // error +var r4 = d.z; // error diff --git a/tests/baselines/reference/constructorParameterProperties2.errors.txt b/tests/baselines/reference/constructorParameterProperties2.errors.txt index b8b04833db8..42df015bc5b 100644 --- a/tests/baselines/reference/constructorParameterProperties2.errors.txt +++ b/tests/baselines/reference/constructorParameterProperties2.errors.txt @@ -1,4 +1,12 @@ -==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts (2 errors) ==== +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(10,5): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(11,24): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(18,5): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(19,25): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(26,5): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(27,27): error TS2300: Duplicate identifier 'y'. + + +==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts (6 errors) ==== class C { y: number; constructor(y: number) { } // ok @@ -9,9 +17,11 @@ class D { y: number; + ~ +!!! error TS2300: Duplicate identifier 'y'. constructor(public y: number) { } // error ~ -!!! Duplicate identifier 'y'. +!!! error TS2300: Duplicate identifier 'y'. } var d: D; @@ -19,10 +29,25 @@ class E { y: number; + ~ +!!! error TS2300: Duplicate identifier 'y'. constructor(private y: number) { } // error ~ -!!! Duplicate identifier 'y'. +!!! error TS2300: Duplicate identifier 'y'. } var e: E; - var r3 = e.y; // error \ No newline at end of file + var r3 = e.y; // error + + class F { + y: number; + ~ +!!! error TS2300: Duplicate identifier 'y'. + constructor(protected y: number) { } // error + ~ +!!! error TS2300: Duplicate identifier 'y'. + } + + var f: F; + var r4 = f.y; // error + \ No newline at end of file diff --git a/tests/baselines/reference/constructorParameterProperties2.js b/tests/baselines/reference/constructorParameterProperties2.js index 8ad0c8b6ea6..02e4cf82c84 100644 --- a/tests/baselines/reference/constructorParameterProperties2.js +++ b/tests/baselines/reference/constructorParameterProperties2.js @@ -21,7 +21,16 @@ class E { } var e: E; -var r3 = e.y; // error +var r3 = e.y; // error + +class F { + y: number; + constructor(protected y: number) { } // error +} + +var f: F; +var r4 = f.y; // error + //// [constructorParameterProperties2.js] var C = (function () { @@ -47,3 +56,11 @@ var E = (function () { })(); var e; var r3 = e.y; // error +var F = (function () { + function F(y) { + this.y = y; + } // error + return F; +})(); +var f; +var r4 = f.y; // error diff --git a/tests/baselines/reference/constructorParameterShadowsOuterScopes.errors.txt b/tests/baselines/reference/constructorParameterShadowsOuterScopes.errors.txt index f784cd0b8bb..8bb04c59554 100644 --- a/tests/baselines/reference/constructorParameterShadowsOuterScopes.errors.txt +++ b/tests/baselines/reference/constructorParameterShadowsOuterScopes.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(8,9): error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'x' declared in the constructor. +tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(10,9): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(16,9): error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'y' declared in the constructor. + + ==== tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts (3 errors) ==== // Initializer expressions for instance member variables are evaluated in the scope of the class constructor // body but are not permitted to reference parameters or local variables of the constructor. @@ -8,11 +13,11 @@ class C { b = x; // error, evaluated in scope of constructor, cannot reference x ~ -!!! Initializer of instance member variable 'b' cannot reference identifier 'x' declared in the constructor. +!!! error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'x' declared in the constructor. constructor(x: string) { x = 2; // error, x is string ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. } } @@ -20,7 +25,7 @@ class D { b = y; // error, evaluated in scope of constructor, cannot reference y ~ -!!! Initializer of instance member variable 'b' cannot reference identifier 'y' declared in the constructor. +!!! error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'y' declared in the constructor. constructor(x: string) { var y = ""; } diff --git a/tests/baselines/reference/constructorParametersInVariableDeclarations.errors.txt b/tests/baselines/reference/constructorParametersInVariableDeclarations.errors.txt index 4afccf82d93..3220a4cd87c 100644 --- a/tests/baselines/reference/constructorParametersInVariableDeclarations.errors.txt +++ b/tests/baselines/reference/constructorParametersInVariableDeclarations.errors.txt @@ -1,14 +1,22 @@ +tests/cases/compiler/constructorParametersInVariableDeclarations.ts(2,17): error TS2304: Cannot find name 'x'. +tests/cases/compiler/constructorParametersInVariableDeclarations.ts(3,22): error TS2304: Cannot find name 'x'. +tests/cases/compiler/constructorParametersInVariableDeclarations.ts(4,23): error TS2304: Cannot find name 'x'. +tests/cases/compiler/constructorParametersInVariableDeclarations.ts(10,17): error TS2304: Cannot find name 'x'. +tests/cases/compiler/constructorParametersInVariableDeclarations.ts(11,22): error TS2304: Cannot find name 'x'. +tests/cases/compiler/constructorParametersInVariableDeclarations.ts(12,23): error TS2304: Cannot find name 'x'. + + ==== tests/cases/compiler/constructorParametersInVariableDeclarations.ts (6 errors) ==== class A { private a = x; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. private b = { p: x }; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. private c = () => x; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. constructor(x: number) { } } @@ -16,13 +24,13 @@ class B { private a = x; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. private b = { p: x }; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. private c = () => x; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. constructor() { var x = 1; } diff --git a/tests/baselines/reference/constructorParametersThatShadowExternalNamesInVariableDeclarations.errors.txt b/tests/baselines/reference/constructorParametersThatShadowExternalNamesInVariableDeclarations.errors.txt index 92619b68154..35e281c2fb6 100644 --- a/tests/baselines/reference/constructorParametersThatShadowExternalNamesInVariableDeclarations.errors.txt +++ b/tests/baselines/reference/constructorParametersThatShadowExternalNamesInVariableDeclarations.errors.txt @@ -1,9 +1,13 @@ +tests/cases/compiler/constructorParametersThatShadowExternalNamesInVariableDeclarations.ts(3,17): error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor. +tests/cases/compiler/constructorParametersThatShadowExternalNamesInVariableDeclarations.ts(9,17): error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor. + + ==== tests/cases/compiler/constructorParametersThatShadowExternalNamesInVariableDeclarations.ts (2 errors) ==== var x = 1; class A { private a = x; ~ -!!! Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor. +!!! error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor. constructor(x: number) { } } @@ -11,7 +15,7 @@ class B { private a = x; ~ -!!! Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor. +!!! error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor. constructor() { var x = ""; } diff --git a/tests/baselines/reference/constructorReturnsInvalidType.errors.txt b/tests/baselines/reference/constructorReturnsInvalidType.errors.txt index fb2ac126a91..2ebd59b3d93 100644 --- a/tests/baselines/reference/constructorReturnsInvalidType.errors.txt +++ b/tests/baselines/reference/constructorReturnsInvalidType.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/constructorReturnsInvalidType.ts(3,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class + + ==== tests/cases/compiler/constructorReturnsInvalidType.ts (1 errors) ==== class X { constructor() { return 1; ~ -!!! Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } foo() { } } diff --git a/tests/baselines/reference/constructorStaticParamNameErrors.errors.txt b/tests/baselines/reference/constructorStaticParamNameErrors.errors.txt index 494c28e89e9..4739f54397c 100644 --- a/tests/baselines/reference/constructorStaticParamNameErrors.errors.txt +++ b/tests/baselines/reference/constructorStaticParamNameErrors.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/constructorStaticParamNameErrors.ts(4,18): error TS1003: Identifier expected. + + ==== tests/cases/compiler/constructorStaticParamNameErrors.ts (1 errors) ==== 'use strict' // static as constructor parameter name should give error if 'use strict' class test { constructor (static) { } ~~~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. } \ No newline at end of file diff --git a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt index 9fc31435515..f5ef669d31b 100644 --- a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt +++ b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class + + ==== tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts (2 errors) ==== // a class constructor may return an expression, it must be assignable to the class instance type to be valid @@ -12,7 +16,7 @@ constructor() { return 1; // error ~ -!!! Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } } @@ -28,7 +32,7 @@ constructor() { return { x: 1 }; // error ~~~~~~~~ -!!! Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt new file mode 100644 index 00000000000..0e91d11b280 --- /dev/null +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -0,0 +1,570 @@ +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,19): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,35): error TS1005: ')' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(24,28): error TS1005: ':' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(24,29): error TS1005: ',' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,18): error TS1129: Statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,30): error TS1005: ',' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,33): error TS1138: Parameter declaration expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,34): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,36): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(30,21): error TS1108: A 'return' statement can only be used within a function body. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(31,18): error TS1129: Statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(38,17): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,41): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,45): error TS1002: Unterminated string literal. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(43,21): error TS1108: A 'return' statement can only be used within a function body. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(46,13): error TS1005: 'try' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(55,13): error TS1108: A 'return' statement can only be used within a function body. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(58,5): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(69,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(72,37): error TS1127: Invalid character. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(81,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(90,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(105,29): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(106,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(138,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(141,32): error TS1005: '{' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(143,13): error TS1005: 'try' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,24): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,30): error TS1005: '(' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(205,28): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,36): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(219,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(227,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(234,14): error TS1005: '{' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,9): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,27): error TS1005: ',' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,36): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(236,13): error TS1108: A 'return' statement can only be used within a function body. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,9): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,26): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(239,13): error TS1108: A 'return' statement can only be used within a function body. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(241,5): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,67): error TS1093: Type annotation cannot appear on a constructor declaration. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,69): error TS1110: Type expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,9): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,31): error TS1005: ',' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,9): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,27): error TS1135: Argument expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS1005: '(' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,43): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,59): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,60): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,65): error TS1129: Statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,9): error TS1129: Statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,35): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,1): error TS2304: Cannot find name 'module'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,26): error TS2304: Cannot find name 'bfs'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,17): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,17): error TS2304: Cannot find name 'retValue'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,28): error TS2304: Cannot find name 'bfs'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,21): error TS2304: Cannot find name 'retValue'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,17): error TS2304: Cannot find name 'retValue'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,28): error TS2304: Cannot find name 'bfs'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,21): error TS2304: Cannot find name 'retValue'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(47,17): error TS2304: Cannot find name 'console'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(53,13): error TS2304: Cannot find name 'console'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(89,23): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,24): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,31): error TS2304: Cannot find name 'Property'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(166,13): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(180,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(213,16): error TS2304: Cannot find name 'bool'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,29): error TS2304: Cannot find name 'yield'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(223,23): error TS2304: Cannot find name 'bool'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,16): error TS2304: Cannot find name 'method1'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,24): error TS2304: Cannot find name 'val'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,28): error TS2304: Cannot find name 'number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,16): error TS2304: Cannot find name 'method2'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(246,25): error TS2339: Property 'method1' does not exist on type 'B'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,9): error TS2390: Constructor implementation is missing. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,21): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,44): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,16): error TS2304: Cannot find name 'Overloads'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,26): error TS2304: Cannot find name 'value'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,33): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2304: Cannot find name 'Overloads'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,35): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,52): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS2304: Cannot find name 'DefaultValue'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,29): error TS2304: Cannot find name 'value'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error TS2304: Cannot find name 'string'. + + +==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (95 errors) ==== + declare module "fs" { + export class File { + constructor(filename: string); + public ReadAllText(): string; + } + export interface IFile { + [index: number]: string; + } + } + + import fs = module("fs"); + ~ +!!! error TS1005: ';' expected. + ~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'module'. + + + module TypeScriptAllInOne { + export class Program { + static Main(...args: string[]) { + try { + var bfs = new BasicFeatures(); + var retValue: number = 0; + + retValue = bfs.VARIABLES(); + if (retValue != 0 ^= { + ~~ +!!! error TS1005: ')' expected. + ~ + + + return 1; + ~ +!!! error TS1005: ':' expected. + ~ +!!! error TS1005: ',' expected. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + case = bfs.STATEMENTS(4); + ~~~~ +!!! error TS1129: Statement expected. + ~~~ +!!! error TS2304: Cannot find name 'bfs'. + if (retValue != 0) { + ~~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1138: Parameter declaration expected. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + ~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + + return 1; + ~~~~~~ +!!! error TS1108: A 'return' statement can only be used within a function body. + ^ + ~ +!!! error TS1129: Statement expected. + + + retValue = bfs.TYPES(); + ~~~~~~~~ +!!! error TS2304: Cannot find name 'retValue'. + ~~~ +!!! error TS2304: Cannot find name 'bfs'. + if (retValue != 0) { + ~~~~~~~~ +!!! error TS2304: Cannot find name 'retValue'. + + return 1 && + } + ~ +!!! error TS1109: Expression expected. + + retValue = bfs.OPERATOR ' ); + ~~~~ +!!! error TS1005: ';' expected. + +!!! error TS1002: Unterminated string literal. + ~~~~~~~~ +!!! error TS2304: Cannot find name 'retValue'. + ~~~ +!!! error TS2304: Cannot find name 'bfs'. + if (retValue != 0) { + ~~~~~~~~ +!!! error TS2304: Cannot find name 'retValue'. + + return 1; + ~~~~~~ +!!! error TS1108: A 'return' statement can only be used within a function body. + } + } + catch (e) { + ~~~~~ +!!! error TS1005: 'try' expected. + console.log(e); + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. + } + finally { + + } + + console.log('Done'); + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. + + return 0; + ~~~~~~ +!!! error TS1108: A 'return' statement can only be used within a function body. + + } + } + ~ +!!! error TS1128: Declaration or statement expected. + + class BasicFeatures { + /// + /// Test various of variables. Including nullable,key world as variable,special format + /// + /// + public VARIABLES(): number { + var local = Number.MAX_VALUE; + var min = Number.MIN_VALUE; + var inf = Number.NEGATIVE_INFINITY - + var nan = Number.NaN; + ~~~ +!!! error TS1109: Expression expected. + var undef = undefined; + + var _\uD4A5\u7204\uC316\uE59F = local; + +!!! error TS1127: Invalid character. + var мир = local; + + var local5 = null; + var local6 = local5 instanceof fs.File; + + var hex = 0xBADC0DE, Hex = 0XDEADBEEF; + var float = 6.02e23, float2 = 6.02E-23 + var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != + var quoted = '"', quoted2 = "'"; + ~~~ +!!! error TS1109: Expression expected. + var reg = /\w*/; + var objLit = { "var": number = 42, equals: function (x) { return x["var"] === 42; }, instanceof : () => 'objLit{42}' }; + var weekday = Weekdays.Monday; + + var con = char + f + hexchar + float.toString() + float2.toString() + reg.toString() + objLit + weekday; + + // + var any = 0 ^= + ~ +!!! error TS2364: Invalid left-hand side of assignment expression. + var bool = 0; + ~~~ +!!! error TS1109: Expression expected. + var declare = 0; + var constructor = 0; + var get = 0; + var implements = 0; + var interface = 0; + var let = 0; + var module = 0; + var number = 0; + var package = 0; + var private = 0; + var protected = 0; + var public = 0; + var set = 0; + var static = 0; + var string = 0 /> + ~ +!!! error TS1109: Expression expected. + var yield = 0; + ~~~ +!!! error TS1109: Expression expected. + + var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. + + return 0; + } + + /// + /// Test different statements. Including if-else,swith,foreach,(un)checked,lock,using,try-catch-finally + /// + /// + /// + STATEMENTS(i: number): number { + var retVal = 0; + if (i == 1) + retVal = 1; + else + retVal = 0; + switch (i) { + case 2: + retVal = 1; + break; + case 3: + retVal = 1; + break; + default: + break; + } + + for (var x in { x: 0, y: 1 }) { + ! + + try { + ~~~ +!!! error TS1109: Expression expected. + throw null; + } + catch (Exception) ? + ~ +!!! error TS1005: '{' expected. + } + finally { + ~~~~~~~ +!!! error TS1005: 'try' expected. + try { } + catch (Exception) { } + } + + return retVal; + } + + /// + /// Test types in ts language. Including class,struct,interface,delegate,anonymous type + /// + /// + public TYPES(): number { + var retVal = 0; + var c = new CLASS(); + var xx: IF = c; + retVal += catch .Property; + ~~~~~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1005: '(' expected. + ~~~~~~~~ +!!! error TS2304: Cannot find name 'Property'. + retVal += c.Member(); + retVal += xx.Foo() ? 0 : 1; + + //anonymous type + var anony = { a: new CLASS() }; + + retVal += anony.a.d(); + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'. + + return retVal; + } + + + ///// + ///// Test different operators + ///// + ///// + public OPERATOR(): number { + var a: number[] = [1, 2, 3, 4, 5, ];/*[] bug*/ // YES [] + var i = a[1];/*[]*/ + i = i + i - i * i / i % i & i | i ^ i;/*+ - * / % & | ^*/ + var b = true && false || true ^ false;/*& | ^*/ + ~~~~~~~~~~~~ +!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. + b = !b;/*!*/ + i = ~i;/*~i*/ + b = i < (i - 1) && (i + 1) > i;/*< && >*/ + var f = true ? 1 : 0;/*? :*/ // YES : + i++;/*++*/ + i--;/*--*/ + b = true && false || true;/*&& ||*/ + i = i << 5;/*<<*/ + i = i >> 5;/*>>*/ + var j = i; + b = i == j && i != j && i <= j && i >= j;/*= == && != <= >=*/ + i += 5.0;/*+=*/ + i -= i;/*-=*/ + i *= i;/**=*/ + if (i == 0) + i++; + i /= i;/*/=*/ + i %= i;/*%=*/ + i &= i;/*&=*/ + i |= i;/*|=*/ + i ^= i;/*^=*/ + i <<= i;/*<<=*/ + i >>= i;/*>>=*/ + + if (i == 0 && != b && f == 1) + ~~ +!!! error TS1109: Expression expected. + return 0; + else return 1; + } + + } + + interface IF { + Foo(): bool; + ~~~~ +!!! error TS2304: Cannot find name 'bool'. + } + + class CLASS implements IF { + + case d = () => { yield 0; }; + ~~~~ +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + ~ +!!! error TS1005: ';' expected. + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. + public get Property() { return 0; } + ~~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + public Member() { + return 0; + } + public Foo(): bool { + ~~~~ +!!! error TS2304: Cannot find name 'bool'. + var myEvent = () => { return 1; }; + if (myEvent() == 1) + return true ? + else + ~~~~ +!!! error TS1109: Expression expected. + return false; + } + } + + + // todo: use these + class A . + ~ +!!! error TS1005: '{' expected. + public method1(val:number) { + ~~~~~~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1005: ';' expected. + ~~~~~~~ +!!! error TS2304: Cannot find name 'method1'. + ~~~ +!!! error TS2304: Cannot find name 'val'. + ~~~~~~ +!!! error TS2304: Cannot find name 'number'. + return val; + ~~~~~~ +!!! error TS1108: A 'return' statement can only be used within a function body. + } + public method2() { + ~~~~~~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1005: ';' expected. + ~~~~~~~ +!!! error TS2304: Cannot find name 'method2'. + return 2 * this.method1(2); + ~~~~~~ +!!! error TS1108: A 'return' statement can only be used within a function body. + } + } + ~ +!!! error TS1128: Declaration or statement expected. + + class B extends A { + + public method2() { + return this.method1(2); + ~~~~~~~ +!!! error TS2339: Property 'method1' does not exist on type 'B'. + } + } + + class Overloading { + + private otherValue = 42; + + constructor(private value: number, public name: string) : } + +!!! error TS1093: Type annotation cannot appear on a constructor declaration. + ~ +!!! error TS1110: Type expected. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2390: Constructor implementation is missing. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + + public Overloads(value: string); + ~~~~~~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1005: ',' expected. + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Overloads'. + ~~~~~ +!!! error TS2304: Cannot find name 'value'. + ~~~~~~ +!!! error TS2304: Cannot find name 'string'. + public Overloads( while : string, ...rest: string[]) { & + ~~~~~~ +!!! error TS1128: Declaration or statement expected. + ~~~~~ +!!! error TS1135: Argument expression expected. + ~ +!!! error TS1005: '(' expected. + ~~~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1129: Statement expected. + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Overloads'. + ~~~~~~ +!!! error TS2304: Cannot find name 'string'. + ~~~~~~ +!!! error TS2304: Cannot find name 'string'. + + public DefaultValue(value?: string = "Hello") { } + ~~~~~~ +!!! error TS1129: Statement expected. + ~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1005: ';' expected. + ~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'DefaultValue'. + ~~~~~ +!!! error TS2304: Cannot find name 'value'. + ~~~~~~ +!!! error TS2304: Cannot find name 'string'. + } + } + ~ +!!! error TS1128: Declaration or statement expected. + + enum Weekdays { + Monday, + Tuesday, + Weekend, + } + + enum Fruit { + Apple, + Pear + } + + interface IDisposable { + Dispose(): void; + } + + TypeScriptAllInOne.Program.Main(); + \ No newline at end of file diff --git a/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt b/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt index d7ba7dcf92b..c4d0c7ffb66 100644 --- a/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt @@ -1,12 +1,22 @@ +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(3,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(4,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(17,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(18,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(20,5): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(28,5): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(33,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(34,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/constructorsWithSpecializedSignatures.ts (8 errors) ==== // errors declare class C { constructor(x: "hi"); ~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. constructor(x: "foo"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. constructor(x: number); } @@ -21,14 +31,14 @@ class D { constructor(x: "hi"); ~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. constructor(x: "foo"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. constructor(x: number); constructor(x: "hi") { } ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! A signature with an implementation cannot use a string literal type. +!!! error TS2381: A signature with an implementation cannot use a string literal type. } // overloads are ok @@ -38,17 +48,17 @@ constructor(x: string); constructor(x: "hi") { } // error ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! A signature with an implementation cannot use a string literal type. +!!! error TS2381: A signature with an implementation cannot use a string literal type. } // errors interface I { new (x: "hi"); ~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. new (x: "foo"); ~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. new (x: number); } diff --git a/tests/baselines/reference/contextualTypeArrayReturnType.types b/tests/baselines/reference/contextualTypeArrayReturnType.types index b0cd03f8510..ceb7aa53f67 100644 --- a/tests/baselines/reference/contextualTypeArrayReturnType.types +++ b/tests/baselines/reference/contextualTypeArrayReturnType.types @@ -26,18 +26,18 @@ interface Transform3D { var style: IBookStyle = { >style : IBookStyle >IBookStyle : IBookStyle ->{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => NamedTransform[]; } +>{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => { [x: string]: any; 'ry': any; }[]; } initialLeftPageTransforms: (width: number) => { ->initialLeftPageTransforms : (width: number) => NamedTransform[] ->(width: number) => { return [ {'ry': null } ]; } : (width: number) => NamedTransform[] +>initialLeftPageTransforms : (width: number) => { [x: string]: any; 'ry': any; }[] +>(width: number) => { return [ {'ry': null } ]; } : (width: number) => { [x: string]: any; 'ry': any; }[] >width : number return [ ->[ {'ry': null } ] : NamedTransform[] +>[ {'ry': null } ] : { [x: string]: null; 'ry': null; }[] {'ry': null } ->{'ry': null } : { [x: string]: Transform3D; 'ry': null; } +>{'ry': null } : { [x: string]: null; 'ry': null; } ]; } diff --git a/tests/baselines/reference/contextualTypeWithTuple.errors.txt b/tests/baselines/reference/contextualTypeWithTuple.errors.txt new file mode 100644 index 00000000000..bd1aa155661 --- /dev/null +++ b/tests/baselines/reference/contextualTypeWithTuple.errors.txt @@ -0,0 +1,58 @@ +tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]': + Types of property 'pop' are incompatible: + Type '() => string | number | boolean' is not assignable to type '() => string | number': + Type 'string | number | boolean' is not assignable to type 'string | number': + Type 'boolean' is not assignable to type 'string | number': + Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(8,1): error TS2323: Type '[number, string, boolean]' is not assignable to type '[number, string]'. +tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(11,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]': + Types of property '0' are incompatible: + Type '{}' is not assignable to type '{ a: string; }': + Property 'a' is missing in type '{}'. +tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(12,1): error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]': + Property '2' is missing in type '[number, string]'. +tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(13,5): error TS2322: Type '[string, string, number]' is not assignable to type '[string, string]': + Types of property 'pop' are incompatible: + Type '() => string | number' is not assignable to type '() => string': + Type 'string | number' is not assignable to type 'string': + Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts (5 errors) ==== + // no error + var numStrTuple: [number, string] = [5, "hello"]; + var numStrTuple2: [number, string] = [5, "foo", true]; + ~~~~~~~~~~~~ +!!! error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]': +!!! error TS2322: Types of property 'pop' are incompatible: +!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => string | number': +!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'string | number': +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number': +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. + var numStrBoolTuple: [number, string, boolean] = [5, "foo", true]; + var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5]; + var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]]; + numStrTuple = numStrTuple2; + numStrTuple = numStrBoolTuple; + ~~~~~~~~~~~ +!!! error TS2323: Type '[number, string, boolean]' is not assignable to type '[number, string]'. + + // error + objNumTuple = [ {}, 5]; + ~~~~~~~~~~~ +!!! error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]': +!!! error TS2322: Types of property '0' are incompatible: +!!! error TS2322: Type '{}' is not assignable to type '{ a: string; }': +!!! error TS2322: Property 'a' is missing in type '{}'. + numStrBoolTuple = numStrTuple; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]': +!!! error TS2322: Property '2' is missing in type '[number, string]'. + var strStrTuple: [string, string] = ["foo", "bar", 5]; + ~~~~~~~~~~~ +!!! error TS2322: Type '[string, string, number]' is not assignable to type '[string, string]': +!!! error TS2322: Types of property 'pop' are incompatible: +!!! error TS2322: Type '() => string | number' is not assignable to type '() => string': +!!! error TS2322: Type 'string | number' is not assignable to type 'string': +!!! error TS2322: Type 'number' is not assignable to type 'string'. + \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypeWithTuple.js b/tests/baselines/reference/contextualTypeWithTuple.js new file mode 100644 index 00000000000..61a2df5d8ce --- /dev/null +++ b/tests/baselines/reference/contextualTypeWithTuple.js @@ -0,0 +1,29 @@ +//// [contextualTypeWithTuple.ts] +// no error +var numStrTuple: [number, string] = [5, "hello"]; +var numStrTuple2: [number, string] = [5, "foo", true]; +var numStrBoolTuple: [number, string, boolean] = [5, "foo", true]; +var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5]; +var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]]; +numStrTuple = numStrTuple2; +numStrTuple = numStrBoolTuple; + +// error +objNumTuple = [ {}, 5]; +numStrBoolTuple = numStrTuple; +var strStrTuple: [string, string] = ["foo", "bar", 5]; + + +//// [contextualTypeWithTuple.js] +// no error +var numStrTuple = [5, "hello"]; +var numStrTuple2 = [5, "foo", true]; +var numStrBoolTuple = [5, "foo", true]; +var objNumTuple = [{ a: "world" }, 5]; +var strTupleTuple = ["bar", [5, { x: 1, y: 1 }]]; +numStrTuple = numStrTuple2; +numStrTuple = numStrBoolTuple; +// error +objNumTuple = [{}, 5]; +numStrBoolTuple = numStrTuple; +var strStrTuple = ["foo", "bar", 5]; diff --git a/tests/baselines/reference/contextualTyping.errors.txt b/tests/baselines/reference/contextualTyping.errors.txt index 69bffcc5782..ed6e50c1dbd 100644 --- a/tests/baselines/reference/contextualTyping.errors.txt +++ b/tests/baselines/reference/contextualTyping.errors.txt @@ -1,4 +1,10 @@ -==== tests/cases/compiler/contextualTyping.ts (3 errors) ==== +tests/cases/compiler/contextualTyping.ts(189,18): error TS2384: Overload signatures must all be ambient or non-ambient. +tests/cases/compiler/contextualTyping.ts(197,15): error TS2300: Duplicate identifier 'Point'. +tests/cases/compiler/contextualTyping.ts(207,10): error TS2300: Duplicate identifier 'Point'. +tests/cases/compiler/contextualTyping.ts(230,5): error TS2322: Type '{}' is not assignable to type 'B':\n Property 'x' is missing in type '{}'. + + +==== tests/cases/compiler/contextualTyping.ts (4 errors) ==== // DEFAULT INTERFACES interface IFoo { n: number; @@ -189,7 +195,7 @@ // contextually typing function declarations declare function EF1(a:number, b:number):number; ~~~ -!!! Overload signatures must all be ambient or non-ambient. +!!! error TS2384: Overload signatures must all be ambient or non-ambient. function EF1(a,b) { return a+b; } @@ -198,6 +204,8 @@ // contextually typing from ambient class declarations declare class Point + ~~~~~ +!!! error TS2300: Duplicate identifier 'Point'. { constructor(x: number, y: number); x: number; @@ -209,7 +217,7 @@ function Point(x, y) { ~~~~~ -!!! Duplicate identifier 'Point'. +!!! error TS2300: Duplicate identifier 'Point'. this.x = x; this.y = y; @@ -234,5 +242,5 @@ interface B extends A { } var x: B = { }; ~ -!!! Type '{}' is not assignable to type 'B':\n Property 'x' is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type 'B':\n Property 'x' is missing in type '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping11.errors.txt b/tests/baselines/reference/contextualTyping11.errors.txt index b6e8970c764..dca509faa30 100644 --- a/tests/baselines/reference/contextualTyping11.errors.txt +++ b/tests/baselines/reference/contextualTyping11.errors.txt @@ -1,6 +1,11 @@ +tests/cases/compiler/contextualTyping11.ts(1,13): error TS2322: Type 'foo[]' is not assignable to type '{ id: number; }[]': + Type 'foo' is not assignable to type '{ id: number; }': + Property 'id' is missing in type 'foo'. + + ==== tests/cases/compiler/contextualTyping11.ts (1 errors) ==== class foo { public bar:{id:number;}[] = [({})]; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Type 'foo[]' is not assignable to type '{ id: number; }[]': -!!! Type 'foo' is not assignable to type '{ id: number; }': -!!! Property 'id' is missing in type 'foo'. \ No newline at end of file +!!! error TS2322: Type 'foo[]' is not assignable to type '{ id: number; }[]': +!!! error TS2322: Type 'foo' is not assignable to type '{ id: number; }': +!!! error TS2322: Property 'id' is missing in type 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping21.errors.txt b/tests/baselines/reference/contextualTyping21.errors.txt index 12f7d53db8f..620b0635d12 100644 --- a/tests/baselines/reference/contextualTyping21.errors.txt +++ b/tests/baselines/reference/contextualTyping21.errors.txt @@ -1,6 +1,13 @@ +tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type 'Array' is not assignable to type '{ id: number; }[]': + Type 'number | { id: number; }' is not assignable to type '{ id: number; }': + Type 'number' is not assignable to type '{ id: number; }': + Property 'id' is missing in type 'Number'. + + ==== tests/cases/compiler/contextualTyping21.ts (1 errors) ==== var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, 1]; ~~~ -!!! Type '{}[]' is not assignable to type '{ id: number; }[]': -!!! Type '{}' is not assignable to type '{ id: number; }': -!!! Property 'id' is missing in type '{}'. \ No newline at end of file +!!! error TS2322: Type 'Array' is not assignable to type '{ id: number; }[]': +!!! error TS2322: Type 'number | { id: number; }' is not assignable to type '{ id: number; }': +!!! error TS2322: Type 'number' is not assignable to type '{ id: number; }': +!!! error TS2322: Property 'id' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping24.errors.txt b/tests/baselines/reference/contextualTyping24.errors.txt index 5c5a54d280b..2f7f24f9cac 100644 --- a/tests/baselines/reference/contextualTyping24.errors.txt +++ b/tests/baselines/reference/contextualTyping24.errors.txt @@ -1,6 +1,11 @@ +tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number': + Types of parameters 'a' and 'a' are incompatible: + Type 'string' is not assignable to type '{ (): number; (i: number): number; }'. + + ==== tests/cases/compiler/contextualTyping24.ts (1 errors) ==== var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){return 5}; ~~~ -!!! Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number': -!!! Types of parameters 'a' and 'a' are incompatible: -!!! Type 'string' is not assignable to type '{ (): number; (i: number): number; }'. \ No newline at end of file +!!! error TS2322: Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number': +!!! error TS2322: Types of parameters 'a' and 'a' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type '{ (): number; (i: number): number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping30.errors.txt b/tests/baselines/reference/contextualTyping30.errors.txt index 259f59faac7..4c8d87d41b6 100644 --- a/tests/baselines/reference/contextualTyping30.errors.txt +++ b/tests/baselines/reference/contextualTyping30.errors.txt @@ -1,5 +1,11 @@ +tests/cases/compiler/contextualTyping30.ts(1,37): error TS2345: Argument of type 'Array' is not assignable to parameter of type 'number[]'. + Type 'string | number' is not assignable to type 'number': + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/contextualTyping30.ts (1 errors) ==== function foo(param:number[]){}; foo([1, "a"]); ~~~~~~~~ -!!! Argument of type '{}[]' is not assignable to parameter of type 'number[]'. -!!! Type '{}' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2345: Argument of type 'Array' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'string | number' is not assignable to type 'number': +!!! error TS2345: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping32.types b/tests/baselines/reference/contextualTyping32.types index a9d41405b93..383615aec3c 100644 --- a/tests/baselines/reference/contextualTyping32.types +++ b/tests/baselines/reference/contextualTyping32.types @@ -5,7 +5,7 @@ function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){ret >i : number >foo([function(){return 1;}, function(){return 4}]) : void >foo : (param: { (): number; (i: number): number; }[]) => void ->[function(){return 1;}, function(){return 4}] : { (): number; (i: number): number; }[] +>[function(){return 1;}, function(){return 4}] : { (): number; }[] >function(){return 1;} : () => number >function(){return 4} : () => number diff --git a/tests/baselines/reference/contextualTyping33.errors.txt b/tests/baselines/reference/contextualTyping33.errors.txt index adf233b4934..82799037ec6 100644 --- a/tests/baselines/reference/contextualTyping33.errors.txt +++ b/tests/baselines/reference/contextualTyping33.errors.txt @@ -1,5 +1,11 @@ +tests/cases/compiler/contextualTyping33.ts(1,66): error TS2345: Argument of type 'Array<{ (): number; } | { (): string; }>' is not assignable to parameter of type '{ (): number; (i: number): number; }[]'. + Type '{ (): number; } | { (): string; }' is not assignable to type '{ (): number; (i: number): number; }': + Type '() => string' is not assignable to type '{ (): number; (i: number): number; }'. + + ==== tests/cases/compiler/contextualTyping33.ts (1 errors) ==== function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){return 1;}, function(){return "foo"}]); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '{}[]' is not assignable to parameter of type '{ (): number; (i: number): number; }[]'. -!!! Type '{}' is not assignable to type '{ (): number; (i: number): number; }'. \ No newline at end of file +!!! error TS2345: Argument of type 'Array<{ (): number; } | { (): string; }>' is not assignable to parameter of type '{ (): number; (i: number): number; }[]'. +!!! error TS2345: Type '{ (): number; } | { (): string; }' is not assignable to type '{ (): number; (i: number): number; }': +!!! error TS2345: Type '() => string' is not assignable to type '{ (): number; (i: number): number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping39.errors.txt b/tests/baselines/reference/contextualTyping39.errors.txt index 10be2415329..bba7954c73a 100644 --- a/tests/baselines/reference/contextualTyping39.errors.txt +++ b/tests/baselines/reference/contextualTyping39.errors.txt @@ -1,5 +1,9 @@ +tests/cases/compiler/contextualTyping39.ts(1,11): error TS2353: Neither type '() => string' nor type '() => number' is assignable to the other: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/contextualTyping39.ts (1 errors) ==== var foo = <{ (): number; }> function() { return "err"; }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Neither type '() => string' nor type '() => number' is assignable to the other: -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2353: Neither type '() => string' nor type '() => number' is assignable to the other: +!!! error TS2353: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping41.errors.txt b/tests/baselines/reference/contextualTyping41.errors.txt index 6e95b0092ca..03859c4820e 100644 --- a/tests/baselines/reference/contextualTyping41.errors.txt +++ b/tests/baselines/reference/contextualTyping41.errors.txt @@ -1,5 +1,9 @@ +tests/cases/compiler/contextualTyping41.ts(1,11): error TS2353: Neither type '() => string' nor type '{ (): number; (i: number): number; }' is assignable to the other: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/contextualTyping41.ts (1 errors) ==== var foo = <{():number; (i:number):number; }> (function(){return "err";}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Neither type '() => string' nor type '{ (): number; (i: number): number; }' is assignable to the other: -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2353: Neither type '() => string' nor type '{ (): number; (i: number): number; }' is assignable to the other: +!!! error TS2353: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping5.errors.txt b/tests/baselines/reference/contextualTyping5.errors.txt index b72968af35c..ad89eb5a71b 100644 --- a/tests/baselines/reference/contextualTyping5.errors.txt +++ b/tests/baselines/reference/contextualTyping5.errors.txt @@ -1,5 +1,9 @@ +tests/cases/compiler/contextualTyping5.ts(1,13): error TS2322: Type '{}' is not assignable to type '{ id: number; }': + Property 'id' is missing in type '{}'. + + ==== tests/cases/compiler/contextualTyping5.ts (1 errors) ==== class foo { public bar:{id:number;} = { }; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Type '{}' is not assignable to type '{ id: number; }': -!!! Property 'id' is missing in type '{}'. \ No newline at end of file +!!! error TS2322: Type '{}' is not assignable to type '{ id: number; }': +!!! error TS2322: Property 'id' is missing in type '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfAccessors.errors.txt b/tests/baselines/reference/contextualTypingOfAccessors.errors.txt index 93ae5f85865..8d5b732d5f7 100644 --- a/tests/baselines/reference/contextualTypingOfAccessors.errors.txt +++ b/tests/baselines/reference/contextualTypingOfAccessors.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/contextualTypingOfAccessors.ts(8,8): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/contextualTypingOfAccessors.ts(11,8): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/contextualTypingOfAccessors.ts (2 errors) ==== // not contextually typing accessors @@ -8,11 +12,11 @@ x = { get foo() { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return (n)=>n }, set foo(x) {} ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt b/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt index eff83efa960..cb3b439681e 100644 --- a/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt +++ b/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Type 'Array' is not assignable to type 'I': + Index signatures are incompatible: + Type 'number | Date' is not assignable to type 'Date': + Type 'number' is not assignable to type 'Date': + Property 'toDateString' is missing in type 'Number'. + + ==== tests/cases/compiler/contextualTypingOfArrayLiterals1.ts (1 errors) ==== interface I { [x: number]: Date; @@ -5,10 +12,11 @@ var x3: I = [new Date(), 1]; ~~ -!!! Type '{}[]' is not assignable to type 'I': -!!! Index signatures are incompatible: -!!! Type '{}' is not assignable to type 'Date': -!!! Property 'toDateString' is missing in type '{}'. +!!! error TS2322: Type 'Array' is not assignable to type 'I': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'number | Date' is not assignable to type 'Date': +!!! error TS2322: Type 'number' is not assignable to type 'Date': +!!! error TS2322: Property 'toDateString' is missing in type 'Number'. var r2 = x3[1]; r2.getDate(); \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.types b/tests/baselines/reference/contextualTypingOfConditionalExpression.types index 6c6f9b04457..2cd2b671b40 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression.types +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.types @@ -2,7 +2,7 @@ var x: (a: number) => void = true ? (a) => a.toExponential() : (b) => b.toFixed(); >x : (a: number) => void >a : number ->true ? (a) => a.toExponential() : (b) => b.toFixed() : (a: number) => void +>true ? (a) => a.toExponential() : (b) => b.toFixed() : (a: number) => string >(a) => a.toExponential() : (a: number) => string >a : number >a.toExponential() : string @@ -41,7 +41,7 @@ var x2: (a: A) => void = true ? (a) => a.foo : (b) => b.foo; >x2 : (a: A) => void >a : A >A : A ->true ? (a) => a.foo : (b) => b.foo : (a: A) => void +>true ? (a) => a.foo : (b) => b.foo : (a: A) => number >(a) => a.foo : (a: A) => number >a : A >a.foo : number diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt b/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt index 29ca48f0c28..574e25c6f45 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt @@ -1,4 +1,11 @@ -==== tests/cases/compiler/contextualTypingOfConditionalExpression2.ts (2 errors) ==== +tests/cases/compiler/contextualTypingOfConditionalExpression2.ts(11,5): error TS2322: Type '{ (a: C): number; } | { (b: number): void; }' is not assignable to type '(a: A) => void': + Type '(b: number) => void' is not assignable to type '(a: A) => void': + Types of parameters 'b' and 'a' are incompatible: + Type 'number' is not assignable to type 'A': + Property 'foo' is missing in type 'Number'. + + +==== tests/cases/compiler/contextualTypingOfConditionalExpression2.ts (1 errors) ==== class A { foo: number; } @@ -11,7 +18,9 @@ var x2: (a: A) => void = true ? (a: C) => a.foo : (b: number) => { }; ~~ -!!! Type '{}' is not assignable to type '(a: A) => void'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! No best common type exists between '(a: A) => void', '(a: C) => number', and '(b: number) => void'. +!!! error TS2322: Type '{ (a: C): number; } | { (b: number): void; }' is not assignable to type '(a: A) => void': +!!! error TS2322: Type '(b: number) => void' is not assignable to type '(a: A) => void': +!!! error TS2322: Types of parameters 'b' and 'a' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'A': +!!! error TS2322: Property 'foo' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt index 2a768d452bf..f7bac878950 100644 --- a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt +++ b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(16,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. +tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. + + ==== tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts (2 errors) ==== interface Collection { length: number; @@ -16,8 +20,8 @@ var f = (x: number) => { return x.toFixed() }; var r5 = _.forEach(c2, f); ~ -!!! Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. +!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. var r6 = _.forEach(c2, (x) => { return x.toFixed() }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. +!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.errors.txt b/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.errors.txt index 4f04803d0ad..11ff1126d67 100644 --- a/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.errors.txt +++ b/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/contextualTypingOfLambdaReturnExpression.ts(5,16): error TS2339: Property 'length' does not exist on type 'number'. +tests/cases/compiler/contextualTypingOfLambdaReturnExpression.ts(6,18): error TS2339: Property 'length' does not exist on type 'number'. + + ==== tests/cases/compiler/contextualTypingOfLambdaReturnExpression.ts (2 errors) ==== function callb(lam: (l: number) => void); function callb(lam: (n: string) => void); @@ -5,7 +9,7 @@ callb((a) => a.length); // Ok, we choose the second overload because the first one gave us an error when trying to resolve the lambda return type ~~~~~~ -!!! Property 'length' does not exist on type 'number'. +!!! error TS2339: Property 'length' does not exist on type 'number'. callb((a) => { a.length; }); // Error, we picked the first overload and errored when type checking the lambda body ~~~~~~ -!!! Property 'length' does not exist on type 'number'. \ No newline at end of file +!!! error TS2339: Property 'length' does not exist on type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt b/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt index 2e3633b4d64..e512f2a4b55 100644 --- a/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt +++ b/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt @@ -1,11 +1,16 @@ +tests/cases/compiler/contextualTypingOfObjectLiterals.ts(4,1): error TS2322: Type '{ x: string; }' is not assignable to type '{ [x: string]: string; }': + Index signature is missing in type '{ x: string; }'. +tests/cases/compiler/contextualTypingOfObjectLiterals.ts(10,3): error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [x: string]: string; }'. + + ==== tests/cases/compiler/contextualTypingOfObjectLiterals.ts (2 errors) ==== var obj1: { [x: string]: string; }; var obj2 = {x: ""}; obj1 = {}; // Ok obj1 = obj2; // Error - indexer doesn't match ~~~~ -!!! Type '{ x: string; }' is not assignable to type '{ [x: string]: string; }': -!!! Index signature is missing in type '{ x: string; }'. +!!! error TS2322: Type '{ x: string; }' is not assignable to type '{ [x: string]: string; }': +!!! error TS2322: Index signature is missing in type '{ x: string; }'. function f(x: { [s: string]: string }) { } @@ -13,4 +18,4 @@ f(obj1); // Ok f(obj2); // Error - indexer doesn't match ~~~~ -!!! Argument of type '{ x: string; }' is not assignable to parameter of type '{ [x: string]: string; }'. \ No newline at end of file +!!! error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [x: string]: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfObjectLiterals2.errors.txt b/tests/baselines/reference/contextualTypingOfObjectLiterals2.errors.txt index a91abdb2954..27ce89c4714 100644 --- a/tests/baselines/reference/contextualTypingOfObjectLiterals2.errors.txt +++ b/tests/baselines/reference/contextualTypingOfObjectLiterals2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/contextualTypingOfObjectLiterals2.ts(5,18): error TS2339: Property 'hmm' does not exist on type 'string'. + + ==== tests/cases/compiler/contextualTypingOfObjectLiterals2.ts (1 errors) ==== interface Foo { foo: (t: string) => string; @@ -5,4 +8,4 @@ function f2(args: Foo) { } f2({ foo: s => s.hmm }) // 's' should be 'string', so this should be an error ~~~ -!!! Property 'hmm' does not exist on type 'string'. \ No newline at end of file +!!! error TS2339: Property 'hmm' does not exist on type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt index e9de74b27ec..a524fd3be31 100644 --- a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt +++ b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt @@ -1,6 +1,12 @@ -==== tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts (1 errors) ==== +tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(2,22): error TS2339: Property 'foo' does not exist on type 'string'. +tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(3,10): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts (2 errors) ==== var f10: (x: T, b: () => (a: T) => void, y: T) => T; - f10('', () => a => a.foo, ''); // a is string, fixed by first parameter + f10('', () => a => a.foo, ''); // a is string ~~~ -!!! Property 'foo' does not exist on type 'string'. - var r9 = f10('', () => (a => a.foo), 1); // now a should be any \ No newline at end of file +!!! error TS2339: Property 'foo' does not exist on type 'string'. + var r9 = f10('', () => (a => a.foo), 1); // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.js b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.js index cf7274db8a0..55f7580b3f8 100644 --- a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.js +++ b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.js @@ -1,9 +1,9 @@ //// [contextualTypingWithFixedTypeParameters1.ts] var f10: (x: T, b: () => (a: T) => void, y: T) => T; -f10('', () => a => a.foo, ''); // a is string, fixed by first parameter -var r9 = f10('', () => (a => a.foo), 1); // now a should be any +f10('', () => a => a.foo, ''); // a is string +var r9 = f10('', () => (a => a.foo), 1); // error //// [contextualTypingWithFixedTypeParameters1.js] var f10; -f10('', function () { return function (a) { return a.foo; }; }, ''); // a is string, fixed by first parameter -var r9 = f10('', function () { return (function (a) { return a.foo; }); }, 1); // now a should be any +f10('', function () { return function (a) { return a.foo; }; }, ''); // a is string +var r9 = f10('', function () { return (function (a) { return a.foo; }); }, 1); // error diff --git a/tests/baselines/reference/contextuallyTypingOrOperator.types b/tests/baselines/reference/contextuallyTypingOrOperator.types index ee1ac4b0bba..4b47ea763bc 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator.types +++ b/tests/baselines/reference/contextuallyTypingOrOperator.types @@ -3,7 +3,7 @@ var v: { a: (_: string) => number } = { a: s => s.length } || { a: s => 1 }; >v : { a: (_: string) => number; } >a : (_: string) => number >_ : string ->{ a: s => s.length } || { a: s => 1 } : { a: (_: string) => number; } +>{ a: s => s.length } || { a: s => 1 } : { a: (s: string) => number; } >{ a: s => s.length } : { a: (s: string) => number; } >a : (s: string) => number >s => s.length : (s: string) => number @@ -17,10 +17,10 @@ var v: { a: (_: string) => number } = { a: s => s.length } || { a: s => 1 }; >s : string var v2 = (s: string) => s.length || function (s) { s.length }; ->v2 : (s: string) => {} ->(s: string) => s.length || function (s) { s.length } : (s: string) => {} +>v2 : (s: string) => number | { (s: any): void; } +>(s: string) => s.length || function (s) { s.length } : (s: string) => number | { (s: any): void; } >s : string ->s.length || function (s) { s.length } : {} +>s.length || function (s) { s.length } : number | { (s: any): void; } >s.length : number >s : string >length : number @@ -31,10 +31,10 @@ var v2 = (s: string) => s.length || function (s) { s.length }; >length : any var v3 = (s: string) => s.length || function (s: number) { return 1 }; ->v3 : (s: string) => {} ->(s: string) => s.length || function (s: number) { return 1 } : (s: string) => {} +>v3 : (s: string) => number | { (s: number): number; } +>(s: string) => s.length || function (s: number) { return 1 } : (s: string) => number | { (s: number): number; } >s : string ->s.length || function (s: number) { return 1 } : {} +>s.length || function (s: number) { return 1 } : number | { (s: number): number; } >s.length : number >s : string >length : number @@ -42,10 +42,10 @@ var v3 = (s: string) => s.length || function (s: number) { return 1 }; >s : number var v4 = (s: number) => 1 || function (s: string) { return s.length }; ->v4 : (s: number) => {} ->(s: number) => 1 || function (s: string) { return s.length } : (s: number) => {} +>v4 : (s: number) => number | { (s: string): number; } +>(s: number) => 1 || function (s: string) { return s.length } : (s: number) => number | { (s: string): number; } >s : number ->1 || function (s: string) { return s.length } : {} +>1 || function (s: string) { return s.length } : number | { (s: string): number; } >function (s: string) { return s.length } : (s: string) => number >s : string >s.length : number diff --git a/tests/baselines/reference/contextuallyTypingOrOperator2.types b/tests/baselines/reference/contextuallyTypingOrOperator2.types index 57c9992436d..c233066d6dc 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator2.types +++ b/tests/baselines/reference/contextuallyTypingOrOperator2.types @@ -3,7 +3,7 @@ var v: { a: (_: string) => number } = { a: s => s.length } || { a: s => 1 }; >v : { a: (_: string) => number; } >a : (_: string) => number >_ : string ->{ a: s => s.length } || { a: s => 1 } : { a: (_: string) => number; } +>{ a: s => s.length } || { a: s => 1 } : { a: (s: string) => number; } >{ a: s => s.length } : { a: (s: string) => number; } >a : (s: string) => number >s => s.length : (s: string) => number @@ -17,10 +17,10 @@ var v: { a: (_: string) => number } = { a: s => s.length } || { a: s => 1 }; >s : string var v2 = (s: string) => s.length || function (s) { s.aaa }; ->v2 : (s: string) => {} ->(s: string) => s.length || function (s) { s.aaa } : (s: string) => {} +>v2 : (s: string) => number | { (s: any): void; } +>(s: string) => s.length || function (s) { s.aaa } : (s: string) => number | { (s: any): void; } >s : string ->s.length || function (s) { s.aaa } : {} +>s.length || function (s) { s.aaa } : number | { (s: any): void; } >s.length : number >s : string >length : number diff --git a/tests/baselines/reference/contextuallyTypingOrOperator3.errors.txt b/tests/baselines/reference/contextuallyTypingOrOperator3.errors.txt index 8c22771ad8f..ca7385b9c29 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator3.errors.txt +++ b/tests/baselines/reference/contextuallyTypingOrOperator3.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/contextuallyTypingOrOperator3.ts(1,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/contextuallyTypingOrOperator3.ts (1 errors) ==== function foo(u: U) { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var x3: U = u || u; } \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypingRestParameters.errors.txt b/tests/baselines/reference/contextuallyTypingRestParameters.errors.txt new file mode 100644 index 00000000000..369d10e88c2 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypingRestParameters.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/contextuallyTypingRestParameters.ts(3,9): error TS2323: Type 'string[]' is not assignable to type 'string'. +tests/cases/compiler/contextuallyTypingRestParameters.ts(5,9): error TS2323: Type 'string[]' is not assignable to type 'string'. + + +==== tests/cases/compiler/contextuallyTypingRestParameters.ts (2 errors) ==== + var x: (...y: string[]) => void = function (.../*3*/y) { + var t = y; + var x2: string = t; // This should be error + ~~ +!!! error TS2323: Type 'string[]' is not assignable to type 'string'. + var x3: string[] = t; // No error + var y2: string = y; // This should be error + ~~ +!!! error TS2323: Type 'string[]' is not assignable to type 'string'. + var y3: string[] = y; // No error + }; \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypingRestParameters.js b/tests/baselines/reference/contextuallyTypingRestParameters.js new file mode 100644 index 00000000000..17561f5d7fc --- /dev/null +++ b/tests/baselines/reference/contextuallyTypingRestParameters.js @@ -0,0 +1,21 @@ +//// [contextuallyTypingRestParameters.ts] +var x: (...y: string[]) => void = function (.../*3*/y) { + var t = y; + var x2: string = t; // This should be error + var x3: string[] = t; // No error + var y2: string = y; // This should be error + var y3: string[] = y; // No error +}; + +//// [contextuallyTypingRestParameters.js] +var x = function () { + var y = []; + for (var _i = 0; _i < arguments.length; _i++) { + y[_i - 0] = arguments[_i]; + } + var t = y; + var x2 = t; // This should be error + var x3 = t; // No error + var y2 = y; // This should be error + var y3 = y; // No error +}; diff --git a/tests/baselines/reference/continueInIterationStatement4.errors.txt b/tests/baselines/reference/continueInIterationStatement4.errors.txt index c0f4388cf79..bbc20570547 100644 --- a/tests/baselines/reference/continueInIterationStatement4.errors.txt +++ b/tests/baselines/reference/continueInIterationStatement4.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/continueInIterationStatement4.ts(1,15): error TS2304: Cannot find name 'something'. + + ==== tests/cases/compiler/continueInIterationStatement4.ts (1 errors) ==== for (var i in something) { ~~~~~~~~~ -!!! Cannot find name 'something'. +!!! error TS2304: Cannot find name 'something'. continue; } \ No newline at end of file diff --git a/tests/baselines/reference/continueNotInIterationStatement1.errors.txt b/tests/baselines/reference/continueNotInIterationStatement1.errors.txt index 5f7d543a0aa..8643b4134e0 100644 --- a/tests/baselines/reference/continueNotInIterationStatement1.errors.txt +++ b/tests/baselines/reference/continueNotInIterationStatement1.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/continueNotInIterationStatement1.ts(1,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. + + ==== tests/cases/compiler/continueNotInIterationStatement1.ts (1 errors) ==== continue; ~~~~~~~~~ -!!! A 'continue' statement can only be used within an enclosing iteration statement. \ No newline at end of file +!!! error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. \ No newline at end of file diff --git a/tests/baselines/reference/continueNotInIterationStatement2.errors.txt b/tests/baselines/reference/continueNotInIterationStatement2.errors.txt index 0bfc41d7f72..f294be84b09 100644 --- a/tests/baselines/reference/continueNotInIterationStatement2.errors.txt +++ b/tests/baselines/reference/continueNotInIterationStatement2.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/continueNotInIterationStatement2.ts(3,5): error TS1107: Jump target cannot cross function boundary. + + ==== tests/cases/compiler/continueNotInIterationStatement2.ts (1 errors) ==== while (true) { function f() { continue; ~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } \ No newline at end of file diff --git a/tests/baselines/reference/continueNotInIterationStatement3.errors.txt b/tests/baselines/reference/continueNotInIterationStatement3.errors.txt index d8627b4fc3a..5ef40d2f62a 100644 --- a/tests/baselines/reference/continueNotInIterationStatement3.errors.txt +++ b/tests/baselines/reference/continueNotInIterationStatement3.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/continueNotInIterationStatement3.ts(3,5): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. + + ==== tests/cases/compiler/continueNotInIterationStatement3.ts (1 errors) ==== switch (0) { default: continue; ~~~~~~~~~ -!!! A 'continue' statement can only be used within an enclosing iteration statement. +!!! error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. } \ No newline at end of file diff --git a/tests/baselines/reference/continueNotInIterationStatement4.errors.txt b/tests/baselines/reference/continueNotInIterationStatement4.errors.txt index 91e7b26b578..1c80f7057b8 100644 --- a/tests/baselines/reference/continueNotInIterationStatement4.errors.txt +++ b/tests/baselines/reference/continueNotInIterationStatement4.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/continueNotInIterationStatement4.ts(4,5): error TS1107: Jump target cannot cross function boundary. + + ==== tests/cases/compiler/continueNotInIterationStatement4.ts (1 errors) ==== TWO: while (true){ var x = () => { continue TWO; ~~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } \ No newline at end of file diff --git a/tests/baselines/reference/continueTarget1.errors.txt b/tests/baselines/reference/continueTarget1.errors.txt index 1b93d9fc707..7b1f40e02f0 100644 --- a/tests/baselines/reference/continueTarget1.errors.txt +++ b/tests/baselines/reference/continueTarget1.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/continueTarget1.ts(2,3): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. + + ==== tests/cases/compiler/continueTarget1.ts (1 errors) ==== target: continue target; ~~~~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. \ No newline at end of file +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. \ No newline at end of file diff --git a/tests/baselines/reference/continueTarget5.errors.txt b/tests/baselines/reference/continueTarget5.errors.txt index aa156707aa5..401c5874ee0 100644 --- a/tests/baselines/reference/continueTarget5.errors.txt +++ b/tests/baselines/reference/continueTarget5.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/continueTarget5.ts(5,7): error TS1107: Jump target cannot cross function boundary. + + ==== tests/cases/compiler/continueTarget5.ts (1 errors) ==== target: while (true) { @@ -5,7 +8,7 @@ while (true) { continue target; ~~~~~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } } \ No newline at end of file diff --git a/tests/baselines/reference/continueTarget6.errors.txt b/tests/baselines/reference/continueTarget6.errors.txt index 2177e50523d..2220467abcb 100644 --- a/tests/baselines/reference/continueTarget6.errors.txt +++ b/tests/baselines/reference/continueTarget6.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/continueTarget6.ts(2,3): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. + + ==== tests/cases/compiler/continueTarget6.ts (1 errors) ==== while (true) { continue target; ~~~~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. } \ No newline at end of file diff --git a/tests/baselines/reference/copyrightWithNewLine1.errors.txt b/tests/baselines/reference/copyrightWithNewLine1.errors.txt index a389197bf39..680d783a1d9 100644 --- a/tests/baselines/reference/copyrightWithNewLine1.errors.txt +++ b/tests/baselines/reference/copyrightWithNewLine1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/copyrightWithNewLine1.ts(5,24): error TS2307: Cannot find external module './greeter'. +tests/cases/compiler/copyrightWithNewLine1.ts(6,10): error TS2304: Cannot find name 'document'. + + ==== tests/cases/compiler/copyrightWithNewLine1.ts (2 errors) ==== /***************************** * (c) Copyright - Important @@ -5,10 +9,10 @@ import model = require("./greeter") ~~~~~~~~~~~ -!!! Cannot find external module './greeter'. +!!! error TS2307: Cannot find external module './greeter'. var el = document.getElementById('content'); ~~~~~~~~ -!!! Cannot find name 'document'. +!!! error TS2304: Cannot find name 'document'. var greeter = new model.Greeter(el); /** things */ greeter.start(); \ No newline at end of file diff --git a/tests/baselines/reference/copyrightWithoutNewLine1.errors.txt b/tests/baselines/reference/copyrightWithoutNewLine1.errors.txt index 429764799e2..a4f792f2dae 100644 --- a/tests/baselines/reference/copyrightWithoutNewLine1.errors.txt +++ b/tests/baselines/reference/copyrightWithoutNewLine1.errors.txt @@ -1,13 +1,17 @@ +tests/cases/compiler/copyrightWithoutNewLine1.ts(4,24): error TS2307: Cannot find external module './greeter'. +tests/cases/compiler/copyrightWithoutNewLine1.ts(5,10): error TS2304: Cannot find name 'document'. + + ==== tests/cases/compiler/copyrightWithoutNewLine1.ts (2 errors) ==== /***************************** * (c) Copyright - Important ****************************/ import model = require("./greeter") ~~~~~~~~~~~ -!!! Cannot find external module './greeter'. +!!! error TS2307: Cannot find external module './greeter'. var el = document.getElementById('content'); ~~~~~~~~ -!!! Cannot find name 'document'. +!!! error TS2304: Cannot find name 'document'. var greeter = new model.Greeter(el); /** things */ greeter.start(); \ No newline at end of file diff --git a/tests/baselines/reference/couldNotSelectGenericOverload.errors.txt b/tests/baselines/reference/couldNotSelectGenericOverload.errors.txt index 8a813a1b432..bafa2bc4237 100644 --- a/tests/baselines/reference/couldNotSelectGenericOverload.errors.txt +++ b/tests/baselines/reference/couldNotSelectGenericOverload.errors.txt @@ -1,13 +1,17 @@ +tests/cases/compiler/couldNotSelectGenericOverload.ts(3,11): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/couldNotSelectGenericOverload.ts(7,11): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/couldNotSelectGenericOverload.ts (2 errors) ==== function makeArray(items: T[]): T[] { return items; } var b = [1, ""]; var b1G = makeArray(1, ""); // any, no error ~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var b2G = makeArray(b); // any[] function makeArray2(items: any[]): any[] { return items; } var b3G = makeArray2(1, ""); // error ~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt index 3659bab73e8..15a1c7913bb 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(5,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(9,5): error TS2322: Type '(x: "hi", items: string[]) => typeof foo' is not assignable to type 'D': + Property 'x' is missing in type '(x: "hi", items: string[]) => typeof foo'. + + ==== tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts (2 errors) ==== class C { private x = 1; @@ -5,12 +10,12 @@ class D extends C { } function foo(x: "hi", items: string[]): typeof foo; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(x: string, items: string[]): typeof foo { return null; } var a: D = foo("hi", []); ~ -!!! Type '(x: "hi", items: string[]) => typeof foo' is not assignable to type 'D': -!!! Property 'x' is missing in type '(x: "hi", items: string[]) => typeof foo'. +!!! error TS2322: Type '(x: "hi", items: string[]) => typeof foo' is not assignable to type 'D': +!!! error TS2322: Property 'x' is missing in type '(x: "hi", items: string[]) => typeof foo'. \ No newline at end of file diff --git a/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt b/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt index 46693ee5726..a1f5afbde13 100644 --- a/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt +++ b/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(6,28): error TS2304: Cannot find name 'task'. +tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(8,18): error TS2304: Cannot find name 'path'. +tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(9,19): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(10,50): error TS2304: Cannot find name 'moduleType'. + + ==== tests/cases/compiler/crashIntypeCheckInvocationExpression.ts (4 errors) ==== var nake; function doCompile(fileset: P0, moduleType: P1) { @@ -6,16 +12,16 @@ } export var compileServer = task(() => { ~~~~ -!!! Cannot find name 'task'. +!!! error TS2304: Cannot find name 'task'. var folder = path.join(), ~~~~ -!!! Cannot find name 'path'. +!!! error TS2304: Cannot find name 'path'. fileset = nake.fileSetSync(folder) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. return doCompile(fileset, moduleType); ~~~~~~~~~~ -!!! Cannot find name 'moduleType'. +!!! error TS2304: Cannot find name 'moduleType'. }); \ No newline at end of file diff --git a/tests/baselines/reference/crashIntypeCheckObjectCreationExpression.errors.txt b/tests/baselines/reference/crashIntypeCheckObjectCreationExpression.errors.txt index 3399c75914c..a1a129795a4 100644 --- a/tests/baselines/reference/crashIntypeCheckObjectCreationExpression.errors.txt +++ b/tests/baselines/reference/crashIntypeCheckObjectCreationExpression.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/crashIntypeCheckObjectCreationExpression.ts(3,45): error TS2304: Cannot find name 'X'. + + ==== tests/cases/compiler/crashIntypeCheckObjectCreationExpression.ts (1 errors) ==== export class BuildWorkspaceService { public injectRequestService(service: P0) { this.injectBuildService(new X(service)); ~ -!!! Cannot find name 'X'. +!!! error TS2304: Cannot find name 'X'. } public injectBuildService(service: P0) { } diff --git a/tests/baselines/reference/crashOnMethodSignatures.errors.txt b/tests/baselines/reference/crashOnMethodSignatures.errors.txt index 014700b8135..1970d4270d4 100644 --- a/tests/baselines/reference/crashOnMethodSignatures.errors.txt +++ b/tests/baselines/reference/crashOnMethodSignatures.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/crashOnMethodSignatures.ts(2,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/crashOnMethodSignatures.ts (1 errors) ==== class A { a(completed: () => any): void; ~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/crashRegressionTest.errors.txt b/tests/baselines/reference/crashRegressionTest.errors.txt index a08d1181397..316f796067a 100644 --- a/tests/baselines/reference/crashRegressionTest.errors.txt +++ b/tests/baselines/reference/crashRegressionTest.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/crashRegressionTest.ts(16,56): error TS2339: Property '_name' does not exist on type 'StringTemplate'. + + ==== tests/cases/compiler/crashRegressionTest.ts (1 errors) ==== module MsPortal.Util.TemplateEngine { "use strict"; @@ -16,7 +19,7 @@ public text(value?: string): any { this._templateStorage.templateSources[this._name] = value; ~~~~~ -!!! Property '_name' does not exist on type 'StringTemplate'. +!!! error TS2339: Property '_name' does not exist on type 'StringTemplate'. } } diff --git a/tests/baselines/reference/createArray.errors.txt b/tests/baselines/reference/createArray.errors.txt index 41426d307fa..6f79c4b47d2 100644 --- a/tests/baselines/reference/createArray.errors.txt +++ b/tests/baselines/reference/createArray.errors.txt @@ -1,26 +1,35 @@ +tests/cases/compiler/createArray.ts(1,18): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/createArray.ts(6,6): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/createArray.ts(7,19): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/createArray.ts(8,18): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/createArray.ts(1,12): error TS2304: Cannot find name 'number'. +tests/cases/compiler/createArray.ts(7,12): error TS2304: Cannot find name 'boolean'. +tests/cases/compiler/createArray.ts(8,12): error TS2304: Cannot find name 'string'. + + ==== tests/cases/compiler/createArray.ts (7 errors) ==== var na=new number[]; ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ -!!! Cannot find name 'number'. +!!! error TS2304: Cannot find name 'number'. class C { } new C[]; ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var ba=new boolean[]; ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~~ -!!! Cannot find name 'boolean'. +!!! error TS2304: Cannot find name 'boolean'. var sa=new string[]; ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ -!!! Cannot find name 'string'. +!!! error TS2304: Cannot find name 'string'. function f(s:string):number { return 0; } if (ba[14]) { diff --git a/tests/baselines/reference/customEventDetail.errors.txt b/tests/baselines/reference/customEventDetail.errors.txt index 7cddf40e6ff..f243dc64c34 100644 --- a/tests/baselines/reference/customEventDetail.errors.txt +++ b/tests/baselines/reference/customEventDetail.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/customEventDetail.ts(1,8): error TS2304: Cannot find name 'CustomEvent'. + + ==== tests/cases/compiler/customEventDetail.ts (1 errors) ==== var x: CustomEvent; ~~~~~~~~~~~ -!!! Cannot find name 'CustomEvent'. +!!! error TS2304: Cannot find name 'CustomEvent'. // valid since detail is any x.initCustomEvent('hello', true, true, { id: 12, name: 'hello' }); diff --git a/tests/baselines/reference/declFileGenericType2.types b/tests/baselines/reference/declFileGenericType2.types index a6b6546326c..f9345b5ff11 100644 --- a/tests/baselines/reference/declFileGenericType2.types +++ b/tests/baselines/reference/declFileGenericType2.types @@ -131,11 +131,11 @@ module templa.dom.mvc.composite { >super : typeof AbstractElementController this._controllers = []; ->this._controllers = [] : templa.mvc.IController[] +>this._controllers = [] : undefined[] >this._controllers : templa.mvc.IController[] >this : AbstractCompositeElementController >_controllers : templa.mvc.IController[] ->[] : templa.mvc.IController[] +>[] : undefined[] } } } diff --git a/tests/baselines/reference/declFileObjectLiteralWithAccessors.errors.txt b/tests/baselines/reference/declFileObjectLiteralWithAccessors.errors.txt index bb0e82e470b..4c0093a5438 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithAccessors.errors.txt +++ b/tests/baselines/reference/declFileObjectLiteralWithAccessors.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/declFileObjectLiteralWithAccessors.ts(5,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/declFileObjectLiteralWithAccessors.ts(6,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/declFileObjectLiteralWithAccessors.ts (2 errors) ==== function /*1*/makePoint(x: number) { @@ -5,10 +9,10 @@ b: 10, get x() { return x; }, ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. set x(a: number) { this.b = a; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. }; }; var /*4*/point = makePoint(2); diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.errors.txt b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.errors.txt index 17d42cfbbb1..961442c23d0 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.errors.txt +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/declFileObjectLiteralWithOnlyGetter.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/declFileObjectLiteralWithOnlyGetter.ts (1 errors) ==== function /*1*/makePoint(x: number) { return { get x() { return x; }, ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. }; }; var /*4*/point = makePoint(2); diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.errors.txt b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.errors.txt index 5499492feae..7680a8d14dc 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.errors.txt +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/declFileObjectLiteralWithOnlySetter.ts(5,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/declFileObjectLiteralWithOnlySetter.ts (1 errors) ==== function /*1*/makePoint(x: number) { @@ -5,7 +8,7 @@ b: 10, set x(a: number) { this.b = a; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. }; }; var /*3*/point = makePoint(2); diff --git a/tests/baselines/reference/declFilePrivateStatic.errors.txt b/tests/baselines/reference/declFilePrivateStatic.errors.txt index 14d69a0653b..4e1da34b979 100644 --- a/tests/baselines/reference/declFilePrivateStatic.errors.txt +++ b/tests/baselines/reference/declFilePrivateStatic.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/declFilePrivateStatic.ts(9,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/declFilePrivateStatic.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/declFilePrivateStatic.ts(12,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/declFilePrivateStatic.ts(13,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/declFilePrivateStatic.ts (4 errors) ==== class C { @@ -9,15 +15,15 @@ private static get c() { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static get d() { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. private static set e(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static set f(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/declInput-2.errors.txt b/tests/baselines/reference/declInput-2.errors.txt index a987b7ac179..ed0be8f64e5 100644 --- a/tests/baselines/reference/declInput-2.errors.txt +++ b/tests/baselines/reference/declInput-2.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/declInput-2.ts(10,9): error TS4031: Public property 'm22' of exported class has or is using private name 'C'. +tests/cases/compiler/declInput-2.ts(13,9): error TS4031: Public property 'm25' of exported class has or is using private name 'I2'. +tests/cases/compiler/declInput-2.ts(16,16): error TS4055: Return type of public method from exported class has or is using private name 'I2'. +tests/cases/compiler/declInput-2.ts(18,21): error TS4073: Parameter 'i' of public method from exported class has or is using private name 'I2'. +tests/cases/compiler/declInput-2.ts(19,16): error TS4055: Return type of public method from exported class has or is using private name 'C'. + + ==== tests/cases/compiler/declInput-2.ts (5 errors) ==== module M { class C { } @@ -10,23 +17,23 @@ public m2: string; public m22: C; // don't generate ~~~~~~~~~~~~~~ -!!! Public property 'm22' of exported class has or is using private name 'C'. +!!! error TS4031: Public property 'm22' of exported class has or is using private name 'C'. public m23: E; public m24: I1; public m25: I2; // don't generate ~~~~~~~~~~~~~~~ -!!! Public property 'm25' of exported class has or is using private name 'I2'. +!!! error TS4031: Public property 'm25' of exported class has or is using private name 'I2'. public m232(): E { return null;} public m242(): I1 { return null; } public m252(): I2 { return null; } // don't generate ~~~~ -!!! Return type of public method from exported class has or is using private name 'I2'. +!!! error TS4055: Return type of public method from exported class has or is using private name 'I2'. public m26(i:I1) {} public m262(i:I2) {} ~~~~ -!!! Parameter 'i' of public method from exported class has or is using private name 'I2'. +!!! error TS4073: Parameter 'i' of public method from exported class has or is using private name 'I2'. public m3():C { return new C(); } ~~ -!!! Return type of public method from exported class has or is using private name 'C'. +!!! error TS4055: Return type of public method from exported class has or is using private name 'C'. } } \ No newline at end of file diff --git a/tests/baselines/reference/declInput.errors.txt b/tests/baselines/reference/declInput.errors.txt index c2d4c37e9e6..8ec341ce15b 100644 --- a/tests/baselines/reference/declInput.errors.txt +++ b/tests/baselines/reference/declInput.errors.txt @@ -1,11 +1,17 @@ -==== tests/cases/compiler/declInput.ts (1 errors) ==== +tests/cases/compiler/declInput.ts(1,11): error TS2300: Duplicate identifier 'bar'. +tests/cases/compiler/declInput.ts(5,7): error TS2300: Duplicate identifier 'bar'. + + +==== tests/cases/compiler/declInput.ts (2 errors) ==== interface bar { + ~~~ +!!! error TS2300: Duplicate identifier 'bar'. } class bar { ~~~ -!!! Duplicate identifier 'bar'. +!!! error TS2300: Duplicate identifier 'bar'. public f() { return ''; } public g() { return {a: null, b: undefined, c: void 4 }; } public h(x = 4, y = null, z = '') { x++; } diff --git a/tests/baselines/reference/declarationEmit_invalidReference2.errors.txt b/tests/baselines/reference/declarationEmit_invalidReference2.errors.txt index 91368320ba3..1f3960a87ab 100644 --- a/tests/baselines/reference/declarationEmit_invalidReference2.errors.txt +++ b/tests/baselines/reference/declarationEmit_invalidReference2.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/declarationEmit_invalidReference2.ts(1,1): error TS6053: File 'tests/cases/compiler/invalid.ts' not found. + + ==== tests/cases/compiler/declarationEmit_invalidReference2.ts (1 errors) ==== /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! File 'invalid.ts' not found. +!!! error TS6053: File 'invalid.ts' not found. var x = 0; \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmit_protectedMembers.js b/tests/baselines/reference/declarationEmit_protectedMembers.js new file mode 100644 index 00000000000..dc8506b220b --- /dev/null +++ b/tests/baselines/reference/declarationEmit_protectedMembers.js @@ -0,0 +1,164 @@ +//// [declarationEmit_protectedMembers.ts] + +// Class with protected members +class C1 { + protected x: number; + + protected f() { + return this.x; + } + + protected set accessor(a: number) { } + protected get accessor() { return 0; } + + protected static sx: number; + + protected static sf() { + return this.sx; + } + + protected static set staticSetter(a: number) { } + protected static get staticGetter() { return 0; } +} + +// Derived class overriding protected members +class C2 extends C1 { + protected f() { + return super.f() + this.x; + } + protected static sf() { + return super.sf() + this.sx; + } +} + +// Derived class making protected members public +class C3 extends C2 { + x: number; + static sx: number; + f() { + return super.f(); + } + static sf() { + return super.sf(); + } + + static get staticGetter() { return 1; } +} + +// Protected properties in constructors +class C4 { + constructor(protected a: number, protected b) { } +} + +//// [declarationEmit_protectedMembers.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +// Class with protected members +var C1 = (function () { + function C1() { + } + C1.prototype.f = function () { + return this.x; + }; + Object.defineProperty(C1.prototype, "accessor", { + get: function () { + return 0; + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + C1.sf = function () { + return this.sx; + }; + Object.defineProperty(C1, "staticSetter", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C1, "staticGetter", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C1; +})(); +// Derived class overriding protected members +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + C2.prototype.f = function () { + return _super.prototype.f.call(this) + this.x; + }; + C2.sf = function () { + return _super.sf.call(this) + this.sx; + }; + return C2; +})(C1); +// Derived class making protected members public +var C3 = (function (_super) { + __extends(C3, _super); + function C3() { + _super.apply(this, arguments); + } + C3.prototype.f = function () { + return _super.prototype.f.call(this); + }; + C3.sf = function () { + return _super.sf.call(this); + }; + Object.defineProperty(C3, "staticGetter", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + return C3; +})(C2); +// Protected properties in constructors +var C4 = (function () { + function C4(a, b) { + this.a = a; + this.b = b; + } + return C4; +})(); + + +//// [declarationEmit_protectedMembers.d.ts] +declare class C1 { + protected x: number; + protected f(): number; + protected accessor: number; + protected static sx: number; + protected static sf(): number; + protected static staticSetter: number; + protected static staticGetter: number; +} +declare class C2 extends C1 { + protected f(): number; + protected static sf(): number; +} +declare class C3 extends C2 { + x: number; + static sx: number; + f(): number; + static sf(): number; + static staticGetter: number; +} +declare class C4 { + protected a: number; + protected b: any; + constructor(a: number, b: any); +} diff --git a/tests/baselines/reference/declarationEmit_protectedMembers.types b/tests/baselines/reference/declarationEmit_protectedMembers.types new file mode 100644 index 00000000000..28217b0c070 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_protectedMembers.types @@ -0,0 +1,120 @@ +=== tests/cases/compiler/declarationEmit_protectedMembers.ts === + +// Class with protected members +class C1 { +>C1 : C1 + + protected x: number; +>x : number + + protected f() { +>f : () => number + + return this.x; +>this.x : number +>this : C1 +>x : number + } + + protected set accessor(a: number) { } +>accessor : number +>a : number + + protected get accessor() { return 0; } +>accessor : number + + protected static sx: number; +>sx : number + + protected static sf() { +>sf : () => number + + return this.sx; +>this.sx : number +>this : typeof C1 +>sx : number + } + + protected static set staticSetter(a: number) { } +>staticSetter : number +>a : number + + protected static get staticGetter() { return 0; } +>staticGetter : number +} + +// Derived class overriding protected members +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + protected f() { +>f : () => number + + return super.f() + this.x; +>super.f() + this.x : number +>super.f() : number +>super.f : () => number +>super : C1 +>f : () => number +>this.x : number +>this : C2 +>x : number + } + protected static sf() { +>sf : () => number + + return super.sf() + this.sx; +>super.sf() + this.sx : number +>super.sf() : number +>super.sf : () => number +>super : typeof C1 +>sf : () => number +>this.sx : number +>this : typeof C2 +>sx : number + } +} + +// Derived class making protected members public +class C3 extends C2 { +>C3 : C3 +>C2 : C2 + + x: number; +>x : number + + static sx: number; +>sx : number + + f() { +>f : () => number + + return super.f(); +>super.f() : number +>super.f : () => number +>super : C2 +>f : () => number + } + static sf() { +>sf : () => number + + return super.sf(); +>super.sf() : number +>super.sf : () => number +>super : typeof C2 +>sf : () => number + } + + static get staticGetter() { return 1; } +>staticGetter : number +} + +// Protected properties in constructors +class C4 { +>C4 : C4 + + constructor(protected a: number, protected b) { } +>a : number +>b : any +} diff --git a/tests/baselines/reference/declareAlreadySeen.errors.txt b/tests/baselines/reference/declareAlreadySeen.errors.txt index 0c765edf9dd..d606b571478 100644 --- a/tests/baselines/reference/declareAlreadySeen.errors.txt +++ b/tests/baselines/reference/declareAlreadySeen.errors.txt @@ -1,17 +1,23 @@ +tests/cases/compiler/declareAlreadySeen.ts(2,13): error TS1030: 'declare' modifier already seen. +tests/cases/compiler/declareAlreadySeen.ts(3,13): error TS1030: 'declare' modifier already seen. +tests/cases/compiler/declareAlreadySeen.ts(5,13): error TS1030: 'declare' modifier already seen. +tests/cases/compiler/declareAlreadySeen.ts(7,13): error TS1030: 'declare' modifier already seen. + + ==== tests/cases/compiler/declareAlreadySeen.ts (4 errors) ==== module M { declare declare var x; ~~~~~~~ -!!! 'declare' modifier already seen. +!!! error TS1030: 'declare' modifier already seen. declare declare function f(); ~~~~~~~ -!!! 'declare' modifier already seen. +!!! error TS1030: 'declare' modifier already seen. declare declare module N { } ~~~~~~~ -!!! 'declare' modifier already seen. +!!! error TS1030: 'declare' modifier already seen. declare declare class C { } ~~~~~~~ -!!! 'declare' modifier already seen. +!!! error TS1030: 'declare' modifier already seen. } \ No newline at end of file diff --git a/tests/baselines/reference/declareClassInterfaceImplementation.errors.txt b/tests/baselines/reference/declareClassInterfaceImplementation.errors.txt index 8fc743d97fe..10b2d8ec118 100644 --- a/tests/baselines/reference/declareClassInterfaceImplementation.errors.txt +++ b/tests/baselines/reference/declareClassInterfaceImplementation.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/declareClassInterfaceImplementation.ts(5,15): error TS2421: Class 'Buffer' incorrectly implements interface 'IBuffer': + Index signature is missing in type 'Buffer'. + + ==== tests/cases/compiler/declareClassInterfaceImplementation.ts (1 errors) ==== interface IBuffer { [index: number]: number; @@ -5,8 +9,8 @@ declare class Buffer implements IBuffer { ~~~~~~ -!!! Class 'Buffer' incorrectly implements interface 'IBuffer': -!!! Index signature is missing in type 'Buffer'. +!!! error TS2421: Class 'Buffer' incorrectly implements interface 'IBuffer': +!!! error TS2421: Index signature is missing in type 'Buffer'. } \ No newline at end of file diff --git a/tests/baselines/reference/decrementAndIncrementOperators.errors.txt b/tests/baselines/reference/decrementAndIncrementOperators.errors.txt index 27c6c19ed1f..ec58db836a6 100644 --- a/tests/baselines/reference/decrementAndIncrementOperators.errors.txt +++ b/tests/baselines/reference/decrementAndIncrementOperators.errors.txt @@ -1,52 +1,67 @@ +tests/cases/compiler/decrementAndIncrementOperators.ts(4,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(6,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(7,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(9,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(10,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(12,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(13,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(15,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(16,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(18,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(19,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(21,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/compiler/decrementAndIncrementOperators.ts(22,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + + ==== tests/cases/compiler/decrementAndIncrementOperators.ts (13 errors) ==== var x = 0; // errors 1 ++; ~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. (1)++; ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. (1)--; ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++(1); ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --(1); ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. (1 + 2)++; ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. (1 + 2)--; ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++(1 + 2); ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --(1 + 2); ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. (x + x)++; ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. (x + x)--; ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++(x + x); ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --(x + x); ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. //OK x++; diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherType.types b/tests/baselines/reference/decrementOperatorWithAnyOtherType.types index 4e8387f9066..ab21dd9db5c 100644 --- a/tests/baselines/reference/decrementOperatorWithAnyOtherType.types +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherType.types @@ -9,7 +9,7 @@ var ANY1; var ANY2: any[] = ["", ""]; >ANY2 : any[] ->["", ""] : any[] +>["", ""] : string[] var obj = {x:1,y:null}; >obj : { x: number; y: any; } diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt index 5bc5153a610..31213ce2fd4 100644 --- a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt @@ -1,3 +1,49 @@ +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(24,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(25,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(26,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(27,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(28,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(30,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(31,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(32,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(33,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(34,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(37,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(39,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(42,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(43,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(46,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(47,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(51,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(52,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(54,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(55,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,25): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,25): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,25): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(59,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(60,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(63,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(65,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(67,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(70,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(71,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(72,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + + ==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts (44 errors) ==== // -- operator on any type var ANY1; @@ -24,138 +70,138 @@ // any type var var ResultIsNumber1 = --ANY2; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber2 = --A; ~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber3 = --M; ~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber4 = --obj; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber5 = --obj1; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber6 = ANY2--; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber7 = A--; ~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber8 = M--; ~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber9 = obj--; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber10 = obj1--; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // any type literal var ResultIsNumber11 = --{}; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber12 = --null; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber13 = --undefined; ~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber14 = null--; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber15 = {}--; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber16 = undefined--; ~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // any type expressions var ResultIsNumber17 = --foo(); ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber18 = --A.foo(); ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber19 = --(null + undefined); ~~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsNumber20 = --(null + null); ~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var ResultIsNumber21 = --(undefined + undefined); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsNumber22 = --obj1.x; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber23 = --obj1.y; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber24 = foo()--; ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber25 = A.foo()--; ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber26 = (null + undefined)--; ~~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsNumber27 = (null + null)--; ~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var ResultIsNumber28 = (undefined + undefined)--; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsNumber29 = obj1.x--; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber30 = obj1.y--; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // miss assignment operators --ANY2; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ANY2--; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --ANY1--; ~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --ANY1++; ~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++ANY1--; ~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --ANY2[0]--; ~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --ANY2[0]++; ~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++ANY2[0]--; ~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file diff --git a/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt b/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt new file mode 100644 index 00000000000..a0c30e9dc93 --- /dev/null +++ b/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,23): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,7): error TS2304: Cannot find name 'A'. + + +==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts (3 errors) ==== + // -- operator on enum type + + enum ENUM1 { A, B, "" }; + + // expression + var ResultIsNumber1 = --ENUM1["A"]; + var ResultIsNumber2 = ENUM1.A--; + ~~~~~~~ +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + + // miss assignment operator + --ENUM1["A"]; + + ENUM1[A]--; + ~~~~~~~~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2304: Cannot find name 'A'. \ No newline at end of file diff --git a/tests/baselines/reference/decrementOperatorWithEnumType.js b/tests/baselines/reference/decrementOperatorWithEnumType.js index 8c22fd18928..13947a6a948 100644 --- a/tests/baselines/reference/decrementOperatorWithEnumType.js +++ b/tests/baselines/reference/decrementOperatorWithEnumType.js @@ -1,29 +1,29 @@ //// [decrementOperatorWithEnumType.ts] // -- operator on enum type -enum ENUM1 { 1, 2, "" }; +enum ENUM1 { A, B, "" }; // expression -var ResultIsNumber1 = --ENUM1[1]; -var ResultIsNumber2 = ENUM1[1]--; +var ResultIsNumber1 = --ENUM1["A"]; +var ResultIsNumber2 = ENUM1.A--; // miss assignment operator ---ENUM1[1]; +--ENUM1["A"]; -ENUM1[1]--; +ENUM1[A]--; //// [decrementOperatorWithEnumType.js] // -- operator on enum type var ENUM1; (function (ENUM1) { - ENUM1[ENUM1["1"] = 0] = "1"; - ENUM1[ENUM1["2"] = 1] = "2"; + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = {})); ; // expression -var ResultIsNumber1 = --ENUM1[1]; -var ResultIsNumber2 = ENUM1[1]--; +var ResultIsNumber1 = --ENUM1["A"]; +var ResultIsNumber2 = 0 /* A */--; // miss assignment operator ---ENUM1[1]; -ENUM1[1]--; +--ENUM1["A"]; +ENUM1[A]--; diff --git a/tests/baselines/reference/decrementOperatorWithEnumType.types b/tests/baselines/reference/decrementOperatorWithEnumType.types deleted file mode 100644 index fc670ddc6f7..00000000000 --- a/tests/baselines/reference/decrementOperatorWithEnumType.types +++ /dev/null @@ -1,30 +0,0 @@ -=== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts === -// -- operator on enum type - -enum ENUM1 { 1, 2, "" }; ->ENUM1 : ENUM1 - -// expression -var ResultIsNumber1 = --ENUM1[1]; ->ResultIsNumber1 : number ->--ENUM1[1] : number ->ENUM1[1] : ENUM1 ->ENUM1 : typeof ENUM1 - -var ResultIsNumber2 = ENUM1[1]--; ->ResultIsNumber2 : number ->ENUM1[1]-- : number ->ENUM1[1] : ENUM1 ->ENUM1 : typeof ENUM1 - -// miss assignment operator ---ENUM1[1]; ->--ENUM1[1] : number ->ENUM1[1] : ENUM1 ->ENUM1 : typeof ENUM1 - -ENUM1[1]--; ->ENUM1[1]-- : number ->ENUM1[1] : ENUM1 ->ENUM1 : typeof ENUM1 - diff --git a/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.errors.txt b/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.errors.txt index de547e5b70b..079bb2a6b64 100644 --- a/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.errors.txt @@ -1,43 +1,61 @@ -==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts (10 errors) ==== +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(7,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(8,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(10,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(11,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(14,25): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(14,43): error TS2339: Property 'B' does not exist on type 'typeof ENUM'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(15,23): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(15,29): error TS2339: Property 'A' does not exist on type 'typeof ENUM'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(18,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(19,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(21,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts(22,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts (12 errors) ==== // -- operator on enum type enum ENUM { }; - enum ENUM1 { 1, 2, "" }; + enum ENUM1 { A, B, "" }; // enum type var var ResultIsNumber1 = --ENUM; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber2 = --ENUM1; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber3 = ENUM--; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber4 = ENUM1--; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // enum type expressions - var ResultIsNumber5 = --(ENUM[1] + ENUM[2]); - ~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. - var ResultIsNumber6 = (ENUM[1] + ENUM[2])--; - ~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. + var ResultIsNumber5 = --(ENUM["A"] + ENUM.B); + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + ~ +!!! error TS2339: Property 'B' does not exist on type 'typeof ENUM'. + var ResultIsNumber6 = (ENUM.A + ENUM["B"])--; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + ~ +!!! error TS2339: Property 'A' does not exist on type 'typeof ENUM'. // miss assignment operator --ENUM; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --ENUM1; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ENUM--; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ENUM1--; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.js b/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.js index 410e3c144ef..66a1252cdd0 100644 --- a/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.js +++ b/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.js @@ -2,7 +2,7 @@ // -- operator on enum type enum ENUM { }; -enum ENUM1 { 1, 2, "" }; +enum ENUM1 { A, B, "" }; // enum type var var ResultIsNumber1 = --ENUM; @@ -12,8 +12,8 @@ var ResultIsNumber3 = ENUM--; var ResultIsNumber4 = ENUM1--; // enum type expressions -var ResultIsNumber5 = --(ENUM[1] + ENUM[2]); -var ResultIsNumber6 = (ENUM[1] + ENUM[2])--; +var ResultIsNumber5 = --(ENUM["A"] + ENUM.B); +var ResultIsNumber6 = (ENUM.A + ENUM["B"])--; // miss assignment operator --ENUM; @@ -30,8 +30,8 @@ var ENUM; ; var ENUM1; (function (ENUM1) { - ENUM1[ENUM1["1"] = 0] = "1"; - ENUM1[ENUM1["2"] = 1] = "2"; + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = {})); ; @@ -41,8 +41,8 @@ var ResultIsNumber2 = --ENUM1; var ResultIsNumber3 = ENUM--; var ResultIsNumber4 = ENUM1--; // enum type expressions -var ResultIsNumber5 = --(ENUM[1] + ENUM[2]); -var ResultIsNumber6 = (ENUM[1] + ENUM[2])--; +var ResultIsNumber5 = --(ENUM["A"] + ENUM.B); +var ResultIsNumber6 = (ENUM.A + ENUM["B"])--; // miss assignment operator --ENUM; --ENUM1; diff --git a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.errors.txt b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.errors.txt index ced764db19e..8df7e508099 100644 --- a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.errors.txt @@ -1,3 +1,25 @@ +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(18,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(19,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(22,25): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(23,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(24,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(26,23): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(27,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(28,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(31,25): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(32,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(33,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(35,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(36,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(37,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(40,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(41,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(42,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(44,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(45,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts(46,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + + ==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithNumberTypeInvalidOperations.ts (20 errors) ==== // -- operator on number type var NUMBER: number; @@ -18,70 +40,70 @@ //number type var var ResultIsNumber1 = --NUMBER1; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber2 = NUMBER1--; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // number type literal var ResultIsNumber3 = --1; ~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber4 = --{ x: 1, y: 2}; ~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber5 = --{ x: 1, y: (n: number) => { return n; } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber6 = 1--; ~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber7 = { x: 1, y: 2 }--; ~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }--; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // number type expressions var ResultIsNumber9 = --foo(); ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber10 = --A.foo(); ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber11 = --(NUMBER + NUMBER); ~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber12 = foo()--; ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber13 = A.foo()--; ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber14 = (NUMBER + NUMBER)--; ~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. // miss assignment operator --1; ~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --NUMBER1; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --foo(); ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. 1--; ~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. NUMBER1--; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. foo()--; ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.errors.txt b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.errors.txt index 3f986e98e10..cef6decd4ad 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.errors.txt @@ -1,3 +1,34 @@ +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(17,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(19,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(22,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(23,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(24,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(26,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(27,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(28,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(31,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(32,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(33,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(34,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(36,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(37,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(38,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(39,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(42,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(43,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(44,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(45,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(46,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(47,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(49,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(50,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(51,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(52,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(53,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(54,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts(54,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + ==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedBooleanType.ts (29 errors) ==== // -- operator on boolean type var BOOLEAN: boolean; @@ -17,97 +48,97 @@ // boolean type var var ResultIsNumber1 = --BOOLEAN; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber2 = BOOLEAN--; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // boolean type literal var ResultIsNumber3 = --true; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber4 = --{ x: true, y: false }; ~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber5 = --{ x: true, y: (n: boolean) => { return n; } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber6 = true--; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber7 = { x: true, y: false }--; ~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }--; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // boolean type expressions var ResultIsNumber9 = --objA.a; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber10 = --M.n; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber11 = --foo(); ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber12 = --A.foo(); ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber13 = foo()--; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber14 = A.foo()--; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber15 = objA.a--; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber16 = M.n--; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // miss assignment operators --true; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --BOOLEAN; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --foo(); ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --objA.a; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --M.n; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --objA.a, M.n; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. true--; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. BOOLEAN--; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. foo()--; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. objA.a--; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. M.n--; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. objA.a--, M.n--; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.errors.txt b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.errors.txt index 9ec8deb2081..7169155158c 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.errors.txt @@ -1,3 +1,44 @@ +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(18,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(19,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(21,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(22,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(25,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(26,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(27,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(29,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(30,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(31,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(34,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(35,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(36,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(37,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(38,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(39,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(41,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(42,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(43,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(44,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(45,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(46,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(49,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(50,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(51,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(52,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(53,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(54,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(55,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(56,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(58,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(59,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(60,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(61,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(62,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(63,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(64,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(65,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts(65,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + ==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithUnsupportedStringType.ts (39 errors) ==== // -- operator on string type var STRING: string; @@ -18,127 +59,127 @@ // string type var var ResultIsNumber1 = --STRING; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber2 = --STRING1; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber3 = STRING--; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber4 = STRING1--; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // string type literal var ResultIsNumber5 = --""; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber6 = --{ x: "", y: "" }; ~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber7 = --{ x: "", y: (s: string) => { return s; } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber8 = ""--; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber9 = { x: "", y: "" }--; ~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }--; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // string type expressions var ResultIsNumber11 = --objA.a; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber12 = --M.n; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber13 = --STRING1[0]; ~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber14 = --foo(); ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber15 = --A.foo(); ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber16 = --(STRING + STRING); ~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber17 = objA.a--; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber18 = M.n--; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber19 = STRING1[0]--; ~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber20 = foo()--; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber21 = A.foo()--; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber22 = (STRING + STRING)--; ~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // miss assignment operators --""; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --STRING; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --STRING1; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --STRING1[0]; ~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --foo(); ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --objA.a; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --M.n; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. --objA.a, M.n; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ""--; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. STRING--; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. STRING1--; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. STRING1[0]--; ~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. foo()--; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. objA.a--; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. M.n--; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. objA.a--, M.n--; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/defaultArgsForwardReferencing.errors.txt b/tests/baselines/reference/defaultArgsForwardReferencing.errors.txt index 2b8250f6fb4..d44594eb114 100644 --- a/tests/baselines/reference/defaultArgsForwardReferencing.errors.txt +++ b/tests/baselines/reference/defaultArgsForwardReferencing.errors.txt @@ -1,3 +1,15 @@ +tests/cases/compiler/defaultArgsForwardReferencing.ts(6,20): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +tests/cases/compiler/defaultArgsForwardReferencing.ts(11,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +tests/cases/compiler/defaultArgsForwardReferencing.ts(11,28): error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it. +tests/cases/compiler/defaultArgsForwardReferencing.ts(17,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +tests/cases/compiler/defaultArgsForwardReferencing.ts(23,25): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +tests/cases/compiler/defaultArgsForwardReferencing.ts(32,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +tests/cases/compiler/defaultArgsForwardReferencing.ts(33,16): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +tests/cases/compiler/defaultArgsForwardReferencing.ts(37,14): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +tests/cases/compiler/defaultArgsForwardReferencing.ts(37,21): error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it. +tests/cases/compiler/defaultArgsForwardReferencing.ts(37,28): error TS2373: Initializer of parameter 'c' cannot reference identifier 'd' declared after it. + + ==== tests/cases/compiler/defaultArgsForwardReferencing.ts (10 errors) ==== function left(a, b = a, c = b) { a; @@ -6,16 +18,16 @@ function right(a = b, b = a) { ~ -!!! Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. a; b; } function right2(a = b, b = c, c = a) { ~ -!!! Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. ~ -!!! Initializer of parameter 'b' cannot reference identifier 'c' declared after it. +!!! error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it. a; b; c; @@ -23,7 +35,7 @@ function inside(a = b) { ~ -!!! Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. var b; } @@ -31,7 +43,7 @@ var b; function inside(a = b) { // Still an error because b is declared inside the function ~ -!!! Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. var b; } } @@ -42,17 +54,17 @@ class C { constructor(a = b, b = 1) { } ~ -!!! Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. method(a = b, b = 1) { } ~ -!!! Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. } // Function expressions var x = (a = b, b = c, c = d) => { var d; }; ~ -!!! Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. ~ -!!! Initializer of parameter 'b' cannot reference identifier 'c' declared after it. +!!! error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it. ~ -!!! Initializer of parameter 'c' cannot reference identifier 'd' declared after it. \ No newline at end of file +!!! error TS2373: Initializer of parameter 'c' cannot reference identifier 'd' declared after it. \ No newline at end of file diff --git a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt index 7fb00da2b40..ff1f29a695d 100644 --- a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt +++ b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt @@ -1,38 +1,48 @@ +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,19): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(5,1): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(8,20): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(11,1): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(14,51): error TS2352: Neither type 'string' nor type 'number' is assignable to the other. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(17,41): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(20,62): error TS2352: Neither type 'string' nor type 'number' is assignable to the other. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2304: Cannot find name 'T'. + + ==== tests/cases/compiler/defaultArgsInFunctionExpressions.ts (8 errors) ==== var f = function (a = 3) { return a; }; // Type should be (a?: number) => number var n: number = f(4); n = f(); var s: string = f(''); ~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. s = f(); ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. // Type check the default argument with the type annotation var f2 = function (a: string = 3) { return a; }; // Should error, but be of type (a: string) => string; ~~~~~~~~~~~~~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. s = f2(''); s = f2(); n = f2(); ~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. // Contextually type the default arg with the type annotation var f3 = function (a: (s: string) => any = (s) => s) { }; ~~~~~~~~~ -!!! Neither type 'string' nor type 'number' is assignable to the other. +!!! error TS2352: Neither type 'string' nor type 'number' is assignable to the other. // Type check using the function's contextual type var f4: (a: number) => void = function (a = "") { }; ~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. // Contextually type the default arg using the function's contextual type var f5: (a: (s: string) => any) => void = function (a = s => s) { }; ~~~~~~~~~ -!!! Neither type 'string' nor type 'number' is assignable to the other. +!!! error TS2352: Neither type 'string' nor type 'number' is assignable to the other. // Instantiated module module T { } @@ -42,7 +52,7 @@ var f6 = (t = T) => { }; ~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. var f7 = (t = U) => { return t; }; f7().x; \ No newline at end of file diff --git a/tests/baselines/reference/defaultArgsInOverloads.errors.txt b/tests/baselines/reference/defaultArgsInOverloads.errors.txt index 93f88560520..600c642c1f3 100644 --- a/tests/baselines/reference/defaultArgsInOverloads.errors.txt +++ b/tests/baselines/reference/defaultArgsInOverloads.errors.txt @@ -1,20 +1,27 @@ +tests/cases/compiler/defaultArgsInOverloads.ts(2,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/compiler/defaultArgsInOverloads.ts(7,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/compiler/defaultArgsInOverloads.ts(10,13): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/compiler/defaultArgsInOverloads.ts(16,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/compiler/defaultArgsInOverloads.ts(19,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + + ==== tests/cases/compiler/defaultArgsInOverloads.ts (5 errors) ==== function fun(a: string); function fun(a = 3); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. function fun(a = null) { } class C { fun(a: string); fun(a = 3); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. fun(a = null) { } static fun(a: string); static fun(a = 3); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. static fun(a = null) { } } @@ -22,9 +29,9 @@ fun(a: string); fun(a = 3); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. } var f: (a = 3) => number; ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. \ No newline at end of file +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. \ No newline at end of file diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt index df98b965347..21296783f28 100644 --- a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt +++ b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt @@ -1,26 +1,27 @@ +tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(2,6): error TS2339: Property 'length' does not exist on type '{}'. +tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(5,6): error TS2339: Property 'length' does not exist on type 'Object'. +tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,14): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts (3 errors) ==== - var obj1: {}; - obj1.length; ~~~~~~ -!!! Property 'length' does not exist on type '{}'. - - +!!! error TS2339: Property 'length' does not exist on type '{}'. var obj2: Object; - obj2.length; ~~~~~~ -!!! Property 'length' does not exist on type 'Object'. - - +!!! error TS2339: Property 'length' does not exist on type 'Object'. function concat(x: T, y: T): T { return null; } + var result = concat(1, ""); // error + ~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var elementCount = result.length; - var result = concat(1, ""); + function concat2(x: T, y: U) { return null; } + var result2 = concat2(1, ""); // result2 will be number|string + var elementCount2 = result.length; - var elementCount = result.length; // would like to get an error by now - ~~~~~~ -!!! Property 'length' does not exist on type '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js index 59935cc53af..98e135cc712 100644 --- a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js +++ b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js @@ -1,22 +1,18 @@ //// [defaultBestCommonTypesHaveDecls.ts] - var obj1: {}; - obj1.length; - - var obj2: Object; - obj2.length; - - function concat(x: T, y: T): T { return null; } +var result = concat(1, ""); // error +var elementCount = result.length; -var result = concat(1, ""); +function concat2(x: T, y: U) { return null; } +var result2 = concat2(1, ""); // result2 will be number|string +var elementCount2 = result.length; -var elementCount = result.length; // would like to get an error by now //// [defaultBestCommonTypesHaveDecls.js] @@ -27,5 +23,10 @@ obj2.length; function concat(x, y) { return null; } -var result = concat(1, ""); -var elementCount = result.length; // would like to get an error by now +var result = concat(1, ""); // error +var elementCount = result.length; +function concat2(x, y) { + return null; +} +var result2 = concat2(1, ""); // result2 will be number|string +var elementCount2 = result.length; diff --git a/tests/baselines/reference/defaultValueInConstructorOverload1.errors.txt b/tests/baselines/reference/defaultValueInConstructorOverload1.errors.txt index c762d0919d9..1b399ef79fd 100644 --- a/tests/baselines/reference/defaultValueInConstructorOverload1.errors.txt +++ b/tests/baselines/reference/defaultValueInConstructorOverload1.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/defaultValueInConstructorOverload1.ts(2,17): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + + ==== tests/cases/compiler/defaultValueInConstructorOverload1.ts (1 errors) ==== class C { constructor(x = ''); ~~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. constructor(x = '') { } } \ No newline at end of file diff --git a/tests/baselines/reference/defaultValueInFunctionOverload1.errors.txt b/tests/baselines/reference/defaultValueInFunctionOverload1.errors.txt index 283e287e9da..2bb41299e38 100644 --- a/tests/baselines/reference/defaultValueInFunctionOverload1.errors.txt +++ b/tests/baselines/reference/defaultValueInFunctionOverload1.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/defaultValueInFunctionOverload1.ts(1,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + + ==== tests/cases/compiler/defaultValueInFunctionOverload1.ts (1 errors) ==== function foo(x: string = ''); ~~~~~~~~~~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. function foo(x = '') { } \ No newline at end of file diff --git a/tests/baselines/reference/defaultValueInFunctionTypes.errors.txt b/tests/baselines/reference/defaultValueInFunctionTypes.errors.txt index 22a0c718c7c..01a807b3e7d 100644 --- a/tests/baselines/reference/defaultValueInFunctionTypes.errors.txt +++ b/tests/baselines/reference/defaultValueInFunctionTypes.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/defaultValueInFunctionTypes.ts(1,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + + ==== tests/cases/compiler/defaultValueInFunctionTypes.ts (1 errors) ==== var x: (a: number = 1) => number; ~~~~~~~~~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. var y = <(a : string = "") => any>(undefined) \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperator1.errors.txt b/tests/baselines/reference/deleteOperator1.errors.txt index 7a80456b21e..095d4c37100 100644 --- a/tests/baselines/reference/deleteOperator1.errors.txt +++ b/tests/baselines/reference/deleteOperator1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/deleteOperator1.ts(4,5): error TS2323: Type 'boolean' is not assignable to type 'number'. + + ==== tests/cases/compiler/deleteOperator1.ts (1 errors) ==== var a; var x: boolean = delete a; var y: any = delete a; var z: number = delete a; ~ -!!! Type 'boolean' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2323: Type 'boolean' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt b/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt new file mode 100644 index 00000000000..5952d8b8296 --- /dev/null +++ b/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. + + +==== tests/cases/compiler/deleteOperatorInStrictMode.ts (1 errors) ==== + "use strict" + var a; + delete a; + ~ +!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt b/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt index 89980ef9bc0..5f7c6d70450 100644 --- a/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,20): error TS1005: ',' expected. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,27): error TS1109: Expression expected. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(8,23): error TS1109: Expression expected. + + ==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts (3 errors) ==== // Unary operator delete var ANY; @@ -5,14 +10,14 @@ // operand before delete operator var BOOLEAN1 = ANY delete ; //expect error ~~~~~~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. // miss an operand var BOOLEAN2 = delete ; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. // delete global variable s class testADelx { diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt index 18382a6f453..73ddab1a33c 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + + ==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (3 errors) ==== // delete operator on any type @@ -45,13 +50,13 @@ var ResultIsBoolean16 = delete (ANY + ANY1); var ResultIsBoolean17 = delete (null + undefined); ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsBoolean18 = delete (null + null); ~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var ResultIsBoolean19 = delete (undefined + undefined); ~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. // multiple delete operators var ResultIsBoolean20 = delete delete ANY; diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.js b/tests/baselines/reference/deleteOperatorWithEnumType.js index d7fd9c95ee8..e694790091c 100644 --- a/tests/baselines/reference/deleteOperatorWithEnumType.js +++ b/tests/baselines/reference/deleteOperatorWithEnumType.js @@ -2,24 +2,24 @@ // delete operator on enum type enum ENUM { }; -enum ENUM1 { 1, 2, "" }; +enum ENUM1 { A, B, "" }; // enum type var var ResultIsBoolean1 = delete ENUM; var ResultIsBoolean2 = delete ENUM1; // enum type expressions -var ResultIsBoolean3 = delete ENUM1[0]; -var ResultIsBoolean4 = delete (ENUM[0] + ENUM1[1]); +var ResultIsBoolean3 = delete ENUM1["A"]; +var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); // multiple delete operators var ResultIsBoolean5 = delete delete ENUM; -var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1[1]); +var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); // miss assignment operators delete ENUM; delete ENUM1; -delete ENUM1[1]; +delete ENUM1.B; delete ENUM, ENUM1; //// [deleteOperatorWithEnumType.js] @@ -30,8 +30,8 @@ var ENUM; ; var ENUM1; (function (ENUM1) { - ENUM1[ENUM1["1"] = 0] = "1"; - ENUM1[ENUM1["2"] = 1] = "2"; + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = {})); ; @@ -39,13 +39,13 @@ var ENUM1; var ResultIsBoolean1 = delete ENUM; var ResultIsBoolean2 = delete ENUM1; // enum type expressions -var ResultIsBoolean3 = delete ENUM1[0]; -var ResultIsBoolean4 = delete (ENUM[0] + ENUM1[1]); +var ResultIsBoolean3 = delete ENUM1["A"]; +var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); // multiple delete operators var ResultIsBoolean5 = delete delete ENUM; -var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1[1]); +var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); // miss assignment operators delete ENUM; delete ENUM1; -delete ENUM1[1]; +delete 1 /* B */; delete ENUM, ENUM1; diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.types b/tests/baselines/reference/deleteOperatorWithEnumType.types index d356693616f..e436ac3373f 100644 --- a/tests/baselines/reference/deleteOperatorWithEnumType.types +++ b/tests/baselines/reference/deleteOperatorWithEnumType.types @@ -4,8 +4,10 @@ enum ENUM { }; >ENUM : ENUM -enum ENUM1 { 1, 2, "" }; +enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 +>A : ENUM1 +>B : ENUM1 // enum type var var ResultIsBoolean1 = delete ENUM; @@ -19,20 +21,20 @@ var ResultIsBoolean2 = delete ENUM1; >ENUM1 : typeof ENUM1 // enum type expressions -var ResultIsBoolean3 = delete ENUM1[0]; +var ResultIsBoolean3 = delete ENUM1["A"]; >ResultIsBoolean3 : boolean ->delete ENUM1[0] : boolean ->ENUM1[0] : string +>delete ENUM1["A"] : boolean +>ENUM1["A"] : ENUM1 >ENUM1 : typeof ENUM1 -var ResultIsBoolean4 = delete (ENUM[0] + ENUM1[1]); +var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); >ResultIsBoolean4 : boolean ->delete (ENUM[0] + ENUM1[1]) : boolean ->(ENUM[0] + ENUM1[1]) : string ->ENUM[0] + ENUM1[1] : string +>delete (ENUM[0] + ENUM1["B"]) : boolean +>(ENUM[0] + ENUM1["B"]) : string +>ENUM[0] + ENUM1["B"] : string >ENUM[0] : string >ENUM : typeof ENUM ->ENUM1[1] : ENUM1 +>ENUM1["B"] : ENUM1 >ENUM1 : typeof ENUM1 // multiple delete operators @@ -42,16 +44,16 @@ var ResultIsBoolean5 = delete delete ENUM; >delete ENUM : boolean >ENUM : typeof ENUM -var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1[1]); +var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); >ResultIsBoolean6 : boolean ->delete delete delete (ENUM[0] + ENUM1[1]) : boolean ->delete delete (ENUM[0] + ENUM1[1]) : boolean ->delete (ENUM[0] + ENUM1[1]) : boolean ->(ENUM[0] + ENUM1[1]) : string ->ENUM[0] + ENUM1[1] : string +>delete delete delete (ENUM[0] + ENUM1["B"]) : boolean +>delete delete (ENUM[0] + ENUM1["B"]) : boolean +>delete (ENUM[0] + ENUM1["B"]) : boolean +>(ENUM[0] + ENUM1["B"]) : string +>ENUM[0] + ENUM1["B"] : string >ENUM[0] : string >ENUM : typeof ENUM ->ENUM1[1] : ENUM1 +>ENUM1["B"] : ENUM1 >ENUM1 : typeof ENUM1 // miss assignment operators @@ -63,10 +65,11 @@ delete ENUM1; >delete ENUM1 : boolean >ENUM1 : typeof ENUM1 -delete ENUM1[1]; ->delete ENUM1[1] : boolean ->ENUM1[1] : ENUM1 +delete ENUM1.B; +>delete ENUM1.B : boolean +>ENUM1.B : ENUM1 >ENUM1 : typeof ENUM1 +>B : ENUM1 delete ENUM, ENUM1; >delete ENUM, ENUM1 : typeof ENUM1 diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.errors.txt b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.errors.txt index 363892227ff..40610b5b838 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.errors.txt +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.errors.txt @@ -1,3 +1,10 @@ +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(8,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(17,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(18,24): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(23,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts(24,31): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + + ==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassConstructorWithoutSuperCall.ts (5 errors) ==== // derived class constructors must contain a super call @@ -10,7 +17,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! Constructors for derived classes must contain a 'super' call. +!!! error TS2377: Constructors for derived classes must contain a 'super' call. } class Base2 { @@ -23,10 +30,10 @@ var r2 = () => super(); // error for misplaced super call (nested function) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors } ~~~~~ -!!! Constructors for derived classes must contain a 'super' call. +!!! error TS2377: Constructors for derived classes must contain a 'super' call. } class Derived3 extends Base2 { @@ -35,10 +42,10 @@ var r = function () { super() } // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors } ~~~~~ -!!! Constructors for derived classes must contain a 'super' call. +!!! error TS2377: Constructors for derived classes must contain a 'super' call. } class Derived4 extends Base2 { diff --git a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.errors.txt b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.errors.txt index 35b6ca92c18..994dead5904 100644 --- a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.errors.txt +++ b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.errors.txt @@ -1,25 +1,33 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassFunctionOverridesBaseClassAccessor.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassFunctionOverridesBaseClassAccessor.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassFunctionOverridesBaseClassAccessor.ts(10,7): error TS2416: Class 'Derived' incorrectly extends base class 'Base': + Types of property 'x' are incompatible: + Type '() => number' is not assignable to type 'number'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassFunctionOverridesBaseClassAccessor.ts(11,5): error TS2426: Class 'Base' defines instance member accessor 'x', but extended class 'Derived' defines it as instance member function. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassFunctionOverridesBaseClassAccessor.ts (4 errors) ==== class Base { get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 1; } set x(v) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } // error class Derived extends Base { ~~~~~~~ -!!! Class 'Derived' incorrectly extends base class 'Base': -!!! Types of property 'x' are incompatible: -!!! Type '() => number' is not assignable to type 'number'. +!!! error TS2416: Class 'Derived' incorrectly extends base class 'Base': +!!! error TS2416: Types of property 'x' are incompatible: +!!! error TS2416: Type '() => number' is not assignable to type 'number'. x() { ~ -!!! Class 'Base' defines instance member accessor 'x', but extended class 'Derived' defines it as instance member function. +!!! error TS2426: Class 'Base' defines instance member accessor 'x', but extended class 'Derived' defines it as instance member function. return 1; } } \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.errors.txt b/tests/baselines/reference/derivedClassIncludesInheritedMembers.errors.txt index 307aad8dd2e..f8e52d3e575 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.errors.txt +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.errors.txt @@ -1,22 +1,28 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassIncludesInheritedMembers.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassIncludesInheritedMembers.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassIncludesInheritedMembers.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassIncludesInheritedMembers.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassIncludesInheritedMembers.ts (4 errors) ==== class Base { a: string; b() { } get c() { return ''; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. set c(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static r: string; static s() { } static get t() { return ''; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static set t(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. constructor(x) { } } diff --git a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.errors.txt b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.errors.txt index 3eb2f197ca0..ce9ec20406c 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.errors.txt +++ b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/derivedClassOverridesPrivateFunction1.ts(8,7): error TS2416: Class 'DerivedClass' incorrectly extends base class 'BaseClass': + Types have separate declarations of a private property '_init'. + + ==== tests/cases/compiler/derivedClassOverridesPrivateFunction1.ts (1 errors) ==== class BaseClass { constructor() { @@ -8,8 +12,8 @@ } class DerivedClass extends BaseClass { ~~~~~~~~~~~~ -!!! Class 'DerivedClass' incorrectly extends base class 'BaseClass': -!!! Private property '_init' cannot be reimplemented. +!!! error TS2416: Class 'DerivedClass' incorrectly extends base class 'BaseClass': +!!! error TS2416: Types have separate declarations of a private property '_init'. constructor() { super(); } diff --git a/tests/baselines/reference/derivedClassOverridesPrivates.errors.txt b/tests/baselines/reference/derivedClassOverridesPrivates.errors.txt index c6d8f230589..9e83faa9b4a 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivates.errors.txt +++ b/tests/baselines/reference/derivedClassOverridesPrivates.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPrivates.ts(5,7): error TS2416: Class 'Derived' incorrectly extends base class 'Base': + Types have separate declarations of a private property 'x'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPrivates.ts(13,7): error TS2418: Class static side 'typeof Derived2' incorrectly extends base class static side 'typeof Base2': + Types have separate declarations of a private property 'y'. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPrivates.ts (2 errors) ==== class Base { private x: { foo: string }; @@ -5,8 +11,8 @@ class Derived extends Base { ~~~~~~~ -!!! Class 'Derived' incorrectly extends base class 'Base': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2416: Class 'Derived' incorrectly extends base class 'Base': +!!! error TS2416: Types have separate declarations of a private property 'x'. private x: { foo: string; bar: string; }; // error } @@ -16,7 +22,7 @@ class Derived2 extends Base2 { ~~~~~~~~ -!!! Class static side 'typeof Derived2' incorrectly extends base class static side 'typeof Base2': -!!! Private property 'y' cannot be reimplemented. +!!! error TS2418: Class static side 'typeof Derived2' incorrectly extends base class static side 'typeof Base2': +!!! error TS2418: Types have separate declarations of a private property 'y'. private static y: { foo: string; bar: string; }; // error } \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js new file mode 100644 index 00000000000..8c8b6a13c7e --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -0,0 +1,103 @@ +//// [derivedClassOverridesProtectedMembers.ts] + +var x: { foo: string; } +var y: { foo: string; bar: string; } + +class Base { + protected a: typeof x; + protected b(a: typeof x) { } + protected get c() { return x; } + protected set c(v: typeof x) { } + protected d: (a: typeof x) => void; + + protected static r: typeof x; + protected static s(a: typeof x) { } + protected static get t() { return x; } + protected static set t(v: typeof x) { } + protected static u: (a: typeof x) => void; + + constructor(a: typeof x) { } +} + +class Derived extends Base { + protected a: typeof y; + protected b(a: typeof y) { } + protected get c() { return y; } + protected set c(v: typeof y) { } + protected d: (a: typeof y) => void; + + protected static r: typeof y; + protected static s(a: typeof y) { } + protected static get t() { return y; } + protected static set t(a: typeof y) { } + protected static u: (a: typeof y) => void; + + constructor(a: typeof y) { super(x) } +} + + +//// [derivedClassOverridesProtectedMembers.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var x; +var y; +var Base = (function () { + function Base(a) { + } + Base.prototype.b = function (a) { + }; + Object.defineProperty(Base.prototype, "c", { + get: function () { + return x; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Base.s = function (a) { + }; + Object.defineProperty(Base, "t", { + get: function () { + return x; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Base; +})(); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived(a) { + _super.call(this, x); + } + Derived.prototype.b = function (a) { + }; + Object.defineProperty(Derived.prototype, "c", { + get: function () { + return y; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Derived.s = function (a) { + }; + Object.defineProperty(Derived, "t", { + get: function () { + return y; + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return Derived; +})(Base); diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.types b/tests/baselines/reference/derivedClassOverridesProtectedMembers.types new file mode 100644 index 00000000000..2695cbabe34 --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.types @@ -0,0 +1,123 @@ +=== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers.ts === + +var x: { foo: string; } +>x : { foo: string; } +>foo : string + +var y: { foo: string; bar: string; } +>y : { foo: string; bar: string; } +>foo : string +>bar : string + +class Base { +>Base : Base + + protected a: typeof x; +>a : { foo: string; } +>x : { foo: string; } + + protected b(a: typeof x) { } +>b : (a: { foo: string; }) => void +>a : { foo: string; } +>x : { foo: string; } + + protected get c() { return x; } +>c : { foo: string; } +>x : { foo: string; } + + protected set c(v: typeof x) { } +>c : { foo: string; } +>v : { foo: string; } +>x : { foo: string; } + + protected d: (a: typeof x) => void; +>d : (a: { foo: string; }) => void +>a : { foo: string; } +>x : { foo: string; } + + protected static r: typeof x; +>r : { foo: string; } +>x : { foo: string; } + + protected static s(a: typeof x) { } +>s : (a: { foo: string; }) => void +>a : { foo: string; } +>x : { foo: string; } + + protected static get t() { return x; } +>t : { foo: string; } +>x : { foo: string; } + + protected static set t(v: typeof x) { } +>t : { foo: string; } +>v : { foo: string; } +>x : { foo: string; } + + protected static u: (a: typeof x) => void; +>u : (a: { foo: string; }) => void +>a : { foo: string; } +>x : { foo: string; } + + constructor(a: typeof x) { } +>a : { foo: string; } +>x : { foo: string; } +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + protected a: typeof y; +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + protected b(a: typeof y) { } +>b : (a: { foo: string; bar: string; }) => void +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + protected get c() { return y; } +>c : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + protected set c(v: typeof y) { } +>c : { foo: string; bar: string; } +>v : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + protected d: (a: typeof y) => void; +>d : (a: { foo: string; bar: string; }) => void +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + protected static r: typeof y; +>r : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + protected static s(a: typeof y) { } +>s : (a: { foo: string; bar: string; }) => void +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + protected static get t() { return y; } +>t : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + protected static set t(a: typeof y) { } +>t : { foo: string; bar: string; } +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + protected static u: (a: typeof y) => void; +>u : (a: { foo: string; bar: string; }) => void +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + constructor(a: typeof y) { super(x) } +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } +>super(x) : void +>super : typeof Base +>x : { foo: string; } +} + diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js new file mode 100644 index 00000000000..55bfd0e924d --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -0,0 +1,157 @@ +//// [derivedClassOverridesProtectedMembers2.ts] +var x: { foo: string; } +var y: { foo: string; bar: string; } + +class Base { + protected a: typeof x; + protected b(a: typeof x) { } + protected get c() { return x; } + protected set c(v: typeof x) { } + protected d: (a: typeof x) => void ; + + protected static r: typeof x; + protected static s(a: typeof x) { } + protected static get t() { return x; } + protected static set t(v: typeof x) { } + protected static u: (a: typeof x) => void ; + +constructor(a: typeof x) { } +} + +// Increase visibility of all protected members to public +class Derived extends Base { + a: typeof y; + b(a: typeof y) { } + get c() { return y; } + set c(v: typeof y) { } + d: (a: typeof y) => void; + + static r: typeof y; + static s(a: typeof y) { } + static get t() { return y; } + static set t(a: typeof y) { } + static u: (a: typeof y) => void; + + constructor(a: typeof y) { super(a); } +} + +var d: Derived = new Derived(y); +var r1 = d.a; +var r2 = d.b(y); +var r3 = d.c; +var r3a = d.d; +d.c = y; +var r4 = Derived.r; +var r5 = Derived.s(y); +var r6 = Derived.t; +var r6a = Derived.u; +Derived.t = y; + +class Base2 { + [i: string]: Object; + [i: number]: typeof x; +} + +class Derived2 extends Base2 { + [i: string]: typeof x; + [i: number]: typeof y; +} + +var d2: Derived2; +var r7 = d2['']; +var r8 = d2[1]; + + + +//// [derivedClassOverridesProtectedMembers2.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var x; +var y; +var Base = (function () { + function Base(a) { + } + Base.prototype.b = function (a) { + }; + Object.defineProperty(Base.prototype, "c", { + get: function () { + return x; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Base.s = function (a) { + }; + Object.defineProperty(Base, "t", { + get: function () { + return x; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Base; +})(); +// Increase visibility of all protected members to public +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived(a) { + _super.call(this, a); + } + Derived.prototype.b = function (a) { + }; + Object.defineProperty(Derived.prototype, "c", { + get: function () { + return y; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Derived.s = function (a) { + }; + Object.defineProperty(Derived, "t", { + get: function () { + return y; + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return Derived; +})(Base); +var d = new Derived(y); +var r1 = d.a; +var r2 = d.b(y); +var r3 = d.c; +var r3a = d.d; +d.c = y; +var r4 = Derived.r; +var r5 = Derived.s(y); +var r6 = Derived.t; +var r6a = Derived.u; +Derived.t = y; +var Base2 = (function () { + function Base2() { + } + return Base2; +})(); +var Derived2 = (function (_super) { + __extends(Derived2, _super); + function Derived2() { + _super.apply(this, arguments); + } + return Derived2; +})(Base2); +var d2; +var r7 = d2['']; +var r8 = d2[1]; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.types b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.types new file mode 100644 index 00000000000..3b6eb55256e --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.types @@ -0,0 +1,236 @@ +=== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers2.ts === +var x: { foo: string; } +>x : { foo: string; } +>foo : string + +var y: { foo: string; bar: string; } +>y : { foo: string; bar: string; } +>foo : string +>bar : string + +class Base { +>Base : Base + + protected a: typeof x; +>a : { foo: string; } +>x : { foo: string; } + + protected b(a: typeof x) { } +>b : (a: { foo: string; }) => void +>a : { foo: string; } +>x : { foo: string; } + + protected get c() { return x; } +>c : { foo: string; } +>x : { foo: string; } + + protected set c(v: typeof x) { } +>c : { foo: string; } +>v : { foo: string; } +>x : { foo: string; } + + protected d: (a: typeof x) => void ; +>d : (a: { foo: string; }) => void +>a : { foo: string; } +>x : { foo: string; } + + protected static r: typeof x; +>r : { foo: string; } +>x : { foo: string; } + + protected static s(a: typeof x) { } +>s : (a: { foo: string; }) => void +>a : { foo: string; } +>x : { foo: string; } + + protected static get t() { return x; } +>t : { foo: string; } +>x : { foo: string; } + + protected static set t(v: typeof x) { } +>t : { foo: string; } +>v : { foo: string; } +>x : { foo: string; } + + protected static u: (a: typeof x) => void ; +>u : (a: { foo: string; }) => void +>a : { foo: string; } +>x : { foo: string; } + +constructor(a: typeof x) { } +>a : { foo: string; } +>x : { foo: string; } +} + +// Increase visibility of all protected members to public +class Derived extends Base { +>Derived : Derived +>Base : Base + + a: typeof y; +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + b(a: typeof y) { } +>b : (a: { foo: string; bar: string; }) => void +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + get c() { return y; } +>c : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + set c(v: typeof y) { } +>c : { foo: string; bar: string; } +>v : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + d: (a: typeof y) => void; +>d : (a: { foo: string; bar: string; }) => void +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + static r: typeof y; +>r : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + static s(a: typeof y) { } +>s : (a: { foo: string; bar: string; }) => void +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + static get t() { return y; } +>t : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + static set t(a: typeof y) { } +>t : { foo: string; bar: string; } +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + static u: (a: typeof y) => void; +>u : (a: { foo: string; bar: string; }) => void +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + + constructor(a: typeof y) { super(a); } +>a : { foo: string; bar: string; } +>y : { foo: string; bar: string; } +>super(a) : void +>super : typeof Base +>a : { foo: string; bar: string; } +} + +var d: Derived = new Derived(y); +>d : Derived +>Derived : Derived +>new Derived(y) : Derived +>Derived : typeof Derived +>y : { foo: string; bar: string; } + +var r1 = d.a; +>r1 : { foo: string; bar: string; } +>d.a : { foo: string; bar: string; } +>d : Derived +>a : { foo: string; bar: string; } + +var r2 = d.b(y); +>r2 : void +>d.b(y) : void +>d.b : (a: { foo: string; bar: string; }) => void +>d : Derived +>b : (a: { foo: string; bar: string; }) => void +>y : { foo: string; bar: string; } + +var r3 = d.c; +>r3 : { foo: string; bar: string; } +>d.c : { foo: string; bar: string; } +>d : Derived +>c : { foo: string; bar: string; } + +var r3a = d.d; +>r3a : (a: { foo: string; bar: string; }) => void +>d.d : (a: { foo: string; bar: string; }) => void +>d : Derived +>d : (a: { foo: string; bar: string; }) => void + +d.c = y; +>d.c = y : { foo: string; bar: string; } +>d.c : { foo: string; bar: string; } +>d : Derived +>c : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + +var r4 = Derived.r; +>r4 : { foo: string; bar: string; } +>Derived.r : { foo: string; bar: string; } +>Derived : typeof Derived +>r : { foo: string; bar: string; } + +var r5 = Derived.s(y); +>r5 : void +>Derived.s(y) : void +>Derived.s : (a: { foo: string; bar: string; }) => void +>Derived : typeof Derived +>s : (a: { foo: string; bar: string; }) => void +>y : { foo: string; bar: string; } + +var r6 = Derived.t; +>r6 : { foo: string; bar: string; } +>Derived.t : { foo: string; bar: string; } +>Derived : typeof Derived +>t : { foo: string; bar: string; } + +var r6a = Derived.u; +>r6a : (a: { foo: string; bar: string; }) => void +>Derived.u : (a: { foo: string; bar: string; }) => void +>Derived : typeof Derived +>u : (a: { foo: string; bar: string; }) => void + +Derived.t = y; +>Derived.t = y : { foo: string; bar: string; } +>Derived.t : { foo: string; bar: string; } +>Derived : typeof Derived +>t : { foo: string; bar: string; } +>y : { foo: string; bar: string; } + +class Base2 { +>Base2 : Base2 + + [i: string]: Object; +>i : string +>Object : Object + + [i: number]: typeof x; +>i : number +>x : { foo: string; } +} + +class Derived2 extends Base2 { +>Derived2 : Derived2 +>Base2 : Base2 + + [i: string]: typeof x; +>i : string +>x : { foo: string; } + + [i: number]: typeof y; +>i : number +>y : { foo: string; bar: string; } +} + +var d2: Derived2; +>d2 : Derived2 +>Derived2 : Derived2 + +var r7 = d2['']; +>r7 : { foo: string; } +>d2[''] : { foo: string; } +>d2 : Derived2 + +var r8 = d2[1]; +>r8 : { foo: string; bar: string; } +>d2[1] : { foo: string; bar: string; } +>d2 : Derived2 + + diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.errors.txt b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.errors.txt new file mode 100644 index 00000000000..7dddd4d76f8 --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.errors.txt @@ -0,0 +1,124 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts(23,7): error TS2416: Class 'Derived1' incorrectly extends base class 'Base': + Property 'a' is protected in type 'Derived1' but public in type 'Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts(28,7): error TS2416: Class 'Derived2' incorrectly extends base class 'Base': + Property 'b' is protected in type 'Derived2' but public in type 'Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts(33,7): error TS2416: Class 'Derived3' incorrectly extends base class 'Base': + Property 'c' is protected in type 'Derived3' but public in type 'Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts(38,7): error TS2416: Class 'Derived4' incorrectly extends base class 'Base': + Property 'c' is protected in type 'Derived4' but public in type 'Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts(43,7): error TS2416: Class 'Derived5' incorrectly extends base class 'Base': + Property 'd' is protected in type 'Derived5' but public in type 'Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts(48,7): error TS2418: Class static side 'typeof Derived6' incorrectly extends base class static side 'typeof Base': + Property 'r' is protected in type 'typeof Derived6' but public in type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts(53,7): error TS2418: Class static side 'typeof Derived7' incorrectly extends base class static side 'typeof Base': + Property 's' is protected in type 'typeof Derived7' but public in type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts(58,7): error TS2418: Class static side 'typeof Derived8' incorrectly extends base class static side 'typeof Base': + Property 't' is protected in type 'typeof Derived8' but public in type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts(63,7): error TS2418: Class static side 'typeof Derived9' incorrectly extends base class static side 'typeof Base': + Property 't' is protected in type 'typeof Derived9' but public in type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts(68,7): error TS2418: Class static side 'typeof Derived10' incorrectly extends base class static side 'typeof Base': + Property 'u' is protected in type 'typeof Derived10' but public in type 'typeof Base'. + + +==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers3.ts (10 errors) ==== + + var x: { foo: string; } + var y: { foo: string; bar: string; } + + class Base { + a: typeof x; + b(a: typeof x) { } + get c() { return x; } + set c(v: typeof x) { } + d: (a: typeof x) => void; + + static r: typeof x; + static s(a: typeof x) { } + static get t() { return x; } + static set t(v: typeof x) { } + static u: (a: typeof x) => void; + + constructor(a: typeof x) {} + } + + // Errors + // decrease visibility of all public members to protected + class Derived1 extends Base { + ~~~~~~~~ +!!! error TS2416: Class 'Derived1' incorrectly extends base class 'Base': +!!! error TS2416: Property 'a' is protected in type 'Derived1' but public in type 'Base'. + protected a: typeof x; + constructor(a: typeof x) { super(a); } + } + + class Derived2 extends Base { + ~~~~~~~~ +!!! error TS2416: Class 'Derived2' incorrectly extends base class 'Base': +!!! error TS2416: Property 'b' is protected in type 'Derived2' but public in type 'Base'. + protected b(a: typeof x) { } + constructor(a: typeof x) { super(a); } + } + + class Derived3 extends Base { + ~~~~~~~~ +!!! error TS2416: Class 'Derived3' incorrectly extends base class 'Base': +!!! error TS2416: Property 'c' is protected in type 'Derived3' but public in type 'Base'. + protected get c() { return x; } + constructor(a: typeof x) { super(a); } + } + + class Derived4 extends Base { + ~~~~~~~~ +!!! error TS2416: Class 'Derived4' incorrectly extends base class 'Base': +!!! error TS2416: Property 'c' is protected in type 'Derived4' but public in type 'Base'. + protected set c(v: typeof x) { } + constructor(a: typeof x) { super(a); } + } + + class Derived5 extends Base { + ~~~~~~~~ +!!! error TS2416: Class 'Derived5' incorrectly extends base class 'Base': +!!! error TS2416: Property 'd' is protected in type 'Derived5' but public in type 'Base'. + protected d: (a: typeof x) => void ; + constructor(a: typeof x) { super(a); } + } + + class Derived6 extends Base { + ~~~~~~~~ +!!! error TS2418: Class static side 'typeof Derived6' incorrectly extends base class static side 'typeof Base': +!!! error TS2418: Property 'r' is protected in type 'typeof Derived6' but public in type 'typeof Base'. + protected static r: typeof x; + constructor(a: typeof x) { super(a); } + } + + class Derived7 extends Base { + ~~~~~~~~ +!!! error TS2418: Class static side 'typeof Derived7' incorrectly extends base class static side 'typeof Base': +!!! error TS2418: Property 's' is protected in type 'typeof Derived7' but public in type 'typeof Base'. + protected static s(a: typeof x) { } + constructor(a: typeof x) { super(a); } + } + + class Derived8 extends Base { + ~~~~~~~~ +!!! error TS2418: Class static side 'typeof Derived8' incorrectly extends base class static side 'typeof Base': +!!! error TS2418: Property 't' is protected in type 'typeof Derived8' but public in type 'typeof Base'. + protected static get t() { return x; } + constructor(a: typeof x) { super(a); } + } + + class Derived9 extends Base { + ~~~~~~~~ +!!! error TS2418: Class static side 'typeof Derived9' incorrectly extends base class static side 'typeof Base': +!!! error TS2418: Property 't' is protected in type 'typeof Derived9' but public in type 'typeof Base'. + protected static set t(v: typeof x) { } + constructor(a: typeof x) { super(a); } + } + + class Derived10 extends Base { + ~~~~~~~~~ +!!! error TS2418: Class static side 'typeof Derived10' incorrectly extends base class static side 'typeof Base': +!!! error TS2418: Property 'u' is protected in type 'typeof Derived10' but public in type 'typeof Base'. + protected static u: (a: typeof x) => void ; + constructor(a: typeof x) { super(a); } + } \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js new file mode 100644 index 00000000000..0a228a04f71 --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -0,0 +1,211 @@ +//// [derivedClassOverridesProtectedMembers3.ts] + +var x: { foo: string; } +var y: { foo: string; bar: string; } + +class Base { + a: typeof x; + b(a: typeof x) { } + get c() { return x; } + set c(v: typeof x) { } + d: (a: typeof x) => void; + + static r: typeof x; + static s(a: typeof x) { } + static get t() { return x; } + static set t(v: typeof x) { } + static u: (a: typeof x) => void; + + constructor(a: typeof x) {} +} + +// Errors +// decrease visibility of all public members to protected +class Derived1 extends Base { + protected a: typeof x; + constructor(a: typeof x) { super(a); } +} + +class Derived2 extends Base { + protected b(a: typeof x) { } + constructor(a: typeof x) { super(a); } +} + +class Derived3 extends Base { + protected get c() { return x; } + constructor(a: typeof x) { super(a); } +} + +class Derived4 extends Base { + protected set c(v: typeof x) { } + constructor(a: typeof x) { super(a); } +} + +class Derived5 extends Base { + protected d: (a: typeof x) => void ; + constructor(a: typeof x) { super(a); } +} + +class Derived6 extends Base { + protected static r: typeof x; + constructor(a: typeof x) { super(a); } +} + +class Derived7 extends Base { + protected static s(a: typeof x) { } + constructor(a: typeof x) { super(a); } +} + +class Derived8 extends Base { + protected static get t() { return x; } + constructor(a: typeof x) { super(a); } +} + +class Derived9 extends Base { + protected static set t(v: typeof x) { } + constructor(a: typeof x) { super(a); } +} + +class Derived10 extends Base { + protected static u: (a: typeof x) => void ; + constructor(a: typeof x) { super(a); } +} + +//// [derivedClassOverridesProtectedMembers3.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var x; +var y; +var Base = (function () { + function Base(a) { + } + Base.prototype.b = function (a) { + }; + Object.defineProperty(Base.prototype, "c", { + get: function () { + return x; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Base.s = function (a) { + }; + Object.defineProperty(Base, "t", { + get: function () { + return x; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Base; +})(); +// Errors +// decrease visibility of all public members to protected +var Derived1 = (function (_super) { + __extends(Derived1, _super); + function Derived1(a) { + _super.call(this, a); + } + return Derived1; +})(Base); +var Derived2 = (function (_super) { + __extends(Derived2, _super); + function Derived2(a) { + _super.call(this, a); + } + Derived2.prototype.b = function (a) { + }; + return Derived2; +})(Base); +var Derived3 = (function (_super) { + __extends(Derived3, _super); + function Derived3(a) { + _super.call(this, a); + } + Object.defineProperty(Derived3.prototype, "c", { + get: function () { + return x; + }, + enumerable: true, + configurable: true + }); + return Derived3; +})(Base); +var Derived4 = (function (_super) { + __extends(Derived4, _super); + function Derived4(a) { + _super.call(this, a); + } + Object.defineProperty(Derived4.prototype, "c", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Derived4; +})(Base); +var Derived5 = (function (_super) { + __extends(Derived5, _super); + function Derived5(a) { + _super.call(this, a); + } + return Derived5; +})(Base); +var Derived6 = (function (_super) { + __extends(Derived6, _super); + function Derived6(a) { + _super.call(this, a); + } + return Derived6; +})(Base); +var Derived7 = (function (_super) { + __extends(Derived7, _super); + function Derived7(a) { + _super.call(this, a); + } + Derived7.s = function (a) { + }; + return Derived7; +})(Base); +var Derived8 = (function (_super) { + __extends(Derived8, _super); + function Derived8(a) { + _super.call(this, a); + } + Object.defineProperty(Derived8, "t", { + get: function () { + return x; + }, + enumerable: true, + configurable: true + }); + return Derived8; +})(Base); +var Derived9 = (function (_super) { + __extends(Derived9, _super); + function Derived9(a) { + _super.call(this, a); + } + Object.defineProperty(Derived9, "t", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Derived9; +})(Base); +var Derived10 = (function (_super) { + __extends(Derived10, _super); + function Derived10(a) { + _super.call(this, a); + } + return Derived10; +})(Base); diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.errors.txt b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.errors.txt new file mode 100644 index 00000000000..f22c656f3c7 --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers4.ts(12,7): error TS2416: Class 'Derived2' incorrectly extends base class 'Derived1': + Property 'a' is protected in type 'Derived2' but public in type 'Derived1'. + + +==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesProtectedMembers4.ts (1 errors) ==== + var x: { foo: string; } + var y: { foo: string; bar: string; } + + class Base { + protected a: typeof x; + } + + class Derived1 extends Base { + public a: typeof x; + } + + class Derived2 extends Derived1 { + ~~~~~~~~ +!!! error TS2416: Class 'Derived2' incorrectly extends base class 'Derived1': +!!! error TS2416: Property 'a' is protected in type 'Derived2' but public in type 'Derived1'. + protected a: typeof x; // Error, parent was public + } \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js new file mode 100644 index 00000000000..e1d5b766b82 --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js @@ -0,0 +1,44 @@ +//// [derivedClassOverridesProtectedMembers4.ts] +var x: { foo: string; } +var y: { foo: string; bar: string; } + +class Base { + protected a: typeof x; +} + +class Derived1 extends Base { + public a: typeof x; +} + +class Derived2 extends Derived1 { + protected a: typeof x; // Error, parent was public +} + +//// [derivedClassOverridesProtectedMembers4.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var x; +var y; +var Base = (function () { + function Base() { + } + return Base; +})(); +var Derived1 = (function (_super) { + __extends(Derived1, _super); + function Derived1() { + _super.apply(this, arguments); + } + return Derived1; +})(Base); +var Derived2 = (function (_super) { + __extends(Derived2, _super); + function Derived2() { + _super.apply(this, arguments); + } + return Derived2; +})(Derived1); diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.errors.txt b/tests/baselines/reference/derivedClassOverridesPublicMembers.errors.txt index efd8f968ea3..9292ff64411 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.errors.txt +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPublicMembers.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPublicMembers.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPublicMembers.ts(13,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPublicMembers.ts(14,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPublicMembers.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPublicMembers.ts(24,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPublicMembers.ts(29,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPublicMembers.ts(30,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPublicMembers.ts (8 errors) ==== var x: { foo: string; } var y: { foo: string; bar: string; } @@ -7,20 +17,20 @@ b(a: typeof x) { } get c() { return x; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. set c(v: typeof x) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. d: (a: typeof x) => void; static r: typeof x; static s(a: typeof x) { } static get t() { return x; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static set t(v: typeof x) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static u: (a: typeof x) => void; constructor(a: typeof x) { } @@ -31,20 +41,20 @@ b(a: typeof y) { } get c() { return y; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. set c(v: typeof y) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. d: (a: typeof y) => void; static r: typeof y; static s(a: typeof y) { } static get t() { return y; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static set t(a: typeof y) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static u: (a: typeof y) => void; constructor(a: typeof y) { super(x) } diff --git a/tests/baselines/reference/derivedClassParameterProperties.errors.txt b/tests/baselines/reference/derivedClassParameterProperties.errors.txt index cd7d774b30c..0dba0d24cb0 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.errors.txt +++ b/tests/baselines/reference/derivedClassParameterProperties.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(15,5): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(30,5): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(56,5): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(79,5): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. + + ==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts (4 errors) ==== // ordering of super calls in derived constructors matters depending on other class contents @@ -21,7 +27,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class Derived3 extends Base { @@ -41,7 +47,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class Derived5 extends Base { @@ -74,7 +80,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class Derived8 extends Base { @@ -103,7 +109,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class Derived10 extends Base2 { diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt index 6c2625223c2..b58d5ad8ffe 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt @@ -1,3 +1,19 @@ +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS1110: Type expected. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS1110: Type expected. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(24,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(28,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(10,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(13,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(17,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(22,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(25,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(29,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + + ==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts (14 errors) ==== // error to use super calls outside a constructor @@ -8,53 +24,53 @@ class Derived extends Base { a: super(); ~~~~~ -!!! Type expected. +!!! error TS1110: Type expected. ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors b() { super(); ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors } get C() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super(); ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors return 1; } set C(v) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super(); ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors } static a: super(); ~~~~~ -!!! Type expected. +!!! error TS1110: Type expected. ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors static b() { super(); ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors } static get C() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super(); ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors return 1; } static set C(v) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super(); ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors } } \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt index 86a6a4d37e4..ef43d1d6f52 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(14,15): error TS2332: 'this' cannot be referenced in current location. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(20,21): error TS2332: 'this' cannot be referenced in current location. + + ==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts (2 errors) ==== class Base { x: string; @@ -14,7 +18,7 @@ constructor(public a: string) { super(this); // error ~~~~ -!!! 'this' cannot be referenced in current location. +!!! error TS2332: 'this' cannot be referenced in current location. } } @@ -22,7 +26,7 @@ constructor(public a: string) { super(() => this); // error ~~~~ -!!! 'this' cannot be referenced in current location. +!!! error TS2332: 'this' cannot be referenced in current location. } } diff --git a/tests/baselines/reference/derivedClassTransitivity.errors.txt b/tests/baselines/reference/derivedClassTransitivity.errors.txt index c5e60abe5d4..0915f921fe1 100644 --- a/tests/baselines/reference/derivedClassTransitivity.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity.errors.txt @@ -1,3 +1,10 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity.ts(18,1): error TS2322: Type 'E' is not assignable to type 'C': + Types of property 'foo' are incompatible: + Type '(x?: string) => void' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity.ts (1 errors) ==== // subclassing is not transitive when you can remove required parameters and add optional parameters @@ -18,10 +25,10 @@ var e: E; c = e; ~ -!!! Type 'E' is not assignable to type 'C': -!!! Types of property 'foo' are incompatible: -!!! Type '(x?: string) => void' is not assignable to type '(x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'E' is not assignable to type 'C': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type '(x?: string) => void' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var r = c.foo(1); var r2 = e.foo(''); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity2.errors.txt b/tests/baselines/reference/derivedClassTransitivity2.errors.txt index b2b3fca8979..db89f608d16 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity2.errors.txt @@ -1,3 +1,10 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity2.ts(18,1): error TS2322: Type 'E' is not assignable to type 'C': + Types of property 'foo' are incompatible: + Type '(x: number, y?: string) => void' is not assignable to type '(x: number, y: number) => void': + Types of parameters 'y' and 'y' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity2.ts (1 errors) ==== // subclassing is not transitive when you can remove required parameters and add optional parameters @@ -18,10 +25,10 @@ var e: E; c = e; ~ -!!! Type 'E' is not assignable to type 'C': -!!! Types of property 'foo' are incompatible: -!!! Type '(x: number, y?: string) => void' is not assignable to type '(x: number, y: number) => void': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'E' is not assignable to type 'C': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type '(x: number, y?: string) => void' is not assignable to type '(x: number, y: number) => void': +!!! error TS2322: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var r = c.foo(1, 1); var r2 = e.foo(1, ''); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity3.errors.txt b/tests/baselines/reference/derivedClassTransitivity3.errors.txt index 8013f894b30..09b5cbe0dfd 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity3.errors.txt @@ -1,3 +1,10 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity3.ts(18,1): error TS2322: Type 'E' is not assignable to type 'C': + Types of property 'foo' are incompatible: + Type '(x: string, y?: number) => void' is not assignable to type '(x: string, y: string) => void': + Types of parameters 'y' and 'y' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity3.ts (1 errors) ==== // subclassing is not transitive when you can remove required parameters and add optional parameters @@ -18,10 +25,10 @@ var e: E; c = e; ~ -!!! Type 'E' is not assignable to type 'C': -!!! Types of property 'foo' are incompatible: -!!! Type '(x: string, y?: number) => void' is not assignable to type '(x: string, y: string) => void': -!!! Types of parameters 'y' and 'y' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'E' is not assignable to type 'C': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type '(x: string, y?: number) => void' is not assignable to type '(x: string, y: string) => void': +!!! error TS2322: Types of parameters 'y' and 'y' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. var r = c.foo('', ''); var r2 = e.foo('', 1); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity4.errors.txt b/tests/baselines/reference/derivedClassTransitivity4.errors.txt new file mode 100644 index 00000000000..5950eddf6be --- /dev/null +++ b/tests/baselines/reference/derivedClassTransitivity4.errors.txt @@ -0,0 +1,37 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity4.ts(18,1): error TS2322: Type 'E' is not assignable to type 'C': + Types of property 'foo' are incompatible: + Type '(x?: string) => void' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity4.ts(19,9): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. + + +==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity4.ts (2 errors) ==== + // subclassing is not transitive when you can remove required parameters and add optional parameters on protected members + + class C { + protected foo(x: number) { } + } + + class D extends C { + protected foo() { } // ok to drop parameters + } + + class E extends D { + public foo(x?: string) { } // ok to add optional parameters + } + + var c: C; + var d: D; + var e: E; + c = e; + ~ +!!! error TS2322: Type 'E' is not assignable to type 'C': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type '(x?: string) => void' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var r = c.foo(1); + ~~~~~ +!!! error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. + var r2 = e.foo(''); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity4.js b/tests/baselines/reference/derivedClassTransitivity4.js new file mode 100644 index 00000000000..5249c6aad2e --- /dev/null +++ b/tests/baselines/reference/derivedClassTransitivity4.js @@ -0,0 +1,61 @@ +//// [derivedClassTransitivity4.ts] +// subclassing is not transitive when you can remove required parameters and add optional parameters on protected members + +class C { + protected foo(x: number) { } +} + +class D extends C { + protected foo() { } // ok to drop parameters +} + +class E extends D { + public foo(x?: string) { } // ok to add optional parameters +} + +var c: C; +var d: D; +var e: E; +c = e; +var r = c.foo(1); +var r2 = e.foo(''); + +//// [derivedClassTransitivity4.js] +// subclassing is not transitive when you can remove required parameters and add optional parameters on protected members +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + } + C.prototype.foo = function (x) { + }; + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + D.prototype.foo = function () { + }; // ok to drop parameters + return D; +})(C); +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.apply(this, arguments); + } + E.prototype.foo = function (x) { + }; // ok to add optional parameters + return E; +})(D); +var c; +var d; +var e; +c = e; +var r = c.foo(1); +var r2 = e.foo(''); diff --git a/tests/baselines/reference/derivedClassWithAny.errors.txt b/tests/baselines/reference/derivedClassWithAny.errors.txt index ca961b5e1bb..d7f0665a9e5 100644 --- a/tests/baselines/reference/derivedClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedClassWithAny.errors.txt @@ -1,9 +1,20 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(27,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(38,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(44,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(57,1): error TS2322: Type 'E' is not assignable to type 'C': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts (7 errors) ==== class C { x: number; get X(): number { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. foo(): number { return 1; } @@ -11,7 +22,7 @@ static y: number; static get Y(): number { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 1; } static bar(): number { @@ -23,7 +34,7 @@ x: any; get X(): any { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return null; } foo(): any { @@ -33,7 +44,7 @@ static y: any; static get Y(): any { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return null; } static bar(): any { @@ -46,7 +57,7 @@ x: string; get X(): string{ return ''; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. foo(): string { return ''; } @@ -54,7 +65,7 @@ static y: string; static get Y(): string { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return ''; } static bar(): string { @@ -69,8 +80,8 @@ c = d; c = e; ~ -!!! Type 'E' is not assignable to type 'C': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'E' is not assignable to type 'C': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var r = c.foo(); // e.foo would return string \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.errors.txt b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.errors.txt new file mode 100644 index 00000000000..aebe32f7fbf --- /dev/null +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingProtectedInstance.ts(13,7): error TS2416: Class 'Derived' incorrectly extends base class 'Base': + Property 'x' is private in type 'Derived' but not in type 'Base'. + + +==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingProtectedInstance.ts (1 errors) ==== + + class Base { + protected x: string; + protected fn(): string { + return ''; + } + + protected get a() { return 1; } + protected set a(v) { } + } + + // error, not a subtype + class Derived extends Base { + ~~~~~~~ +!!! error TS2416: Class 'Derived' incorrectly extends base class 'Base': +!!! error TS2416: Property 'x' is private in type 'Derived' but not in type 'Base'. + private x: string; + private fn(): string { + return ''; + } + + private get a() { return 1; } + private set a(v) { } + } + \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js new file mode 100644 index 00000000000..f802a225088 --- /dev/null +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -0,0 +1,68 @@ +//// [derivedClassWithPrivateInstanceShadowingProtectedInstance.ts] + +class Base { + protected x: string; + protected fn(): string { + return ''; + } + + protected get a() { return 1; } + protected set a(v) { } +} + +// error, not a subtype +class Derived extends Base { + private x: string; + private fn(): string { + return ''; + } + + private get a() { return 1; } + private set a(v) { } +} + + +//// [derivedClassWithPrivateInstanceShadowingProtectedInstance.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.fn = function () { + return ''; + }; + Object.defineProperty(Base.prototype, "a", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Base; +})(); +// error, not a subtype +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.apply(this, arguments); + } + Derived.prototype.fn = function () { + return ''; + }; + Object.defineProperty(Derived.prototype, "a", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Derived; +})(Base); diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt index c467c553096..f85e3be4b5a 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt @@ -1,3 +1,19 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(18,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(19,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(12,7): error TS2416: Class 'Derived' incorrectly extends base class 'Base': + Property 'x' is private in type 'Derived' but not in type 'Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(22,14): error TS2339: Property 'x' does not exist on type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(23,18): error TS2339: Property 'x' does not exist on type 'typeof Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(25,15): error TS2339: Property 'fn' does not exist on type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(26,18): error TS2339: Property 'fn' does not exist on type 'typeof Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(28,15): error TS2339: Property 'a' does not exist on type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(29,6): error TS2339: Property 'a' does not exist on type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(31,18): error TS2339: Property 'a' does not exist on type 'typeof Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(32,9): error TS2339: Property 'a' does not exist on type 'typeof Derived'. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts (13 errors) ==== class Base { public x: string; @@ -7,17 +23,17 @@ public get a() { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set a(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } // error, not a subtype class Derived extends Base { ~~~~~~~ -!!! Class 'Derived' incorrectly extends base class 'Base': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2416: Class 'Derived' incorrectly extends base class 'Base': +!!! error TS2416: Property 'x' is private in type 'Derived' but not in type 'Base'. private x: string; private fn(): string { return ''; @@ -25,36 +41,36 @@ private get a() { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. private set a(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } var r = Base.x; // ok ~ -!!! Property 'x' does not exist on type 'typeof Base'. +!!! error TS2339: Property 'x' does not exist on type 'typeof Base'. var r2 = Derived.x; // error ~ -!!! Property 'x' does not exist on type 'typeof Derived'. +!!! error TS2339: Property 'x' does not exist on type 'typeof Derived'. var r3 = Base.fn(); // ok ~~ -!!! Property 'fn' does not exist on type 'typeof Base'. +!!! error TS2339: Property 'fn' does not exist on type 'typeof Base'. var r4 = Derived.fn(); // error ~~ -!!! Property 'fn' does not exist on type 'typeof Derived'. +!!! error TS2339: Property 'fn' does not exist on type 'typeof Derived'. var r5 = Base.a; // ok ~ -!!! Property 'a' does not exist on type 'typeof Base'. +!!! error TS2339: Property 'a' does not exist on type 'typeof Base'. Base.a = 2; // ok ~ -!!! Property 'a' does not exist on type 'typeof Base'. +!!! error TS2339: Property 'a' does not exist on type 'typeof Base'. var r6 = Derived.a; // error ~ -!!! Property 'a' does not exist on type 'typeof Derived'. +!!! error TS2339: Property 'a' does not exist on type 'typeof Derived'. Derived.a = 2; // error ~ -!!! Property 'a' does not exist on type 'typeof Derived'. \ No newline at end of file +!!! error TS2339: Property 'a' does not exist on type 'typeof Derived'. \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.errors.txt b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.errors.txt new file mode 100644 index 00000000000..a6aa878e54c --- /dev/null +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.errors.txt @@ -0,0 +1,29 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingProtectedStatic.ts(13,7): error TS2418: Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base': + Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'. + + +==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingProtectedStatic.ts (1 errors) ==== + + class Base { + protected static x: string; + protected static fn(): string { + return ''; + } + + protected static get a() { return 1; } + protected static set a(v) { } + } + + // should be error + class Derived extends Base { + ~~~~~~~ +!!! error TS2418: Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base': +!!! error TS2418: Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'. + private static x: string; + private static fn(): string { + return ''; + } + + private static get a() { return 1; } + private static set a(v) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js new file mode 100644 index 00000000000..558e2309757 --- /dev/null +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -0,0 +1,67 @@ +//// [derivedClassWithPrivateStaticShadowingProtectedStatic.ts] + +class Base { + protected static x: string; + protected static fn(): string { + return ''; + } + + protected static get a() { return 1; } + protected static set a(v) { } +} + +// should be error +class Derived extends Base { + private static x: string; + private static fn(): string { + return ''; + } + + private static get a() { return 1; } + private static set a(v) { } +} + +//// [derivedClassWithPrivateStaticShadowingProtectedStatic.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.fn = function () { + return ''; + }; + Object.defineProperty(Base, "a", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Base; +})(); +// should be error +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.apply(this, arguments); + } + Derived.fn = function () { + return ''; + }; + Object.defineProperty(Derived, "a", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Derived; +})(Base); diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt index 9d5ee129541..a792c8ebff0 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt @@ -1,3 +1,15 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(7,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(8,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(19,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(20,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(13,7): error TS2418: Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base': + Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(24,10): error TS2341: Property 'x' is private and only accessible within class 'Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(27,10): error TS2341: Property 'fn' is private and only accessible within class 'Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(32,10): error TS2341: Property 'a' is private and only accessible within class 'Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(33,1): error TS2341: Property 'a' is private and only accessible within class 'Derived'. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts (9 errors) ==== class Base { public static x: string; @@ -7,18 +19,18 @@ public static get a() { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public static set a(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } // BUG 847404 // should be error class Derived extends Base { ~~~~~~~ -!!! Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2418: Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base': +!!! error TS2418: Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'. private static x: string; private static fn(): string { return ''; @@ -26,28 +38,28 @@ private static get a() { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. private static set a(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } var r = Base.x; // ok var r2 = Derived.x; // error ~~~~~~~~~ -!!! Property 'Derived.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'Derived'. var r3 = Base.fn(); // ok var r4 = Derived.fn(); // error ~~~~~~~~~~ -!!! Property 'Derived.fn' is inaccessible. +!!! error TS2341: Property 'fn' is private and only accessible within class 'Derived'. var r5 = Base.a; // ok Base.a = 2; // ok var r6 = Derived.a; // error ~~~~~~~~~ -!!! Property 'Derived.a' is inaccessible. +!!! error TS2341: Property 'a' is private and only accessible within class 'Derived'. Derived.a = 2; // error ~~~~~~~~~ -!!! Property 'Derived.a' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'a' is private and only accessible within class 'Derived'. \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.errors.txt b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.errors.txt index 2d453788701..75720d86404 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.errors.txt +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor.ts(11,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor.ts(24,9): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor.ts (2 errors) ==== class Base { a = 1; @@ -11,7 +15,7 @@ var r = new Derived(); // error ~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r2 = new Derived(1); class Base2 { @@ -26,5 +30,5 @@ var d = new D(); // error ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var d2 = new D(new Date()); // ok \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.errors.txt b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.errors.txt index 62dc521d94a..b699fb7c89e 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.errors.txt +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor2.ts(13,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor2.ts(30,9): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor2.ts (2 errors) ==== class Base { a = 1; @@ -13,7 +17,7 @@ var r = new Derived(); // error ~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r2 = new Derived(1); var r3 = new Derived(1, 2); var r4 = new Derived(1, 2, 3); @@ -32,7 +36,7 @@ var d = new D(); // error ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var d2 = new D(new Date()); // ok var d3 = new D(new Date(), new Date()); var d4 = new D(new Date(), new Date(), new Date()); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.errors.txt b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.errors.txt index 5e524399caa..6b9619cdac6 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.errors.txt +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor3.ts(21,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor3.ts(22,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor3.ts(44,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor3.ts(45,10): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor3.ts (4 errors) ==== // automatic constructors with a class hieararchy of depth > 2 @@ -21,10 +27,10 @@ var r = new Derived(); // error ~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r2 = new Derived2(1); // error ~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r3 = new Derived('', ''); class Base2 { @@ -48,8 +54,8 @@ var d = new D2(); // error ~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var d2 = new D2(new Date()); // error ~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var d3 = new D2(new Date(), new Date()); // ok \ No newline at end of file diff --git a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt index 8464f8b3d0b..ef0c9851ad7 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt @@ -1,9 +1,20 @@ +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,25): error TS2323: Type 'string' is not assignable to type 'T'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,16): error TS2323: Type 'string' is not assignable to type 'T'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E' is not assignable to type 'C': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts (7 errors) ==== class C { x: T; get X(): T { return null; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. foo(): T { return null; } @@ -13,7 +24,7 @@ x: any; get X(): any { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return null; } foo(): any { @@ -23,7 +34,7 @@ static y: any; static get Y(): any { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return null; } static bar(): any { @@ -36,13 +47,13 @@ x: T; get X(): T { return ''; } // error ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~ -!!! Type 'string' is not assignable to type 'T'. +!!! error TS2323: Type 'string' is not assignable to type 'T'. foo(): T { return ''; // error ~~ -!!! Type 'string' is not assignable to type 'T'. +!!! error TS2323: Type 'string' is not assignable to type 'T'. } } @@ -53,7 +64,7 @@ c = d; c = e; ~ -!!! Type 'E' is not assignable to type 'C': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'E' is not assignable to type 'C': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var r = c.foo(); // e.foo would return string \ No newline at end of file diff --git a/tests/baselines/reference/derivedInterfaceCallSignature.errors.txt b/tests/baselines/reference/derivedInterfaceCallSignature.errors.txt index cdde532333b..e1c43f1bb36 100644 --- a/tests/baselines/reference/derivedInterfaceCallSignature.errors.txt +++ b/tests/baselines/reference/derivedInterfaceCallSignature.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/derivedInterfaceCallSignature.ts(11,11): error TS2429: Interface 'D3SvgArea' incorrectly extends interface 'D3SvgPath': + Types of property 'x' are incompatible: + Type '(x: (data: any, index?: number) => number) => D3SvgArea' is not assignable to type '() => (data: any, index?: number) => number'. + + ==== tests/cases/compiler/derivedInterfaceCallSignature.ts (1 errors) ==== interface D3SvgPath { (data: any, index?: number): string; @@ -11,9 +16,9 @@ interface D3SvgArea extends D3SvgPath { ~~~~~~~~~ -!!! Interface 'D3SvgArea' incorrectly extends interface 'D3SvgPath': -!!! Types of property 'x' are incompatible: -!!! Type '(x: (data: any, index?: number) => number) => D3SvgArea' is not assignable to type '() => (data: any, index?: number) => number'. +!!! error TS2429: Interface 'D3SvgArea' incorrectly extends interface 'D3SvgPath': +!!! error TS2429: Types of property 'x' are incompatible: +!!! error TS2429: Type '(x: (data: any, index?: number) => number) => D3SvgArea' is not assignable to type '() => (data: any, index?: number) => number'. x(x: (data: any, index?: number) => number): D3SvgArea; y(y: (data: any, index?: number) => number): D3SvgArea; y0(): (data: any, index?: number) => number; diff --git a/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt b/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt index 444ee245377..7212121e106 100644 --- a/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt +++ b/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt @@ -1,4 +1,15 @@ -==== tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts (8 errors) ==== +tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(7,5): error TS2411: Property '1' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. +tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(7,5): error TS2412: Property '1' of type '{ y: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. +tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(11,5): error TS2411: Property ''1'' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. +tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(11,5): error TS2412: Property ''1'' of type '{ y: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. +tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(15,5): error TS2411: Property 'foo' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. +tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(19,5): error TS2411: Property 'foo' of type '() => { x: number; }' is not assignable to string index type '{ x: number; }'. +tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(24,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(24,5): error TS2412: Property '1' of type '{ x: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. +tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(28,5): error TS2300: Duplicate identifier ''1''. + + +==== tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts (9 errors) ==== interface Base { [x: number]: { x: number; y: number; }; [x: string]: { x: number; } @@ -7,40 +18,42 @@ interface Derived extends Base { 1: { y: number } // error ~~~~~~~~~~~~~~~~ -!!! Property '1' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. +!!! error TS2411: Property '1' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. ~~~~~~~~~~~~~~~~ -!!! Property '1' of type '{ y: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. +!!! error TS2412: Property '1' of type '{ y: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. } interface Derived2 extends Base { '1': { y: number } // error ~~~~~~~~~~~~~~~~~~ -!!! Property ''1'' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. +!!! error TS2411: Property ''1'' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. ~~~~~~~~~~~~~~~~~~ -!!! Property ''1'' of type '{ y: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. +!!! error TS2412: Property ''1'' of type '{ y: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. } interface Derived3 extends Base { foo: { y: number } // error ~~~~~~~~~~~~~~~~~~ -!!! Property 'foo' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. +!!! error TS2411: Property 'foo' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. } interface Derived4 extends Base { foo(): { x: number } // error ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'foo' of type '() => { x: number; }' is not assignable to string index type '{ x: number; }'. +!!! error TS2411: Property 'foo' of type '() => { x: number; }' is not assignable to string index type '{ x: number; }'. } // satisifies string indexer but not numeric indexer interface Derived5 extends Base { 1: { x: number } // error + ~ +!!! error TS2300: Duplicate identifier '1'. ~~~~~~~~~~~~~~~~ -!!! Property '1' of type '{ x: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. +!!! error TS2412: Property '1' of type '{ x: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. } interface Derived5 extends Base { '1': { x: number } // error ~~~ -!!! Duplicate identifier ''1''. +!!! error TS2300: Duplicate identifier ''1''. } \ No newline at end of file diff --git a/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt b/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt index cf63d1a7198..3410867f818 100644 --- a/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt +++ b/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,1): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts (1 errors) ==== interface MyInterface { myMethod(...myList: any[]); @@ -13,4 +16,4 @@ var y: MyClass = new MyClass(); y.myMethod(); // error ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.types b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.types index 9821ff91123..47b7ed95dc6 100644 --- a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.types +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.types @@ -49,7 +49,7 @@ b = d2; var r: Base[] = [d1, d2]; >r : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived >d2 : Derived2 diff --git a/tests/baselines/reference/derivedTypeIncompatibleSignatures.errors.txt b/tests/baselines/reference/derivedTypeIncompatibleSignatures.errors.txt index 9247d98d03d..643979a8ef8 100644 --- a/tests/baselines/reference/derivedTypeIncompatibleSignatures.errors.txt +++ b/tests/baselines/reference/derivedTypeIncompatibleSignatures.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/derivedTypeIncompatibleSignatures.ts(21,11): error TS2429: Interface 'F' incorrectly extends interface 'E': + Index signatures are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/derivedTypeIncompatibleSignatures.ts(29,11): error TS2429: Interface 'H' incorrectly extends interface 'G': + Index signatures are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/derivedTypeIncompatibleSignatures.ts (2 errors) ==== interface A { (a: string): string; @@ -21,9 +29,9 @@ interface F extends E { ~ -!!! Interface 'F' incorrectly extends interface 'E': -!!! Index signatures are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2429: Interface 'F' incorrectly extends interface 'E': +!!! error TS2429: Index signatures are incompatible: +!!! error TS2429: Type 'number' is not assignable to type 'string'. [a: string]: number; // Number is not a subtype of string. Should error. } @@ -33,8 +41,8 @@ interface H extends G { ~ -!!! Interface 'H' incorrectly extends interface 'G': -!!! Index signatures are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2429: Interface 'H' incorrectly extends interface 'G': +!!! error TS2429: Index signatures are incompatible: +!!! error TS2429: Type 'number' is not assignable to type 'string'. [a: number]: number; // Should error for the same reason } \ No newline at end of file diff --git a/tests/baselines/reference/detachedCommentAtStartOfFunctionBody1.errors.txt b/tests/baselines/reference/detachedCommentAtStartOfFunctionBody1.errors.txt index 72b6e60b05f..b1e9ac1b8b4 100644 --- a/tests/baselines/reference/detachedCommentAtStartOfFunctionBody1.errors.txt +++ b/tests/baselines/reference/detachedCommentAtStartOfFunctionBody1.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/detachedCommentAtStartOfFunctionBody1.ts(6,37): error TS2339: Property 'name' does not exist on type 'TestFile'. + + ==== tests/cases/compiler/detachedCommentAtStartOfFunctionBody1.ts (1 errors) ==== class TestFile { foo(message: string): () => string { @@ -6,6 +9,6 @@ /// return () => message + this.name; ~~~~ -!!! Property 'name' does not exist on type 'TestFile'. +!!! error TS2339: Property 'name' does not exist on type 'TestFile'. } } \ No newline at end of file diff --git a/tests/baselines/reference/detachedCommentAtStartOfFunctionBody2.errors.txt b/tests/baselines/reference/detachedCommentAtStartOfFunctionBody2.errors.txt index 1afac3232e3..fd243e5d8ed 100644 --- a/tests/baselines/reference/detachedCommentAtStartOfFunctionBody2.errors.txt +++ b/tests/baselines/reference/detachedCommentAtStartOfFunctionBody2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/detachedCommentAtStartOfFunctionBody2.ts(7,37): error TS2339: Property 'name' does not exist on type 'TestFile'. + + ==== tests/cases/compiler/detachedCommentAtStartOfFunctionBody2.ts (1 errors) ==== class TestFile { foo(message: string): () => string { @@ -7,6 +10,6 @@ return () => message + this.name; ~~~~ -!!! Property 'name' does not exist on type 'TestFile'. +!!! error TS2339: Property 'name' does not exist on type 'TestFile'. } } \ No newline at end of file diff --git a/tests/baselines/reference/directReferenceToNull.errors.txt b/tests/baselines/reference/directReferenceToNull.errors.txt index 23a280fc2ed..a39f7b76d2f 100644 --- a/tests/baselines/reference/directReferenceToNull.errors.txt +++ b/tests/baselines/reference/directReferenceToNull.errors.txt @@ -1,4 +1,7 @@ +tests/cases/conformance/types/primitives/null/directReferenceToNull.ts(1,8): error TS2304: Cannot find name 'Null'. + + ==== tests/cases/conformance/types/primitives/null/directReferenceToNull.ts (1 errors) ==== var x: Null; ~~~~ -!!! Cannot find name 'Null'. \ No newline at end of file +!!! error TS2304: Cannot find name 'Null'. \ No newline at end of file diff --git a/tests/baselines/reference/directReferenceToUndefined.errors.txt b/tests/baselines/reference/directReferenceToUndefined.errors.txt index 1534b27e02c..12465a01bdf 100644 --- a/tests/baselines/reference/directReferenceToUndefined.errors.txt +++ b/tests/baselines/reference/directReferenceToUndefined.errors.txt @@ -1,5 +1,8 @@ +tests/cases/conformance/types/primitives/undefined/directReferenceToUndefined.ts(1,8): error TS2304: Cannot find name 'Undefined'. + + ==== tests/cases/conformance/types/primitives/undefined/directReferenceToUndefined.ts (1 errors) ==== var x: Undefined; ~~~~~~~~~ -!!! Cannot find name 'Undefined'. +!!! error TS2304: Cannot find name 'Undefined'. var y = undefined; \ No newline at end of file diff --git a/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types b/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types index 225bca8de63..cd8c03fd6a6 100644 --- a/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types +++ b/tests/baselines/reference/doNotWidenAtObjectLiteralPropertyAssignment.types @@ -21,7 +21,7 @@ interface IIntervalTreeNode { var test: IIntervalTreeNode[] = [{ interval: { begin: 0 }, children: null }]; // was error here because best common type is {} >test : IIntervalTreeNode[] >IIntervalTreeNode : IIntervalTreeNode ->[{ interval: { begin: 0 }, children: null }] : IIntervalTreeNode[] +>[{ interval: { begin: 0 }, children: null }] : { interval: { begin: number; }; children: null; }[] >{ interval: { begin: 0 }, children: null } : { interval: { begin: number; }; children: null; } >interval : { begin: number; } >{ begin: 0 } : { begin: number; } diff --git a/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt b/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt index fdf27296612..be90535f14c 100644 --- a/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt +++ b/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt @@ -1,16 +1,24 @@ +tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,5): error TS1098: Type parameter list cannot be empty. +tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,6): error TS1005: '(' expected. +tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,6): error TS1139: Type parameter declaration expected. +tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(4,1): error TS1109: Expression expected. +tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(1,5): error TS2322: Type 'number' is not assignable to type '{ (): any; x: number; }': + Property 'x' is missing in type 'Number'. + + ==== tests/cases/compiler/dontShowCompilerGeneratedMembers.ts (5 errors) ==== var f: { ~ -!!! Type 'number' is not assignable to type '{ <>(): any; x: number; }': -!!! Property 'x' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type '{ (): any; x: number; }': +!!! error TS2322: Property 'x' is missing in type 'Number'. x: number; <- ~ -!!! Type parameter list cannot be empty. +!!! error TS1098: Type parameter list cannot be empty. ~ -!!! '(' expected. +!!! error TS1005: '(' expected. ~ -!!! Type parameter declaration expected. +!!! error TS1139: Type parameter declaration expected. }; ~ -!!! Expression expected. \ No newline at end of file +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/dottedModuleName.errors.txt b/tests/baselines/reference/dottedModuleName.errors.txt index 7308aa980f7..0b8c3a5c422 100644 --- a/tests/baselines/reference/dottedModuleName.errors.txt +++ b/tests/baselines/reference/dottedModuleName.errors.txt @@ -1,13 +1,18 @@ +tests/cases/compiler/dottedModuleName.ts(3,29): error TS1144: Block or ';' expected. +tests/cases/compiler/dottedModuleName.ts(3,18): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/dottedModuleName.ts(3,33): error TS2304: Cannot find name 'x'. + + ==== tests/cases/compiler/dottedModuleName.ts (3 errors) ==== module M { export module N { export function f(x:number)=>2*x; ~~ -!!! Block or ';' expected. +!!! error TS1144: Block or ';' expected. ~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. export module X.Y.Z { export var v2=f(v); } diff --git a/tests/baselines/reference/duplicateClassElements.errors.txt b/tests/baselines/reference/duplicateClassElements.errors.txt index 7822af473ec..004e68314fd 100644 --- a/tests/baselines/reference/duplicateClassElements.errors.txt +++ b/tests/baselines/reference/duplicateClassElements.errors.txt @@ -1,82 +1,125 @@ -==== tests/cases/compiler/duplicateClassElements.ts (18 errors) ==== +tests/cases/compiler/duplicateClassElements.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(18,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(29,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(36,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(39,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(2,12): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateClassElements.ts(3,12): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateClassElements.ts(4,12): error TS2393: Duplicate function implementation. +tests/cases/compiler/duplicateClassElements.ts(6,12): error TS2393: Duplicate function implementation. +tests/cases/compiler/duplicateClassElements.ts(8,12): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateClassElements.ts(9,9): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateClassElements.ts(12,9): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateClassElements.ts(21,12): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/duplicateClassElements.ts(23,9): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/duplicateClassElements.ts(26,9): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/duplicateClassElements.ts(29,9): error TS2300: Duplicate identifier 'x2'. +tests/cases/compiler/duplicateClassElements.ts(32,9): error TS2300: Duplicate identifier 'x2'. +tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2300: Duplicate identifier 'x2'. +tests/cases/compiler/duplicateClassElements.ts(36,9): error TS2300: Duplicate identifier 'z2'. +tests/cases/compiler/duplicateClassElements.ts(39,9): error TS2300: Duplicate identifier 'z2'. +tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate identifier 'z2'. + + +==== tests/cases/compiler/duplicateClassElements.ts (26 errors) ==== class a { public a; + ~ +!!! error TS2300: Duplicate identifier 'a'. public a; ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. public b() { + ~ +!!! error TS2393: Duplicate function implementation. } public b() { - ~~~~~~~~~~~~ + ~ +!!! error TS2393: Duplicate function implementation. } - ~~~~~ -!!! Duplicate function implementation. public x; + ~ +!!! error TS2300: Duplicate identifier 'x'. get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. return 10; } set x(_x: number) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } get y() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "Hello"; } set y(_y: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } public z() { + ~ +!!! error TS2300: Duplicate identifier 'z'. } get z() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Duplicate identifier 'z'. +!!! error TS2300: Duplicate identifier 'z'. return "Hello"; } set z(_y: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Duplicate identifier 'z'. +!!! error TS2300: Duplicate identifier 'z'. } get x2() { ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~ +!!! error TS2300: Duplicate identifier 'x2'. return 10; } set x2(_x: number) { ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~ +!!! error TS2300: Duplicate identifier 'x2'. } public x2; ~~ -!!! Duplicate identifier 'x2'. +!!! error TS2300: Duplicate identifier 'x2'. get z2() { ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~ +!!! error TS2300: Duplicate identifier 'z2'. return "Hello"; } set z2(_y: string) { ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~ +!!! error TS2300: Duplicate identifier 'z2'. } public z2() { ~~ -!!! Duplicate identifier 'z2'. +!!! error TS2300: Duplicate identifier 'z2'. } } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateExportAssignments.errors.txt b/tests/baselines/reference/duplicateExportAssignments.errors.txt index ebaba363076..0052391f62c 100644 --- a/tests/baselines/reference/duplicateExportAssignments.errors.txt +++ b/tests/baselines/reference/duplicateExportAssignments.errors.txt @@ -1,24 +1,38 @@ +tests/cases/conformance/externalModules/foo1.ts(3,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(3,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/conformance/externalModules/foo1.ts(4,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/conformance/externalModules/foo2.ts(3,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/conformance/externalModules/foo2.ts(4,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/conformance/externalModules/foo3.ts(7,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/conformance/externalModules/foo3.ts(8,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/conformance/externalModules/foo4.ts(1,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/conformance/externalModules/foo4.ts(8,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/conformance/externalModules/foo5.ts(4,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/conformance/externalModules/foo5.ts(5,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2308: A module cannot have more than one export assignment. + + ==== tests/cases/conformance/externalModules/foo1.ts (3 errors) ==== var x = 10; var y = 20; export = x; ~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. export = y; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. ==== tests/cases/conformance/externalModules/foo2.ts (2 errors) ==== var x = 10; class y {}; export = x; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. export = y; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. ==== tests/cases/conformance/externalModules/foo3.ts (2 errors) ==== module x { @@ -29,15 +43,15 @@ } export = x; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. export = y; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. ==== tests/cases/conformance/externalModules/foo4.ts (2 errors) ==== export = x; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. function x(){ return 42; } @@ -46,7 +60,7 @@ } export = y; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. ==== tests/cases/conformance/externalModules/foo5.ts (3 errors) ==== var x = 5; @@ -54,11 +68,11 @@ var z = {}; export = x; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. export = y; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. export = z; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. \ No newline at end of file diff --git a/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt b/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt index f20e5d626eb..d8065df27c8 100644 --- a/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt +++ b/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt @@ -1,26 +1,41 @@ -==== tests/cases/compiler/duplicateIdentifierInCatchBlock.ts (4 errors) ==== +tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(1,5): error TS2300: Duplicate identifier 'v'. +tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(3,14): error TS2300: Duplicate identifier 'v'. +tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(6,10): error TS2300: Duplicate identifier 'w'. +tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(8,9): error TS2300: Duplicate identifier 'w'. +tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(12,9): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(13,14): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'string', but here has type 'number'. + + +==== tests/cases/compiler/duplicateIdentifierInCatchBlock.ts (7 errors) ==== var v; + ~ +!!! error TS2300: Duplicate identifier 'v'. try { } catch (e) { function v() { } ~ -!!! Duplicate identifier 'v'. +!!! error TS2300: Duplicate identifier 'v'. } function w() { } + ~ +!!! error TS2300: Duplicate identifier 'w'. try { } catch (e) { var w; ~ -!!! Duplicate identifier 'w'. +!!! error TS2300: Duplicate identifier 'w'. } try { } catch (e) { var x; + ~ +!!! error TS2300: Duplicate identifier 'x'. function x() { } // error ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. function e() { } // error var p: string; var p: number; // error ~ -!!! Subsequent variable declarations must have the same type. Variable 'p' must be of type 'string', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'string', but here has type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.errors.txt b/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.errors.txt index fee03fe7807..6c80d13b2f4 100644 --- a/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.errors.txt +++ b/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.errors.txt @@ -1,20 +1,32 @@ -==== tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts (3 errors) ==== +tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(2,22): error TS2300: Duplicate identifier 'I'. +tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(5,18): error TS2300: Duplicate identifier 'I'. +tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(9,21): error TS2300: Duplicate identifier 'f'. +tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(12,18): error TS2300: Duplicate identifier 'f'. +tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(37,12): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(41,16): error TS2300: Duplicate identifier 'x'. + + +==== tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts (6 errors) ==== module M { export interface I { } + ~ +!!! error TS2300: Duplicate identifier 'I'. } module M { export class I { } // error ~ -!!! Duplicate identifier 'I'. +!!! error TS2300: Duplicate identifier 'I'. } module M { export function f() { } + ~ +!!! error TS2300: Duplicate identifier 'f'. } module M { export class f { } // error ~ -!!! Duplicate identifier 'f'. +!!! error TS2300: Duplicate identifier 'f'. } module M { @@ -40,12 +52,14 @@ class Foo { static x: number; + ~ +!!! error TS2300: Duplicate identifier 'x'. } module Foo { export var x: number; // error for redeclaring var in a different parent ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } module N { diff --git a/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt b/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt index be2e3d0e6bb..674d4f601e6 100644 --- a/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt +++ b/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt @@ -1,8 +1,14 @@ -==== tests/cases/compiler/duplicateInterfaceMembers1.ts (1 errors) ==== +tests/cases/compiler/duplicateInterfaceMembers1.ts(2,4): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateInterfaceMembers1.ts(3,4): error TS2300: Duplicate identifier 'x'. + + +==== tests/cases/compiler/duplicateInterfaceMembers1.ts (2 errors) ==== interface Bar { x: number; + ~ +!!! error TS2300: Duplicate identifier 'x'. x: number; ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateLabel1.errors.txt b/tests/baselines/reference/duplicateLabel1.errors.txt index 7503b9b278f..b34f1f771e0 100644 --- a/tests/baselines/reference/duplicateLabel1.errors.txt +++ b/tests/baselines/reference/duplicateLabel1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/duplicateLabel1.ts(2,1): error TS1114: Duplicate label 'target' + + ==== tests/cases/compiler/duplicateLabel1.ts (1 errors) ==== target: target: ~~~~~~ -!!! Duplicate label 'target' +!!! error TS1114: Duplicate label 'target' while (true) { } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateLabel2.errors.txt b/tests/baselines/reference/duplicateLabel2.errors.txt index da40c01d528..307596cf4e8 100644 --- a/tests/baselines/reference/duplicateLabel2.errors.txt +++ b/tests/baselines/reference/duplicateLabel2.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/duplicateLabel2.ts(3,3): error TS1114: Duplicate label 'target' + + ==== tests/cases/compiler/duplicateLabel2.ts (1 errors) ==== target: while (true) { target: ~~~~~~ -!!! Duplicate label 'target' +!!! error TS1114: Duplicate label 'target' while (true) { } } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateLocalVariable1.errors.txt b/tests/baselines/reference/duplicateLocalVariable1.errors.txt index 3bddf320db1..e4217d4d411 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable1.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/duplicateLocalVariable1.ts(185,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. + + ==== tests/cases/compiler/duplicateLocalVariable1.ts (1 errors) ==== //import FileManager = require('filemanager'); @@ -185,7 +188,7 @@ var bytes = []; for (var i = 0; i < 14; i++) { ~ -!!! Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. bytes.push(fb.readByte()); } var expected = [0xEF, 0xBB, 0xBF, 0x54, 0xC3, 0xA8, 0xE1, 0xB4, 0xA3, 0xE2, 0x80, 0xA0, 0x0D, 0x0A]; diff --git a/tests/baselines/reference/duplicateLocalVariable2.errors.txt b/tests/baselines/reference/duplicateLocalVariable2.errors.txt index d176a826082..0fbe0018bf8 100644 --- a/tests/baselines/reference/duplicateLocalVariable2.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. + + ==== tests/cases/compiler/duplicateLocalVariable2.ts (1 errors) ==== export class TestCase { constructor (public name: string, public test: ()=>boolean, public errorMessageRegEx?: string) { @@ -27,7 +30,7 @@ var bytes = []; for (var i = 0; i < 14; i++) { ~ -!!! Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. bytes.push(fb.readByte()); } var expected = [0xEF]; diff --git a/tests/baselines/reference/duplicateLocalVariable3.errors.txt b/tests/baselines/reference/duplicateLocalVariable3.errors.txt index b99d0772292..5dda5872da0 100644 --- a/tests/baselines/reference/duplicateLocalVariable3.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable3.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/duplicateLocalVariable3.ts(11,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'string'. + + ==== tests/cases/compiler/duplicateLocalVariable3.ts (1 errors) ==== var x = 1; var x = 2; @@ -11,5 +14,5 @@ var z = 3; var z = ""; ~ -!!! Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateLocalVariable4.errors.txt b/tests/baselines/reference/duplicateLocalVariable4.errors.txt index 6038986971f..3209c23e39e 100644 --- a/tests/baselines/reference/duplicateLocalVariable4.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable4.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/duplicateLocalVariable4.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type 'E'. + + ==== tests/cases/compiler/duplicateLocalVariable4.ts (1 errors) ==== enum E{ a @@ -6,4 +9,4 @@ var x = E; var x = E.a; ~ -!!! Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type 'E'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type 'E'. \ No newline at end of file diff --git a/tests/baselines/reference/duplicateNumericIndexers.errors.txt b/tests/baselines/reference/duplicateNumericIndexers.errors.txt index 74438877558..c4c7883021a 100644 --- a/tests/baselines/reference/duplicateNumericIndexers.errors.txt +++ b/tests/baselines/reference/duplicateNumericIndexers.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/types/members/duplicateNumericIndexers.ts(5,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/members/duplicateNumericIndexers.ts(9,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/members/duplicateNumericIndexers.ts(10,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/members/duplicateNumericIndexers.ts(14,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/members/duplicateNumericIndexers.ts(15,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/members/duplicateNumericIndexers.ts(20,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/members/duplicateNumericIndexers.ts(25,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/members/duplicateNumericIndexers.ts(30,5): error TS2375: Duplicate number index signature. + + ==== tests/cases/conformance/types/members/duplicateNumericIndexers.ts (8 errors) ==== // it is an error to have duplicate index signatures of the same kind in a type @@ -5,46 +15,46 @@ [x: number]: string; [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } interface String { [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } interface Array { [x: number]: T; ~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. [x: number]: T; ~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } class C { [x: number]: string; [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } interface I { [x: number]: string; [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } var a: { [x: number]: string; [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt index 51e9bae840b..4c3f6d1eb7e 100644 --- a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt +++ b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt @@ -1,20 +1,39 @@ -==== tests/cases/compiler/duplicateObjectLiteralProperty.ts (9 errors) ==== +tests/cases/compiler/duplicateObjectLiteralProperty.ts(14,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(2,5): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(4,5): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(5,5): error TS2300: Duplicate identifier '\u0061'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(6,5): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(7,9): error TS2300: Duplicate identifier 'c'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(8,9): error TS2300: Duplicate identifier '"c"'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(14,9): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(15,9): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS2300: Duplicate identifier 'a'. + + +==== tests/cases/compiler/duplicateObjectLiteralProperty.ts (13 errors) ==== var x = { a: 1, + ~ +!!! error TS2300: Duplicate identifier 'a'. b: true, // OK a: 56, // Duplicate ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. \u0061: "ss", // Duplicate ~~~~~~ -!!! Duplicate identifier '\u0061'. +!!! error TS2300: Duplicate identifier '\u0061'. a: { ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. c: 1, + ~ +!!! error TS2300: Duplicate identifier 'c'. "c": 56, // Duplicate ~~~ -!!! Duplicate identifier '"c"'. +!!! error TS2300: Duplicate identifier '"c"'. } }; @@ -22,16 +41,20 @@ var y = { get a() { return 0; }, ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~ +!!! error TS2300: Duplicate identifier 'a'. set a(v: number) { }, ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~ +!!! error TS2300: Duplicate identifier 'a'. get a() { return 0; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! An object literal cannot have multiple get/set accessors with the same name. +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. }; \ No newline at end of file diff --git a/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt b/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt index e184b7761ea..6ae8518677d 100644 --- a/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt +++ b/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt @@ -1,10 +1,17 @@ -==== tests/cases/compiler/duplicatePropertiesInStrictMode.ts (2 errors) ==== +tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS1117: An object literal cannot have multiple properties with the same name in strict mode. +tests/cases/compiler/duplicatePropertiesInStrictMode.ts(3,3): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS2300: Duplicate identifier 'x'. + + +==== tests/cases/compiler/duplicatePropertiesInStrictMode.ts (3 errors) ==== "use strict"; var x = { x: 1, + ~ +!!! error TS2300: Duplicate identifier 'x'. x: 2 ~ -!!! An object literal cannot have multiple properties with the same name in strict mode. +!!! error TS1117: An object literal cannot have multiple properties with the same name in strict mode. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicatePropertyNames.errors.txt b/tests/baselines/reference/duplicatePropertyNames.errors.txt index 6e9f95e0c42..108a88d1451 100644 --- a/tests/baselines/reference/duplicatePropertyNames.errors.txt +++ b/tests/baselines/reference/duplicatePropertyNames.errors.txt @@ -1,11 +1,35 @@ -==== tests/cases/conformance/types/members/duplicatePropertyNames.ts (10 errors) ==== +tests/cases/conformance/types/members/duplicatePropertyNames.ts(4,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(5,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(14,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(15,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(19,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(20,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(22,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(23,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(25,5): error TS2300: Duplicate identifier 'baz'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(26,5): error TS2300: Duplicate identifier 'baz'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(30,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(31,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(35,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(36,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(38,5): error TS2300: Duplicate identifier 'bar'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(39,5): error TS2300: Duplicate identifier 'bar'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(43,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(44,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(45,5): error TS2300: Duplicate identifier 'bar'. +tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2300: Duplicate identifier 'bar'. + + +==== tests/cases/conformance/types/members/duplicatePropertyNames.ts (20 errors) ==== // duplicate property names are an error in all types interface Number { foo: string; + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. foo: string; ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. } interface String { @@ -15,55 +39,73 @@ interface Array { foo: T; + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. foo: T; ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. } class C { foo: string; + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. foo: string; ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. bar(x) { } + ~~~ +!!! error TS2393: Duplicate function implementation. bar(x) { } - ~~~~~~~~~~ -!!! Duplicate function implementation. + ~~~ +!!! error TS2393: Duplicate function implementation. - baz = () => { } baz = () => { } ~~~ -!!! Duplicate identifier 'baz'. +!!! error TS2300: Duplicate identifier 'baz'. + baz = () => { } + ~~~ +!!! error TS2300: Duplicate identifier 'baz'. } interface I { foo: string; + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. foo: string; ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. } var a: { foo: string; + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. foo: string; ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. bar: () => {}; + ~~~ +!!! error TS2300: Duplicate identifier 'bar'. bar: () => {}; ~~~ -!!! Duplicate identifier 'bar'. +!!! error TS2300: Duplicate identifier 'bar'. } var b = { foo: '', + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. foo: '', ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. bar: () => { }, + ~~~ +!!! error TS2300: Duplicate identifier 'bar'. bar: () => { } ~~~ -!!! Duplicate identifier 'bar'. +!!! error TS2300: Duplicate identifier 'bar'. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateStringIndexers.errors.txt b/tests/baselines/reference/duplicateStringIndexers.errors.txt index f4cfe243bd3..9eebe6f7892 100644 --- a/tests/baselines/reference/duplicateStringIndexers.errors.txt +++ b/tests/baselines/reference/duplicateStringIndexers.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/types/members/duplicateStringIndexers.ts(6,9): error TS2374: Duplicate string index signature. +tests/cases/conformance/types/members/duplicateStringIndexers.ts(11,9): error TS2374: Duplicate string index signature. +tests/cases/conformance/types/members/duplicateStringIndexers.ts(16,9): error TS2374: Duplicate string index signature. +tests/cases/conformance/types/members/duplicateStringIndexers.ts(21,9): error TS2374: Duplicate string index signature. +tests/cases/conformance/types/members/duplicateStringIndexers.ts(26,9): error TS2374: Duplicate string index signature. +tests/cases/conformance/types/members/duplicateStringIndexers.ts(31,9): error TS2374: Duplicate string index signature. + + ==== tests/cases/conformance/types/members/duplicateStringIndexers.ts (6 errors) ==== // it is an error to have duplicate index signatures of the same kind in a type @@ -6,42 +14,42 @@ [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } interface String { [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } interface Array { [x: string]: T; [x: string]: T; ~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } class C { [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } interface I { [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } var a: { [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt b/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt index 9fdd6668807..7d6c5d6bafc 100644 --- a/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt +++ b/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt @@ -1,7 +1,13 @@ -==== tests/cases/compiler/duplicateStringNamedProperty1.ts (1 errors) ==== +tests/cases/compiler/duplicateStringNamedProperty1.ts(2,5): error TS2300: Duplicate identifier '"artist"'. +tests/cases/compiler/duplicateStringNamedProperty1.ts(3,5): error TS2300: Duplicate identifier 'artist'. + + +==== tests/cases/compiler/duplicateStringNamedProperty1.ts (2 errors) ==== export interface Album { "artist": string; + ~~~~~~~~ +!!! error TS2300: Duplicate identifier '"artist"'. artist: string; ~~~~~~ -!!! Duplicate identifier 'artist'. +!!! error TS2300: Duplicate identifier 'artist'. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt b/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt index a42b1c0b8b1..768e6111b73 100644 --- a/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt +++ b/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt @@ -1,3 +1,23 @@ +tests/cases/compiler/duplicateSymbolsExportMatching.ts(24,15): error TS2395: Individual declarations in merged declaration I must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(25,22): error TS2395: Individual declarations in merged declaration I must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(26,22): error TS2395: Individual declarations in merged declaration E must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(27,15): error TS2395: Individual declarations in merged declaration E must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(32,12): error TS2395: Individual declarations in merged declaration inst must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(35,19): error TS2395: Individual declarations in merged declaration inst must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(42,9): error TS2395: Individual declarations in merged declaration v must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(43,16): error TS2395: Individual declarations in merged declaration v must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(44,9): error TS2395: Individual declarations in merged declaration w must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(45,16): error TS2395: Individual declarations in merged declaration w must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2395: Individual declarations in merged declaration F must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/duplicateSymbolsExportMatching.ts(52,21): error TS2395: Individual declarations in merged declaration F must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(56,11): error TS2395: Individual declarations in merged declaration C must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(57,12): error TS2395: Individual declarations in merged declaration C must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(58,19): error TS2395: Individual declarations in merged declaration C must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(64,11): error TS2395: Individual declarations in merged declaration D must be all exported or all local. +tests/cases/compiler/duplicateSymbolsExportMatching.ts(65,18): error TS2395: Individual declarations in merged declaration D must be all exported or all local. + + ==== tests/cases/compiler/duplicateSymbolsExportMatching.ts (18 errors) ==== module M { export interface E { } @@ -24,28 +44,28 @@ module N2 { interface I { } ~ -!!! Individual declarations in merged declaration I must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration I must be all exported or all local. export interface I { } // error ~ -!!! Individual declarations in merged declaration I must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration I must be all exported or all local. export interface E { } ~ -!!! Individual declarations in merged declaration E must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration E must be all exported or all local. interface E { } // error ~ -!!! Individual declarations in merged declaration E must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration E must be all exported or all local. } // Should report error only once for instantiated module module M { module inst { ~~~~ -!!! Individual declarations in merged declaration inst must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration inst must be all exported or all local. var t; } export module inst { // one error ~~~~ -!!! Individual declarations in merged declaration inst must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration inst must be all exported or all local. var t; } } @@ -54,41 +74,41 @@ module M2 { var v: string; ~ -!!! Individual declarations in merged declaration v must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration v must be all exported or all local. export var v: string; // one error (visibility) ~ -!!! Individual declarations in merged declaration v must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration v must be all exported or all local. var w: number; ~ -!!! Individual declarations in merged declaration w must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration w must be all exported or all local. export var w: string; // two errors (visibility and type mismatch) ~ -!!! Individual declarations in merged declaration w must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration w must be all exported or all local. } module M { module F { ~ -!!! Individual declarations in merged declaration F must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration F must be all exported or all local. ~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged var t; } export function F() { } // Only one error for duplicate identifier (don't consider visibility) ~ -!!! Individual declarations in merged declaration F must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration F must be all exported or all local. } module M { class C { } ~ -!!! Individual declarations in merged declaration C must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration C must be all exported or all local. module C { } ~ -!!! Individual declarations in merged declaration C must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration C must be all exported or all local. export module C { // Two visibility errors (one for the clodule symbol, and one for the merged container symbol) ~ -!!! Individual declarations in merged declaration C must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration C must be all exported or all local. var t; } } @@ -96,7 +116,7 @@ // Top level interface D { } ~ -!!! Individual declarations in merged declaration D must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration D must be all exported or all local. export interface D { } ~ -!!! Individual declarations in merged declaration D must be all exported or all local. \ No newline at end of file +!!! error TS2395: Individual declarations in merged declaration D must be all exported or all local. \ No newline at end of file diff --git a/tests/baselines/reference/duplicateTypeParameters1.errors.txt b/tests/baselines/reference/duplicateTypeParameters1.errors.txt index 798411f6b6d..ad9edcfaa34 100644 --- a/tests/baselines/reference/duplicateTypeParameters1.errors.txt +++ b/tests/baselines/reference/duplicateTypeParameters1.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/duplicateTypeParameters1.ts(1,15): error TS2300: Duplicate identifier 'X'. + + ==== tests/cases/compiler/duplicateTypeParameters1.ts (1 errors) ==== function A() { } ~ -!!! Duplicate identifier 'X'. +!!! error TS2300: Duplicate identifier 'X'. \ No newline at end of file diff --git a/tests/baselines/reference/duplicateTypeParameters2.errors.txt b/tests/baselines/reference/duplicateTypeParameters2.errors.txt index 52c6b799e9e..a509497a0c5 100644 --- a/tests/baselines/reference/duplicateTypeParameters2.errors.txt +++ b/tests/baselines/reference/duplicateTypeParameters2.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/duplicateTypeParameters2.ts(4,26): error TS2300: Duplicate identifier 'T'. + + ==== tests/cases/compiler/duplicateTypeParameters2.ts (1 errors) ==== class A { public foo() { } } class B { public bar() { } } interface I {} ~ -!!! Duplicate identifier 'T'. \ No newline at end of file +!!! error TS2300: Duplicate identifier 'T'. \ No newline at end of file diff --git a/tests/baselines/reference/duplicateTypeParameters3.errors.txt b/tests/baselines/reference/duplicateTypeParameters3.errors.txt index 88bbf127abb..9ff7d621948 100644 --- a/tests/baselines/reference/duplicateTypeParameters3.errors.txt +++ b/tests/baselines/reference/duplicateTypeParameters3.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/duplicateTypeParameters3.ts(2,14): error TS2300: Duplicate identifier 'A'. + + ==== tests/cases/compiler/duplicateTypeParameters3.ts (1 errors) ==== interface X { x: () => () => void; ~ -!!! Duplicate identifier 'A'. +!!! error TS2300: Duplicate identifier 'A'. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateVarAndImport2.errors.txt b/tests/baselines/reference/duplicateVarAndImport2.errors.txt index b6f52fc23cb..192b16eaab9 100644 --- a/tests/baselines/reference/duplicateVarAndImport2.errors.txt +++ b/tests/baselines/reference/duplicateVarAndImport2.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/duplicateVarAndImport2.ts(4,1): error TS2440: Import declaration conflicts with local declaration of 'a' + + ==== tests/cases/compiler/duplicateVarAndImport2.ts (1 errors) ==== // error since module is instantiated var a; module M { export var x = 1; } import a = M; ~~~~~~~~~~~~~ -!!! Import declaration conflicts with local declaration of 'a' \ No newline at end of file +!!! error TS2440: Import declaration conflicts with local declaration of 'a' \ No newline at end of file diff --git a/tests/baselines/reference/duplicateVariablesWithAny.errors.txt b/tests/baselines/reference/duplicateVariablesWithAny.errors.txt index 0cfc4b1a720..787e118ca37 100644 --- a/tests/baselines/reference/duplicateVariablesWithAny.errors.txt +++ b/tests/baselines/reference/duplicateVariablesWithAny.errors.txt @@ -1,25 +1,31 @@ +tests/cases/compiler/duplicateVariablesWithAny.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +tests/cases/compiler/duplicateVariablesWithAny.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. +tests/cases/compiler/duplicateVariablesWithAny.ts(10,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +tests/cases/compiler/duplicateVariablesWithAny.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. + + ==== tests/cases/compiler/duplicateVariablesWithAny.ts (4 errors) ==== // They should have to be the same even when one of the types is 'any' var x: any; var x = 2; //error ~ -!!! Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. var y = ""; var y; //error ~ -!!! Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. module N { var x: any; var x = 2; //error ~ -!!! Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. var y = ""; var y; //error ~ -!!! Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. } var z: any; diff --git a/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt b/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt index 5f9d5727475..d4222483212 100644 --- a/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt +++ b/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'boolean'. +tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'string'. +tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'number'. +tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'boolean'. + + ==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts (0 errors) ==== var x = 3; var y = ""; @@ -5,19 +11,19 @@ ==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts (1 errors) ==== var x = true; ~ -!!! Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'boolean'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'boolean'. var z = 3; ==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts (3 errors) ==== var x = ""; ~ -!!! Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'string'. var y = 3; ~ -!!! Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'number'. var z = false; ~ -!!! Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'boolean'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'boolean'. ==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_3.ts (0 errors) ==== var x = 0; diff --git a/tests/baselines/reference/emitThisInSuperMethodCall.errors.txt b/tests/baselines/reference/emitThisInSuperMethodCall.errors.txt index 0df438756cf..7fe090395e3 100644 --- a/tests/baselines/reference/emitThisInSuperMethodCall.errors.txt +++ b/tests/baselines/reference/emitThisInSuperMethodCall.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/emitThisInSuperMethodCall.ts(10,17): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class +tests/cases/compiler/emitThisInSuperMethodCall.ts(17,17): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class +tests/cases/compiler/emitThisInSuperMethodCall.ts(23,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class + + ==== tests/cases/compiler/emitThisInSuperMethodCall.ts (3 errors) ==== class User { sayHello() { @@ -10,7 +15,7 @@ function inner() { super.sayHello(); ~~~~~ -!!! 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class +!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class } }; } @@ -19,7 +24,7 @@ () => { super.sayHello(); ~~~~~ -!!! 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class +!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class } } } @@ -27,7 +32,7 @@ function inner() { super.sayHello(); ~~~~~ -!!! 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class +!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class } } } diff --git a/tests/baselines/reference/emptyExpr.js b/tests/baselines/reference/emptyExpr.js index 36fd5ccee19..de3bddeba1e 100644 --- a/tests/baselines/reference/emptyExpr.js +++ b/tests/baselines/reference/emptyExpr.js @@ -2,4 +2,4 @@ [{},] //// [emptyExpr.js] -[{}, ]; +[{},]; diff --git a/tests/baselines/reference/emptyGenericParamList.errors.txt b/tests/baselines/reference/emptyGenericParamList.errors.txt index 841c41be084..361e5a2fc21 100644 --- a/tests/baselines/reference/emptyGenericParamList.errors.txt +++ b/tests/baselines/reference/emptyGenericParamList.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/emptyGenericParamList.ts(2,9): error TS1099: Type argument list cannot be empty. +tests/cases/compiler/emptyGenericParamList.ts(2,8): error TS2314: Generic type 'I' requires 1 type argument(s). + + ==== tests/cases/compiler/emptyGenericParamList.ts (2 errors) ==== class I {} var x: I<>; ~~ -!!! Type argument list cannot be empty. +!!! error TS1099: Type argument list cannot be empty. ~~~ -!!! Generic type 'I' requires 1 type argument(s). \ No newline at end of file +!!! error TS2314: Generic type 'I' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/emptyMemberAccess.errors.txt b/tests/baselines/reference/emptyMemberAccess.errors.txt index 19c24099d94..847e69e4b51 100644 --- a/tests/baselines/reference/emptyMemberAccess.errors.txt +++ b/tests/baselines/reference/emptyMemberAccess.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/emptyMemberAccess.ts(3,5): error TS1109: Expression expected. + + ==== tests/cases/compiler/emptyMemberAccess.ts (1 errors) ==== function getObj() { ().toString(); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. } \ No newline at end of file diff --git a/tests/baselines/reference/emptyTypeArgumentList.errors.txt b/tests/baselines/reference/emptyTypeArgumentList.errors.txt index e05930401f7..51efea14cb1 100644 --- a/tests/baselines/reference/emptyTypeArgumentList.errors.txt +++ b/tests/baselines/reference/emptyTypeArgumentList.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/emptyTypeArgumentList.ts(2,4): error TS1099: Type argument list cannot be empty. +tests/cases/compiler/emptyTypeArgumentList.ts(2,1): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/emptyTypeArgumentList.ts (2 errors) ==== function foo() { } foo<>(); ~~ -!!! Type argument list cannot be empty. +!!! error TS1099: Type argument list cannot be empty. ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt b/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt index aad58ddfdce..538d0abb264 100644 --- a/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt +++ b/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,8): error TS1099: Type argument list cannot be empty. +tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,1): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/emptyTypeArgumentListWithNew.ts (2 errors) ==== class foo { } new foo<>(); ~~ -!!! Type argument list cannot be empty. +!!! error TS1099: Type argument list cannot be empty. ~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/enumAssignability.errors.txt b/tests/baselines/reference/enumAssignability.errors.txt index 3a581b3cd1a..018cd119b05 100644 --- a/tests/baselines/reference/enumAssignability.errors.txt +++ b/tests/baselines/reference/enumAssignability.errors.txt @@ -1,3 +1,33 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(9,1): error TS2323: Type 'F' is not assignable to type 'E'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(10,1): error TS2323: Type 'E' is not assignable to type 'F'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(29,9): error TS2323: Type 'E' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(30,9): error TS2323: Type 'E' is not assignable to type 'boolean'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(31,9): error TS2322: Type 'E' is not assignable to type 'Date': + Property 'toDateString' is missing in type 'Number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(33,9): error TS2323: Type 'E' is not assignable to type 'void'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(36,9): error TS2323: Type 'E' is not assignable to type '() => {}'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(37,9): error TS2322: Type 'E' is not assignable to type 'Function': + Property 'apply' is missing in type 'Number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(38,9): error TS2323: Type 'E' is not assignable to type '(x: number) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(39,5): error TS2322: Type 'E' is not assignable to type 'C': + Property 'foo' is missing in type 'Number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(40,5): error TS2322: Type 'E' is not assignable to type 'I': + Property 'foo' is missing in type 'Number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(41,9): error TS2322: Type 'E' is not assignable to type 'number[]': + Property 'length' is missing in type 'Number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(42,9): error TS2322: Type 'E' is not assignable to type '{ foo: string; }': + Property 'foo' is missing in type 'Number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(43,9): error TS2323: Type 'E' is not assignable to type '(x: T) => T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(45,9): error TS2322: Type 'E' is not assignable to type 'String': + Property 'charAt' is missing in type 'Number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(47,21): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(48,9): error TS2323: Type 'E' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(49,9): error TS2323: Type 'E' is not assignable to type 'U'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(50,9): error TS2323: Type 'E' is not assignable to type 'V'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(51,13): error TS2323: Type 'E' is not assignable to type 'A'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(52,13): error TS2323: Type 'E' is not assignable to type 'B'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts (21 errors) ==== // enums assignable to number, any, Object, errors unless otherwise noted @@ -9,10 +39,10 @@ e = f; ~ -!!! Type 'F' is not assignable to type 'E'. +!!! error TS2323: Type 'F' is not assignable to type 'E'. f = e; ~ -!!! Type 'E' is not assignable to type 'F'. +!!! error TS2323: Type 'E' is not assignable to type 'F'. e = 1; // ok f = 1; // ok var x: number = e; // ok @@ -33,72 +63,72 @@ var b: number = e; // ok var c: string = e; ~ -!!! Type 'E' is not assignable to type 'string'. +!!! error TS2323: Type 'E' is not assignable to type 'string'. var d: boolean = e; ~ -!!! Type 'E' is not assignable to type 'boolean'. +!!! error TS2323: Type 'E' is not assignable to type 'boolean'. var ee: Date = e; ~~ -!!! Type 'E' is not assignable to type 'Date': -!!! Property 'toDateString' is missing in type 'Number'. +!!! error TS2322: Type 'E' is not assignable to type 'Date': +!!! error TS2322: Property 'toDateString' is missing in type 'Number'. var f: any = e; // ok var g: void = e; ~ -!!! Type 'E' is not assignable to type 'void'. +!!! error TS2323: Type 'E' is not assignable to type 'void'. var h: Object = e; var i: {} = e; var j: () => {} = e; ~ -!!! Type 'E' is not assignable to type '() => {}'. +!!! error TS2323: Type 'E' is not assignable to type '() => {}'. var k: Function = e; ~ -!!! Type 'E' is not assignable to type 'Function': -!!! Property 'apply' is missing in type 'Number'. +!!! error TS2322: Type 'E' is not assignable to type 'Function': +!!! error TS2322: Property 'apply' is missing in type 'Number'. var l: (x: number) => string = e; ~ -!!! Type 'E' is not assignable to type '(x: number) => string'. +!!! error TS2323: Type 'E' is not assignable to type '(x: number) => string'. ac = e; ~~ -!!! Type 'E' is not assignable to type 'C': -!!! Property 'foo' is missing in type 'Number'. +!!! error TS2322: Type 'E' is not assignable to type 'C': +!!! error TS2322: Property 'foo' is missing in type 'Number'. ai = e; ~~ -!!! Type 'E' is not assignable to type 'I': -!!! Property 'foo' is missing in type 'Number'. +!!! error TS2322: Type 'E' is not assignable to type 'I': +!!! error TS2322: Property 'foo' is missing in type 'Number'. var m: number[] = e; ~ -!!! Type 'E' is not assignable to type 'number[]': -!!! Property 'length' is missing in type 'Number'. +!!! error TS2322: Type 'E' is not assignable to type 'number[]': +!!! error TS2322: Property 'length' is missing in type 'Number'. var n: { foo: string } = e; ~ -!!! Type 'E' is not assignable to type '{ foo: string; }': -!!! Property 'foo' is missing in type 'Number'. +!!! error TS2322: Type 'E' is not assignable to type '{ foo: string; }': +!!! error TS2322: Property 'foo' is missing in type 'Number'. var o: (x: T) => T = e; ~ -!!! Type 'E' is not assignable to type '(x: T) => T'. +!!! error TS2323: Type 'E' is not assignable to type '(x: T) => T'. var p: Number = e; var q: String = e; ~ -!!! Type 'E' is not assignable to type 'String': -!!! Property 'charAt' is missing in type 'Number'. +!!! error TS2322: Type 'E' is not assignable to type 'String': +!!! error TS2322: Property 'charAt' is missing in type 'Number'. function foo(x: T, y: U, z: V) { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. x = e; ~ -!!! Type 'E' is not assignable to type 'T'. +!!! error TS2323: Type 'E' is not assignable to type 'T'. y = e; ~ -!!! Type 'E' is not assignable to type 'U'. +!!! error TS2323: Type 'E' is not assignable to type 'U'. z = e; ~ -!!! Type 'E' is not assignable to type 'V'. +!!! error TS2323: Type 'E' is not assignable to type 'V'. var a: A = e; ~ -!!! Type 'E' is not assignable to type 'A'. +!!! error TS2323: Type 'E' is not assignable to type 'A'. var b: B = e; ~ -!!! Type 'E' is not assignable to type 'B'. +!!! error TS2323: Type 'E' is not assignable to type 'B'. } } \ No newline at end of file diff --git a/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt b/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt index de9232d72b1..e7c1297e1fd 100644 --- a/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts(104,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts(109,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts (2 errors) ==== // enum is only a subtype of number, no types are subtypes of enum, all of these except the first are errors @@ -104,11 +108,11 @@ var r4 = foo16(E.A); ~~ -!!! Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. declare function foo17(x: {}): {}; declare function foo17(x: E): E; var r4 = foo16(E.A); ~~ -!!! Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. \ No newline at end of file diff --git a/tests/baselines/reference/enumAssignmentCompat.errors.txt b/tests/baselines/reference/enumAssignmentCompat.errors.txt index 7e4c97231e9..4048ac104c6 100644 --- a/tests/baselines/reference/enumAssignmentCompat.errors.txt +++ b/tests/baselines/reference/enumAssignmentCompat.errors.txt @@ -1,3 +1,12 @@ +tests/cases/compiler/enumAssignmentCompat.ts(26,5): error TS2323: Type 'typeof W' is not assignable to type 'number'. +tests/cases/compiler/enumAssignmentCompat.ts(28,5): error TS2322: Type 'W' is not assignable to type 'typeof W': + Property 'D' is missing in type 'Number'. +tests/cases/compiler/enumAssignmentCompat.ts(30,5): error TS2323: Type 'number' is not assignable to type 'typeof W'. +tests/cases/compiler/enumAssignmentCompat.ts(32,5): error TS2322: Type 'W' is not assignable to type 'WStatic': + Property 'a' is missing in type 'Number'. +tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2323: Type 'number' is not assignable to type 'WStatic'. + + ==== tests/cases/compiler/enumAssignmentCompat.ts (5 errors) ==== module W { export class D { } @@ -26,24 +35,24 @@ var y: typeof W = W; var z: number = W; // error ~ -!!! Type 'typeof W' is not assignable to type 'number'. +!!! error TS2323: Type 'typeof W' is not assignable to type 'number'. var a: number = W.a; var b: typeof W = W.a; // error ~ -!!! Type 'W' is not assignable to type 'typeof W': -!!! Property 'D' is missing in type 'Number'. +!!! error TS2322: Type 'W' is not assignable to type 'typeof W': +!!! error TS2322: Property 'D' is missing in type 'Number'. var c: typeof W.a = W.a; var d: typeof W = 3; // error ~ -!!! Type 'number' is not assignable to type 'typeof W'. +!!! error TS2323: Type 'number' is not assignable to type 'typeof W'. var e: typeof W.a = 4; var f: WStatic = W.a; // error ~ -!!! Type 'W' is not assignable to type 'WStatic': -!!! Property 'a' is missing in type 'Number'. +!!! error TS2322: Type 'W' is not assignable to type 'WStatic': +!!! error TS2322: Property 'a' is missing in type 'Number'. var g: WStatic = 5; // error ~ -!!! Type 'number' is not assignable to type 'WStatic'. +!!! error TS2323: Type 'number' is not assignable to type 'WStatic'. var h: W = 3; var i: W = W.a; i = W.a; diff --git a/tests/baselines/reference/enumAssignmentCompat2.errors.txt b/tests/baselines/reference/enumAssignmentCompat2.errors.txt index 62d4ef0d04f..52890bcecc7 100644 --- a/tests/baselines/reference/enumAssignmentCompat2.errors.txt +++ b/tests/baselines/reference/enumAssignmentCompat2.errors.txt @@ -1,3 +1,12 @@ +tests/cases/compiler/enumAssignmentCompat2.ts(25,5): error TS2323: Type 'typeof W' is not assignable to type 'number'. +tests/cases/compiler/enumAssignmentCompat2.ts(27,5): error TS2322: Type 'W' is not assignable to type 'typeof W': + Property 'a' is missing in type 'Number'. +tests/cases/compiler/enumAssignmentCompat2.ts(29,5): error TS2323: Type 'number' is not assignable to type 'typeof W'. +tests/cases/compiler/enumAssignmentCompat2.ts(31,5): error TS2322: Type 'W' is not assignable to type 'WStatic': + Property 'a' is missing in type 'Number'. +tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2323: Type 'number' is not assignable to type 'WStatic'. + + ==== tests/cases/compiler/enumAssignmentCompat2.ts (5 errors) ==== enum W { @@ -25,24 +34,24 @@ var y: typeof W = W; var z: number = W; // error ~ -!!! Type 'typeof W' is not assignable to type 'number'. +!!! error TS2323: Type 'typeof W' is not assignable to type 'number'. var a: number = W.a; var b: typeof W = W.a; // error ~ -!!! Type 'W' is not assignable to type 'typeof W': -!!! Property 'a' is missing in type 'Number'. +!!! error TS2322: Type 'W' is not assignable to type 'typeof W': +!!! error TS2322: Property 'a' is missing in type 'Number'. var c: typeof W.a = W.a; var d: typeof W = 3; // error ~ -!!! Type 'number' is not assignable to type 'typeof W'. +!!! error TS2323: Type 'number' is not assignable to type 'typeof W'. var e: typeof W.a = 4; var f: WStatic = W.a; // error ~ -!!! Type 'W' is not assignable to type 'WStatic': -!!! Property 'a' is missing in type 'Number'. +!!! error TS2322: Type 'W' is not assignable to type 'WStatic': +!!! error TS2322: Property 'a' is missing in type 'Number'. var g: WStatic = 5; // error ~ -!!! Type 'number' is not assignable to type 'WStatic'. +!!! error TS2323: Type 'number' is not assignable to type 'WStatic'. var h: W = 3; var i: W = W.a; i = W.a; diff --git a/tests/baselines/reference/enumBasics.types b/tests/baselines/reference/enumBasics.types index f775295891a..696e68eded2 100644 --- a/tests/baselines/reference/enumBasics.types +++ b/tests/baselines/reference/enumBasics.types @@ -157,8 +157,8 @@ enum E9 { // (refer to .js to validate) // Enum constant members are propagated var doNotPropagate = [ ->doNotPropagate : {}[] ->[ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z] : {}[] +>doNotPropagate : Array +>[ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z] : Array E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z >E8.B : E8 @@ -183,8 +183,8 @@ var doNotPropagate = [ ]; // Enum computed members are not propagated var doPropagate = [ ->doPropagate : {}[] ->[ E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C] : {}[] +>doPropagate : Array +>[ E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C] : Array E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C >E9.A : E9 diff --git a/tests/baselines/reference/enumBasics1.errors.txt b/tests/baselines/reference/enumBasics1.errors.txt index 6d9229341e2..fddca60bd99 100644 --- a/tests/baselines/reference/enumBasics1.errors.txt +++ b/tests/baselines/reference/enumBasics1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/enumBasics1.ts(26,5): error TS2339: Property 'A' does not exist on type 'E'. +tests/cases/compiler/enumBasics1.ts(35,2): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. + + ==== tests/cases/compiler/enumBasics1.ts (2 errors) ==== enum E { A = 1, @@ -26,7 +30,7 @@ */ E.A.A; // should error ~ -!!! Property 'A' does not exist on type 'E'. +!!! error TS2339: Property 'A' does not exist on type 'E'. enum E2 { @@ -37,6 +41,6 @@ enum E2 { // should error for continued autonumbering C, ~ -!!! In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +!!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. D, } \ No newline at end of file diff --git a/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt b/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt index 7fb893354a9..235b665cdc0 100644 --- a/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt +++ b/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,28): error TS1003: Identifier expected. +tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'. + + ==== tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts (2 errors) ==== enum Position { IgnoreRulesSpecific = 0, } var x = IgnoreRulesSpecific. + ~ +!!! error TS1003: Identifier expected. ~~~~~~~~~~~~~~~~~~~ -!!! Cannot find name 'IgnoreRulesSpecific'. +!!! error TS2304: Cannot find name 'IgnoreRulesSpecific'. var y = Position.IgnoreRulesSpecific; - ~ -!!! ',' expected. \ No newline at end of file diff --git a/tests/baselines/reference/enumConstantMembers.errors.txt b/tests/baselines/reference/enumConstantMembers.errors.txt index ac77e2b7b4e..d425b7a6f4b 100644 --- a/tests/baselines/reference/enumConstantMembers.errors.txt +++ b/tests/baselines/reference/enumConstantMembers.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/enums/enumConstantMembers.ts(12,5): error TS1061: Enum member must have initializer. +tests/cases/conformance/enums/enumConstantMembers.ts(18,5): error TS1066: Ambient enum elements can only have integer literal initializers. + + ==== tests/cases/conformance/enums/enumConstantMembers.ts (2 errors) ==== // Constant members allow negatives, but not decimals. Also hex literals are allowed enum E1 { @@ -12,7 +16,7 @@ a = 0.1, b // Error because 0.1 is not a constant ~ -!!! Enum member must have initializer. +!!! error TS1061: Enum member must have initializer. } declare enum E4 { @@ -20,5 +24,5 @@ b = -1, c = 0.1 // Not a constant ~ -!!! Ambient enum elements can only have integer literal initializers. +!!! error TS1066: Ambient enum elements can only have integer literal initializers. } \ No newline at end of file diff --git a/tests/baselines/reference/enumErrors.errors.txt b/tests/baselines/reference/enumErrors.errors.txt index 69993d81099..4f930ef2ab9 100644 --- a/tests/baselines/reference/enumErrors.errors.txt +++ b/tests/baselines/reference/enumErrors.errors.txt @@ -1,23 +1,36 @@ +tests/cases/conformance/enums/enumErrors.ts(2,6): error TS2431: Enum name cannot be 'any' +tests/cases/conformance/enums/enumErrors.ts(3,6): error TS2431: Enum name cannot be 'number' +tests/cases/conformance/enums/enumErrors.ts(4,6): error TS2431: Enum name cannot be 'string' +tests/cases/conformance/enums/enumErrors.ts(5,6): error TS2431: Enum name cannot be 'boolean' +tests/cases/conformance/enums/enumErrors.ts(9,9): error TS2323: Type 'Number' is not assignable to type 'E5'. +tests/cases/conformance/enums/enumErrors.ts(20,9): error TS2323: Type 'E9' is not assignable to type 'E10'. +tests/cases/conformance/enums/enumErrors.ts(21,9): error TS2323: Type 'E9' is not assignable to type 'E10'. +tests/cases/conformance/enums/enumErrors.ts(26,9): error TS2323: Type 'string' is not assignable to type 'E11'. +tests/cases/conformance/enums/enumErrors.ts(27,9): error TS2323: Type 'Date' is not assignable to type 'E11'. +tests/cases/conformance/enums/enumErrors.ts(28,9): error TS2304: Cannot find name 'window'. +tests/cases/conformance/enums/enumErrors.ts(29,9): error TS2323: Type '{}' is not assignable to type 'E11'. + + ==== tests/cases/conformance/enums/enumErrors.ts (11 errors) ==== // Enum named with PredefinedTypes enum any { } ~~~ -!!! Enum name cannot be 'any' +!!! error TS2431: Enum name cannot be 'any' enum number { } ~~~~~~ -!!! Enum name cannot be 'number' +!!! error TS2431: Enum name cannot be 'number' enum string { } ~~~~~~ -!!! Enum name cannot be 'string' +!!! error TS2431: Enum name cannot be 'string' enum boolean { } ~~~~~~~ -!!! Enum name cannot be 'boolean' +!!! error TS2431: Enum name cannot be 'boolean' // Enum with computed member initializer of type Number enum E5 { C = new Number(30) ~~~~~~~~~~~~~~ -!!! Type 'Number' is not assignable to type 'E5'. +!!! error TS2323: Type 'Number' is not assignable to type 'E5'. } enum E9 { @@ -30,25 +43,25 @@ enum E10 { A = E9.A, ~~~~ -!!! Type 'E9' is not assignable to type 'E10'. +!!! error TS2323: Type 'E9' is not assignable to type 'E10'. B = E9.B ~~~~ -!!! Type 'E9' is not assignable to type 'E10'. +!!! error TS2323: Type 'E9' is not assignable to type 'E10'. } // Enum with computed member intializer of other types enum E11 { A = '', ~~ -!!! Type 'string' is not assignable to type 'E11'. +!!! error TS2323: Type 'string' is not assignable to type 'E11'. B = new Date(), ~~~~~~~~~~ -!!! Type 'Date' is not assignable to type 'E11'. +!!! error TS2323: Type 'Date' is not assignable to type 'E11'. C = window, ~~~~~~ -!!! Cannot find name 'window'. +!!! error TS2304: Cannot find name 'window'. D = {} ~~ -!!! Type '{}' is not assignable to type 'E11'. +!!! error TS2323: Type '{}' is not assignable to type 'E11'. } \ No newline at end of file diff --git a/tests/baselines/reference/enumGenericTypeClash.errors.txt b/tests/baselines/reference/enumGenericTypeClash.errors.txt index df7f1d77ed0..23007175e4c 100644 --- a/tests/baselines/reference/enumGenericTypeClash.errors.txt +++ b/tests/baselines/reference/enumGenericTypeClash.errors.txt @@ -1,6 +1,12 @@ -==== tests/cases/compiler/enumGenericTypeClash.ts (1 errors) ==== +tests/cases/compiler/enumGenericTypeClash.ts(1,7): error TS2300: Duplicate identifier 'X'. +tests/cases/compiler/enumGenericTypeClash.ts(2,6): error TS2300: Duplicate identifier 'X'. + + +==== tests/cases/compiler/enumGenericTypeClash.ts (2 errors) ==== class X { } + ~ +!!! error TS2300: Duplicate identifier 'X'. enum X { MyVal } ~ -!!! Duplicate identifier 'X'. +!!! error TS2300: Duplicate identifier 'X'. \ No newline at end of file diff --git a/tests/baselines/reference/enumIdenticalIdentifierValues.errors.txt b/tests/baselines/reference/enumIdenticalIdentifierValues.errors.txt deleted file mode 100644 index 0ddd45d5ed9..00000000000 --- a/tests/baselines/reference/enumIdenticalIdentifierValues.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -==== tests/cases/compiler/enumIdenticalIdentifierValues.ts (1 errors) ==== - enum Enum { - 1, - 1.0 - ~~~ -!!! Duplicate identifier '1.0'. - } \ No newline at end of file diff --git a/tests/baselines/reference/enumIdenticalIdentifierValues.js b/tests/baselines/reference/enumIdenticalIdentifierValues.js deleted file mode 100644 index 3f435ac6537..00000000000 --- a/tests/baselines/reference/enumIdenticalIdentifierValues.js +++ /dev/null @@ -1,12 +0,0 @@ -//// [enumIdenticalIdentifierValues.ts] -enum Enum { - 1, - 1.0 -} - -//// [enumIdenticalIdentifierValues.js] -var Enum; -(function (Enum) { - Enum[Enum["1"] = 0] = "1"; - Enum[Enum["1"] = 1] = "1"; -})(Enum || (Enum = {})); diff --git a/tests/baselines/reference/enumIdentifierLiterals.errors.txt b/tests/baselines/reference/enumIdentifierLiterals.errors.txt new file mode 100644 index 00000000000..6327e40289a --- /dev/null +++ b/tests/baselines/reference/enumIdentifierLiterals.errors.txt @@ -0,0 +1,25 @@ +tests/cases/compiler/enumIdentifierLiterals.ts(2,5): error TS1151: An enum member cannot have a numeric name. +tests/cases/compiler/enumIdentifierLiterals.ts(3,5): error TS1151: An enum member cannot have a numeric name. +tests/cases/compiler/enumIdentifierLiterals.ts(4,5): error TS1151: An enum member cannot have a numeric name. +tests/cases/compiler/enumIdentifierLiterals.ts(5,5): error TS1151: An enum member cannot have a numeric name. +tests/cases/compiler/enumIdentifierLiterals.ts(6,5): error TS1151: An enum member cannot have a numeric name. + + +==== tests/cases/compiler/enumIdentifierLiterals.ts (5 errors) ==== + enum Nums { + 1.0, + ~~~ +!!! error TS1151: An enum member cannot have a numeric name. + 11e-1, + ~~~~~ +!!! error TS1151: An enum member cannot have a numeric name. + 0.12e1, + ~~~~~~ +!!! error TS1151: An enum member cannot have a numeric name. + "13e-1", + ~~~~~~~ +!!! error TS1151: An enum member cannot have a numeric name. + 0xF00D + ~~~~~~ +!!! error TS1151: An enum member cannot have a numeric name. + } \ No newline at end of file diff --git a/tests/baselines/reference/enumIdentifierLiterals.types b/tests/baselines/reference/enumIdentifierLiterals.types deleted file mode 100644 index b259e57d1dd..00000000000 --- a/tests/baselines/reference/enumIdentifierLiterals.types +++ /dev/null @@ -1,10 +0,0 @@ -=== tests/cases/compiler/enumIdentifierLiterals.ts === -enum Nums { ->Nums : Nums - - 1.0, - 11e-1, - 0.12e1, - "13e-1", - 0xF00D -} diff --git a/tests/baselines/reference/enumInitializersWithExponents.errors.txt b/tests/baselines/reference/enumInitializersWithExponents.errors.txt index 60649475f78..c4338cdf78b 100644 --- a/tests/baselines/reference/enumInitializersWithExponents.errors.txt +++ b/tests/baselines/reference/enumInitializersWithExponents.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/enumInitializersWithExponents.ts(5,5): error TS1066: Ambient enum elements can only have integer literal initializers. +tests/cases/compiler/enumInitializersWithExponents.ts(6,5): error TS1066: Ambient enum elements can only have integer literal initializers. + + ==== tests/cases/compiler/enumInitializersWithExponents.ts (2 errors) ==== // Must be integer literals. declare enum E { @@ -5,10 +9,10 @@ b = 1e25, // ok c = 1e-3, // error ~ -!!! Ambient enum elements can only have integer literal initializers. +!!! error TS1066: Ambient enum elements can only have integer literal initializers. d = 1e-9, // error ~ -!!! Ambient enum elements can only have integer literal initializers. +!!! error TS1066: Ambient enum elements can only have integer literal initializers. e = 1e0, // ok f = 1e+25 // ok } \ No newline at end of file diff --git a/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt b/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt index 28798c1e476..e5c341b34df 100644 --- a/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt +++ b/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt @@ -1,3 +1,22 @@ +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(18,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'string'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(24,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'boolean'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(30,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'Date'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(36,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'RegExp'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(42,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type '{ bar: number; }'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(48,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'number[]'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(54,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'I8'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(60,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'A'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(66,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'A2'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(72,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type '(x: any) => number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(78,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type '(x: T) => T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(85,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'E2'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(95,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'typeof f'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(105,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'typeof c'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(111,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(115,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts(117,5): error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'U'. + + ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber.ts (17 errors) ==== // enums are only subtypes of number, any and no other types @@ -18,7 +37,7 @@ [x: string]: string; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'string'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'string'. } @@ -26,7 +45,7 @@ [x: string]: boolean; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'boolean'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'boolean'. } @@ -34,7 +53,7 @@ [x: string]: Date; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'Date'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'Date'. } @@ -42,7 +61,7 @@ [x: string]: RegExp; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'RegExp'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'RegExp'. } @@ -50,7 +69,7 @@ [x: string]: { bar: number }; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type '{ bar: number; }'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type '{ bar: number; }'. } @@ -58,7 +77,7 @@ [x: string]: number[]; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'number[]'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'number[]'. } @@ -66,7 +85,7 @@ [x: string]: I8; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'I8'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'I8'. } class A { foo: number; } @@ -74,7 +93,7 @@ [x: string]: A; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'A'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'A'. } class A2 { foo: T; } @@ -82,7 +101,7 @@ [x: string]: A2; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'A2'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'A2'. } @@ -90,7 +109,7 @@ [x: string]: (x) => number; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type '(x: any) => number'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type '(x: any) => number'. } @@ -98,7 +117,7 @@ [x: string]: (x: T) => T; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type '(x: T) => T'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type '(x: T) => T'. } @@ -107,7 +126,7 @@ [x: string]: E2; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'E2'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'E2'. } @@ -119,7 +138,7 @@ [x: string]: typeof f; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'typeof f'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'typeof f'. } @@ -131,7 +150,7 @@ [x: string]: typeof c; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'typeof c'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'typeof c'. } @@ -139,17 +158,17 @@ [x: string]: T; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'T'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'T'. } interface I18 { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. [x: string]: U; foo: E; ~~~~~~~ -!!! Property 'foo' of type 'E' is not assignable to string index type 'U'. +!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'U'. } diff --git a/tests/baselines/reference/enumMemberResolution.errors.txt b/tests/baselines/reference/enumMemberResolution.errors.txt index 71f6f8e45b5..5c84c08d984 100644 --- a/tests/baselines/reference/enumMemberResolution.errors.txt +++ b/tests/baselines/reference/enumMemberResolution.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/enumMemberResolution.ts(4,28): error TS1003: Identifier expected. +tests/cases/compiler/enumMemberResolution.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'. + + ==== tests/cases/compiler/enumMemberResolution.ts (2 errors) ==== enum Position2 { IgnoreRulesSpecific = 0 } var x = IgnoreRulesSpecific. // error + ~ +!!! error TS1003: Identifier expected. ~~~~~~~~~~~~~~~~~~~ -!!! Cannot find name 'IgnoreRulesSpecific'. +!!! error TS2304: Cannot find name 'IgnoreRulesSpecific'. var y = 1; - ~ -!!! ',' expected. var z = Position2.IgnoreRulesSpecific; // no error \ No newline at end of file diff --git a/tests/baselines/reference/enumMergingErrors.errors.txt b/tests/baselines/reference/enumMergingErrors.errors.txt index 30cf6ef18cd..08f8d3a2716 100644 --- a/tests/baselines/reference/enumMergingErrors.errors.txt +++ b/tests/baselines/reference/enumMergingErrors.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/enums/enumMergingErrors.ts(26,22): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +tests/cases/conformance/enums/enumMergingErrors.ts(38,22): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. + + ==== tests/cases/conformance/enums/enumMergingErrors.ts (2 errors) ==== // Enum with constant, computed, constant members split across 3 declarations with the same root module module M { @@ -26,7 +30,7 @@ module M1 { export enum E1 { C } ~ -!!! In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +!!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. } @@ -40,7 +44,7 @@ module M2 { export enum E1 { C } ~ -!!! In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +!!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. } diff --git a/tests/baselines/reference/enumPropertyAccess.errors.txt b/tests/baselines/reference/enumPropertyAccess.errors.txt index 6a9886c0968..666e9297120 100644 --- a/tests/baselines/reference/enumPropertyAccess.errors.txt +++ b/tests/baselines/reference/enumPropertyAccess.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/enumPropertyAccess.ts(7,11): error TS2339: Property 'Green' does not exist on type 'Colors'. +tests/cases/compiler/enumPropertyAccess.ts(12,7): error TS2339: Property 'Green' does not exist on type 'B'. + + ==== tests/cases/compiler/enumPropertyAccess.ts (2 errors) ==== enum Colors { Red, @@ -7,13 +11,13 @@ var x = Colors.Red; // type of 'x' should be 'Colors' var p = x.Green; // error ~~~~~ -!!! Property 'Green' does not exist on type 'Colors'. +!!! error TS2339: Property 'Green' does not exist on type 'Colors'. x.toFixed(); // ok // Now with generics function fill(f: B) { f.Green; // error ~~~~~ -!!! Property 'Green' does not exist on type 'B'. +!!! error TS2339: Property 'Green' does not exist on type 'B'. f.toFixed(); // ok } \ No newline at end of file diff --git a/tests/baselines/reference/enumWithParenthesizedInitializer1.errors.txt b/tests/baselines/reference/enumWithParenthesizedInitializer1.errors.txt index 9279067d7fa..b1dca1d501e 100644 --- a/tests/baselines/reference/enumWithParenthesizedInitializer1.errors.txt +++ b/tests/baselines/reference/enumWithParenthesizedInitializer1.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/enumWithParenthesizedInitializer1.ts(3,1): error TS1005: ')' expected. + + ==== tests/cases/compiler/enumWithParenthesizedInitializer1.ts (1 errors) ==== enum E { e = -(3 } ~ -!!! ')' expected. \ No newline at end of file +!!! error TS1005: ')' expected. \ No newline at end of file diff --git a/tests/baselines/reference/enumWithPrimitiveName.errors.txt b/tests/baselines/reference/enumWithPrimitiveName.errors.txt index 6274cdcd43d..403c0855ebb 100644 --- a/tests/baselines/reference/enumWithPrimitiveName.errors.txt +++ b/tests/baselines/reference/enumWithPrimitiveName.errors.txt @@ -1,10 +1,15 @@ +tests/cases/compiler/enumWithPrimitiveName.ts(1,6): error TS2431: Enum name cannot be 'string' +tests/cases/compiler/enumWithPrimitiveName.ts(2,6): error TS2431: Enum name cannot be 'number' +tests/cases/compiler/enumWithPrimitiveName.ts(3,6): error TS2431: Enum name cannot be 'any' + + ==== tests/cases/compiler/enumWithPrimitiveName.ts (3 errors) ==== enum string { } ~~~~~~ -!!! Enum name cannot be 'string' +!!! error TS2431: Enum name cannot be 'string' enum number { } ~~~~~~ -!!! Enum name cannot be 'number' +!!! error TS2431: Enum name cannot be 'number' enum any { } ~~~ -!!! Enum name cannot be 'any' \ No newline at end of file +!!! error TS2431: Enum name cannot be 'any' \ No newline at end of file diff --git a/tests/baselines/reference/enumWithoutInitializerAfterComputedMember.errors.txt b/tests/baselines/reference/enumWithoutInitializerAfterComputedMember.errors.txt index 571bb6906e5..876c04a0322 100644 --- a/tests/baselines/reference/enumWithoutInitializerAfterComputedMember.errors.txt +++ b/tests/baselines/reference/enumWithoutInitializerAfterComputedMember.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/enumWithoutInitializerAfterComputedMember.ts(4,5): error TS1061: Enum member must have initializer. + + ==== tests/cases/compiler/enumWithoutInitializerAfterComputedMember.ts (1 errors) ==== enum E { a, b = a, c ~ -!!! Enum member must have initializer. +!!! error TS1061: Enum member must have initializer. } \ No newline at end of file diff --git a/tests/baselines/reference/enumsWithMultipleDeclarations1.errors.txt b/tests/baselines/reference/enumsWithMultipleDeclarations1.errors.txt index d2336e905c5..7c90dc4eda5 100644 --- a/tests/baselines/reference/enumsWithMultipleDeclarations1.errors.txt +++ b/tests/baselines/reference/enumsWithMultipleDeclarations1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/enumsWithMultipleDeclarations1.ts(6,3): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +tests/cases/compiler/enumsWithMultipleDeclarations1.ts(10,3): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. + + ==== tests/cases/compiler/enumsWithMultipleDeclarations1.ts (2 errors) ==== enum E { A @@ -6,11 +10,11 @@ enum E { B ~ -!!! In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +!!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. } enum E { C ~ -!!! In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +!!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. } \ No newline at end of file diff --git a/tests/baselines/reference/enumsWithMultipleDeclarations2.errors.txt b/tests/baselines/reference/enumsWithMultipleDeclarations2.errors.txt index ef7040dd946..c072809b5cb 100644 --- a/tests/baselines/reference/enumsWithMultipleDeclarations2.errors.txt +++ b/tests/baselines/reference/enumsWithMultipleDeclarations2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/enumsWithMultipleDeclarations2.ts(10,3): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. + + ==== tests/cases/compiler/enumsWithMultipleDeclarations2.ts (1 errors) ==== enum E { A @@ -10,5 +13,5 @@ enum E { C ~ -!!! In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +!!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. } \ No newline at end of file diff --git a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.errors.txt b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.errors.txt index 4a94b22ee76..f0976ba7398 100644 --- a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.errors.txt +++ b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/errorForwardReferenceForwadingConstructor.ts(4,14): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/errorForwardReferenceForwadingConstructor.ts (1 errors) ==== // Error forward referencing derived class with forwarding constructor function f() { var d1 = new derived(); ~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var d2 = new derived(4); } diff --git a/tests/baselines/reference/errorHandlingInInstanceOf.errors.txt b/tests/baselines/reference/errorHandlingInInstanceOf.errors.txt new file mode 100644 index 00000000000..e4db287fcdd --- /dev/null +++ b/tests/baselines/reference/errorHandlingInInstanceOf.errors.txt @@ -0,0 +1,15 @@ +tests/cases/compiler/errorHandlingInInstanceOf.ts(1,5): error TS2304: Cannot find name 'x'. +tests/cases/compiler/errorHandlingInInstanceOf.ts(5,18): error TS2304: Cannot find name 'UnknownType'. + + +==== tests/cases/compiler/errorHandlingInInstanceOf.ts (2 errors) ==== + if (x instanceof String) { + ~ +!!! error TS2304: Cannot find name 'x'. + } + + var y: any; + if (y instanceof UnknownType) { + ~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'UnknownType'. + } \ No newline at end of file diff --git a/tests/baselines/reference/errorHandlingInInstanceOf.js b/tests/baselines/reference/errorHandlingInInstanceOf.js new file mode 100644 index 00000000000..b98e2bf8a77 --- /dev/null +++ b/tests/baselines/reference/errorHandlingInInstanceOf.js @@ -0,0 +1,14 @@ +//// [errorHandlingInInstanceOf.ts] +if (x instanceof String) { +} + +var y: any; +if (y instanceof UnknownType) { +} + +//// [errorHandlingInInstanceOf.js] +if (x instanceof String) { +} +var y; +if (y instanceof UnknownType) { +} diff --git a/tests/baselines/reference/errorLocationForInterfaceExtension.errors.txt b/tests/baselines/reference/errorLocationForInterfaceExtension.errors.txt index a015fc902ab..f385d0afcb3 100644 --- a/tests/baselines/reference/errorLocationForInterfaceExtension.errors.txt +++ b/tests/baselines/reference/errorLocationForInterfaceExtension.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/errorLocationForInterfaceExtension.ts(3,21): error TS2304: Cannot find name 'string'. + + ==== tests/cases/compiler/errorLocationForInterfaceExtension.ts (1 errors) ==== var n = ''; interface x extends string { } ~~~~~~ -!!! Cannot find name 'string'. +!!! error TS2304: Cannot find name 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/errorMessageOnObjectLiteralType.errors.txt b/tests/baselines/reference/errorMessageOnObjectLiteralType.errors.txt index 9b19634265d..04b80fb1104 100644 --- a/tests/baselines/reference/errorMessageOnObjectLiteralType.errors.txt +++ b/tests/baselines/reference/errorMessageOnObjectLiteralType.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/errorMessageOnObjectLiteralType.ts(5,3): error TS2339: Property 'getOwnPropertyNamess' does not exist on type '{ a: string; b: number; }'. +tests/cases/compiler/errorMessageOnObjectLiteralType.ts(6,8): error TS2339: Property 'getOwnPropertyNamess' does not exist on type '{ (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; }'. + + ==== tests/cases/compiler/errorMessageOnObjectLiteralType.ts (2 errors) ==== var x: { a: string; @@ -5,7 +9,7 @@ }; x.getOwnPropertyNamess(); ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'getOwnPropertyNamess' does not exist on type '{ a: string; b: number; }'. +!!! error TS2339: Property 'getOwnPropertyNamess' does not exist on type '{ a: string; b: number; }'. Object.getOwnPropertyNamess(null); ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'getOwnPropertyNamess' does not exist on type '{ (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; }'. \ No newline at end of file +!!! error TS2339: Property 'getOwnPropertyNamess' does not exist on type '{ (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; }'. \ No newline at end of file diff --git a/tests/baselines/reference/errorOnContextuallyTypedReturnType.errors.txt b/tests/baselines/reference/errorOnContextuallyTypedReturnType.errors.txt index 414fa7dc4c2..c832230f343 100644 --- a/tests/baselines/reference/errorOnContextuallyTypedReturnType.errors.txt +++ b/tests/baselines/reference/errorOnContextuallyTypedReturnType.errors.txt @@ -1,9 +1,14 @@ +tests/cases/compiler/errorOnContextuallyTypedReturnType.ts(1,5): error TS2322: Type '() => void' is not assignable to type '() => boolean': + Type 'void' is not assignable to type 'boolean'. +tests/cases/compiler/errorOnContextuallyTypedReturnType.ts(2,37): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. + + ==== tests/cases/compiler/errorOnContextuallyTypedReturnType.ts (2 errors) ==== var n1: () => boolean = function () { }; // expect an error here ~~ -!!! Type '() => void' is not assignable to type '() => boolean': -!!! Type 'void' is not assignable to type 'boolean'. +!!! error TS2322: Type '() => void' is not assignable to type '() => boolean': +!!! error TS2322: Type 'void' is not assignable to type 'boolean'. var n2: () => boolean = function ():boolean { }; // expect an error here ~~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. \ No newline at end of file diff --git a/tests/baselines/reference/errorSuperCalls.errors.txt b/tests/baselines/reference/errorSuperCalls.errors.txt index 7e85cc07ee7..4369b4b4ab2 100644 --- a/tests/baselines/reference/errorSuperCalls.errors.txt +++ b/tests/baselines/reference/errorSuperCalls.errors.txt @@ -1,68 +1,90 @@ +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(13,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(17,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(33,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(37,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(46,14): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(66,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(70,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(4,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(9,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(14,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(18,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(22,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(26,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(30,16): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(34,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(38,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(58,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(62,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(67,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(71,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + + ==== tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts (20 errors) ==== //super call in class constructor with no base type class NoBase { constructor() { super(); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } //super call in class member function with no base type fn() { super(); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } //super call in class accessor (get and set) with no base type get foo() { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super(); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. return null; } set foo(v) { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super(); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } //super call in class member initializer with no base type p = super(); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. //super call in static class member function with no base type static fn() { super(); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } //super call in static class member initializer with no base type static k = super(); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. //super call in static class accessor (get and set) with no base type static get q() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super(); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. return null; } static set q(n) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super(); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } } @@ -72,7 +94,7 @@ constructor() { super(); ~ -!!! 'super' must be followed by an argument list or member access. +!!! error TS1034: 'super' must be followed by an argument list or member access. super(); } } @@ -86,30 +108,30 @@ //super call in class member initializer of derived type t = super(); ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors fn() { //super call in class member function of derived type super(); ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors } //super call in class accessor (get and set) of derived type get foo() { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super(); ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors return null; } set foo(n) { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super(); ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors } } \ No newline at end of file diff --git a/tests/baselines/reference/errorSuperPropertyAccess.errors.txt b/tests/baselines/reference/errorSuperPropertyAccess.errors.txt index 9833e64eba5..e192e99b87f 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.errors.txt +++ b/tests/baselines/reference/errorSuperPropertyAccess.errors.txt @@ -1,3 +1,43 @@ +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(24,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(29,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(68,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(94,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(98,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(113,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(6,17): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(7,17): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(11,17): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(12,17): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(15,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(16,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(21,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(25,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(30,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(57,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(61,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(65,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(69,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(73,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(76,40): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(87,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(91,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(95,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(99,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(109,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(110,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(111,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(114,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(115,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(116,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(120,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(121,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(122,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(127,16): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(127,30): error TS2335: 'super' can only be referenced in a derived class. + + ==== tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts (38 errors) ==== //super property access in constructor of class with no base type //super property access in instance member function of class with no base type @@ -6,51 +46,51 @@ constructor() { var a = super.prototype; ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. var b = super.hasOwnProperty(''); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } fn() { var a = super.prototype; ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. var b = super.hasOwnProperty(''); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } m = super.prototype; ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. n = super.hasOwnProperty(''); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. //super static property access in static member function of class with no base type //super static property access in static member accessor(get and set) of class with no base type public static static1() { super.hasOwnProperty(''); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } public static get static2() { ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super.hasOwnProperty(''); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. return ''; } public static set static2(n) { ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super.hasOwnProperty(''); ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. } } @@ -79,40 +119,40 @@ super(); super.publicMember = 1; ~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } fn() { var x = super.publicMember; ~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } get a() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = super.publicMember; ~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword return undefined; } set a(n) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. n = super.publicMember; ~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } fn2() { function inner() { super.publicFunc(); ~~~~~ -!!! 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class +!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class } var x = { test: function () { return super.publicFunc(); } ~~~~~ -!!! 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class +!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class } } } @@ -125,29 +165,29 @@ super(); super.privateMember = 1; ~~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } fn() { var x = super.privateMember; ~~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } get a() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = super.privateMember; ~~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword return undefined; } set a(n) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. n = super.privateMember; ~~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } } @@ -159,47 +199,47 @@ static fn() { super.publicStaticMember = 3; ~~~~~~~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticMember = 3; ~~~~~~~~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticFunc(); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Property 'SomeBase.privateStaticFunc' is inaccessible. +!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. } static get a() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super.publicStaticMember = 3; ~~~~~~~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticMember = 3; ~~~~~~~~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticFunc(); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Property 'SomeBase.privateStaticFunc' is inaccessible. +!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. return ''; } static set a(n) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super.publicStaticMember = 3; ~~~~~~~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticMember = 3; ~~~~~~~~~~~~~~~~~~~ -!!! Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticFunc(); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Property 'SomeBase.privateStaticFunc' is inaccessible. +!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. } } // In object literal var obj = { n: super.wat, p: super.foo() }; ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. ~~~~~ -!!! 'super' can only be referenced in a derived class. +!!! error TS2335: 'super' can only be referenced in a derived class. \ No newline at end of file diff --git a/tests/baselines/reference/errorSupression1.errors.txt b/tests/baselines/reference/errorSupression1.errors.txt index f702ea6e643..206a78ebf45 100644 --- a/tests/baselines/reference/errorSupression1.errors.txt +++ b/tests/baselines/reference/errorSupression1.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/errorSupression1.ts(4,15): error TS2339: Property 'b' does not exist on type 'typeof Foo'. + + ==== tests/cases/compiler/errorSupression1.ts (1 errors) ==== class Foo { static bar() { return "x"; } } var baz = Foo.b; ~ -!!! Property 'b' does not exist on type 'typeof Foo'. +!!! error TS2339: Property 'b' does not exist on type 'typeof Foo'. // Foo.b won't bind. baz.concat("y"); diff --git a/tests/baselines/reference/errorTypesAsTypeArguments.errors.txt b/tests/baselines/reference/errorTypesAsTypeArguments.errors.txt index 90c3f43dc4e..44f95ca29e6 100644 --- a/tests/baselines/reference/errorTypesAsTypeArguments.errors.txt +++ b/tests/baselines/reference/errorTypesAsTypeArguments.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/errorTypesAsTypeArguments.ts(2,16): error TS2304: Cannot find name 'B'. +tests/cases/compiler/errorTypesAsTypeArguments.ts(2,25): error TS2304: Cannot find name 'C'. + + ==== tests/cases/compiler/errorTypesAsTypeArguments.ts (2 errors) ==== interface Foo { bar(baz: Foo): Foo; ~ -!!! Cannot find name 'B'. +!!! error TS2304: Cannot find name 'B'. ~ -!!! Cannot find name 'C'. +!!! error TS2304: Cannot find name 'C'. } \ No newline at end of file diff --git a/tests/baselines/reference/errorWithTruncatedType.errors.txt b/tests/baselines/reference/errorWithTruncatedType.errors.txt index 7d3cab5f3c5..f16dce347a5 100644 --- a/tests/baselines/reference/errorWithTruncatedType.errors.txt +++ b/tests/baselines/reference/errorWithTruncatedType.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/errorWithTruncatedType.ts(11,5): error TS2323: Type '{ propertyWithAnExceedinglyLongName1: string; propertyWithAnExceedinglyLongName2: string; propert...' is not assignable to type 'string'. + + ==== tests/cases/compiler/errorWithTruncatedType.ts (1 errors) ==== var x: { @@ -11,5 +14,5 @@ // String representation of type of 'x' should be truncated in error message var s: string = x; ~ -!!! Type '{ propertyWithAnExceedinglyLongName1: string; propertyWithAnExceedinglyLongName2: string; propert...' is not assignable to type 'string'. +!!! error TS2323: Type '{ propertyWithAnExceedinglyLongName1: string; propertyWithAnExceedinglyLongName2: string; propert...' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/errorsInGenericTypeReference.errors.txt b/tests/baselines/reference/errorsInGenericTypeReference.errors.txt index 0dc6b5a0ab0..dcb5018f035 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.errors.txt +++ b/tests/baselines/reference/errorsInGenericTypeReference.errors.txt @@ -1,3 +1,27 @@ +tests/cases/compiler/errorsInGenericTypeReference.ts(25,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/errorsInGenericTypeReference.ts(12,17): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(18,31): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(23,29): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(24,36): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(25,27): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(26,24): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(31,36): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(35,36): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(39,17): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(43,33): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(45,41): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(48,27): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(52,25): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(57,35): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(61,39): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(66,22): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(66,38): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(67,27): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(68,24): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(68,40): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(69,24): error TS2304: Cannot find name 'V'. + + ==== tests/cases/compiler/errorsInGenericTypeReference.ts (22 errors) ==== interface IFoo { } @@ -12,7 +36,7 @@ var tc1 = new testClass1(); tc1.method<{ x: V }>(); // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. // in constructor type arguments @@ -20,98 +44,98 @@ } var tc2 = new testClass2<{ x: V }>(); // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. // in method return type annotation class testClass3 { testMethod1(): Foo<{ x: V }> { return null; } // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. static testMethod2(): Foo<{ x: V }> { return null } // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. set a(value: Foo<{ x: V }>) { } // error: could not find symbol V ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. property: Foo<{ x: V }>; // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. } // in function return type annotation function testFunction1(): Foo<{ x: V }> { return null; } // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. // in paramter types function testFunction2(p: Foo<{ x: V }>) { }// error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. // in var type annotation var f: Foo<{ x: V }>; // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. // in constraints class testClass4 { } // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. interface testClass5> { } // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. class testClass6 { method(): void { } // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. } interface testInterface1 { new (a: M); // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. } // in extends clause class testClass7 extends Foo<{ x: V }> { } // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. // in implements clause class testClass8 implements IFoo<{ x: V }> { } // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. // in signatures interface testInterface2 { new (a: Foo<{ x: V }>): Foo<{ x: V }>; //2x: error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. [x: string]: Foo<{ x: V }>; // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. method(a: Foo<{ x: V }>): Foo<{ x: V }>; //2x: error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. property: Foo<{ x: V }>; // error: could not find symbol V ~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. } \ No newline at end of file diff --git a/tests/baselines/reference/errorsOnImportedSymbol.errors.txt b/tests/baselines/reference/errorsOnImportedSymbol.errors.txt index 9261bab93fc..ec108d48881 100644 --- a/tests/baselines/reference/errorsOnImportedSymbol.errors.txt +++ b/tests/baselines/reference/errorsOnImportedSymbol.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/errorsOnImportedSymbol_1.ts(2,13): error TS2304: Cannot find name 'Sammy'. +tests/cases/compiler/errorsOnImportedSymbol_1.ts(3,9): error TS2304: Cannot find name 'Sammy'. + + ==== tests/cases/compiler/errorsOnImportedSymbol_1.ts (2 errors) ==== import Sammy = require("errorsOnImportedSymbol_0"); var x = new Sammy.Sammy(); ~~~~~ -!!! Cannot find name 'Sammy'. +!!! error TS2304: Cannot find name 'Sammy'. var y = Sammy.Sammy(); ~~~~~ -!!! Cannot find name 'Sammy'. +!!! error TS2304: Cannot find name 'Sammy'. ==== tests/cases/compiler/errorsOnImportedSymbol_0.ts (0 errors) ==== diff --git a/tests/baselines/reference/es6ClassTest.errors.txt b/tests/baselines/reference/es6ClassTest.errors.txt index 717089ddeb9..4478fbe8156 100644 --- a/tests/baselines/reference/es6ClassTest.errors.txt +++ b/tests/baselines/reference/es6ClassTest.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/es6ClassTest.ts(25,44): error TS1015: Parameter cannot have question mark and initializer. + + ==== tests/cases/compiler/es6ClassTest.ts (1 errors) ==== class Bar { public goo: number; @@ -25,7 +28,7 @@ constructor(); constructor(x?, private y?:string, public z?=0) { ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. super(x); this.x = x; this.gar = 5; diff --git a/tests/baselines/reference/es6ClassTest2.errors.txt b/tests/baselines/reference/es6ClassTest2.errors.txt index 3e3fa2bbee6..bf87a809b77 100644 --- a/tests/baselines/reference/es6ClassTest2.errors.txt +++ b/tests/baselines/reference/es6ClassTest2.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/es6ClassTest2.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/es6ClassTest2.ts(35,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/es6ClassTest2.ts(17,1): error TS2304: Cannot find name 'console'. + + ==== tests/cases/compiler/es6ClassTest2.ts (3 errors) ==== class BasicMonster { constructor(public name: string, public health: number) { @@ -17,7 +22,7 @@ m1.health = 0; console.log((m5.isAlive).toString()); ~~~~~~~ -!!! Cannot find name 'console'. +!!! error TS2304: Cannot find name 'console'. class GetSetMonster { constructor(public name: string, private _health: number) { @@ -32,14 +37,14 @@ // defines one in an object literal. get isAlive() { ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return this._health > 0; } // Likewise, "set" can be used to define setters. set health(value: number) { ~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. if (value < 0) { throw new Error('Health must be non-negative.') } diff --git a/tests/baselines/reference/es6ClassTest3.errors.txt b/tests/baselines/reference/es6ClassTest3.errors.txt index d666351dc9a..5eb310f338d 100644 --- a/tests/baselines/reference/es6ClassTest3.errors.txt +++ b/tests/baselines/reference/es6ClassTest3.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/es6ClassTest3.ts(3,22): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/es6ClassTest3.ts(4,23): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + + ==== tests/cases/compiler/es6ClassTest3.ts (2 errors) ==== module M { class Visibility { public foo() { }; ~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. private bar() { }; ~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. private x: number; public y: number; public z: number; diff --git a/tests/baselines/reference/es6ClassTest9.errors.txt b/tests/baselines/reference/es6ClassTest9.errors.txt index 1b8be82fc9d..ae7d1ba92d5 100644 --- a/tests/baselines/reference/es6ClassTest9.errors.txt +++ b/tests/baselines/reference/es6ClassTest9.errors.txt @@ -1,10 +1,18 @@ -==== tests/cases/compiler/es6ClassTest9.ts (3 errors) ==== +tests/cases/compiler/es6ClassTest9.ts(1,18): error TS1005: '{' expected. +tests/cases/compiler/es6ClassTest9.ts(1,19): error TS1109: Expression expected. +tests/cases/compiler/es6ClassTest9.ts(1,15): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/es6ClassTest9.ts(2,10): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/compiler/es6ClassTest9.ts (4 errors) ==== declare class foo(); ~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. function foo() {} ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/es6DeclOrdering.errors.txt b/tests/baselines/reference/es6DeclOrdering.errors.txt index 4d890d04238..fdcc796566a 100644 --- a/tests/baselines/reference/es6DeclOrdering.errors.txt +++ b/tests/baselines/reference/es6DeclOrdering.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/es6DeclOrdering.ts(6,20): error TS2339: Property '_store' does not exist on type 'Bar'. +tests/cases/compiler/es6DeclOrdering.ts(11,13): error TS2339: Property '_store' does not exist on type 'Bar'. + + ==== tests/cases/compiler/es6DeclOrdering.ts (2 errors) ==== class Bar { @@ -6,14 +10,14 @@ public foo() { return this._store.length; ~~~~~~ -!!! Property '_store' does not exist on type 'Bar'. +!!! error TS2339: Property '_store' does not exist on type 'Bar'. } constructor(store: string) { this._store = store; // this is an error for some reason? Unresolved symbol store ~~~~~~ -!!! Property '_store' does not exist on type 'Bar'. +!!! error TS2339: Property '_store' does not exist on type 'Bar'. } } diff --git a/tests/baselines/reference/es6MemberScoping.errors.txt b/tests/baselines/reference/es6MemberScoping.errors.txt index 37c8eeb0d20..07788a68648 100644 --- a/tests/baselines/reference/es6MemberScoping.errors.txt +++ b/tests/baselines/reference/es6MemberScoping.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/es6MemberScoping.ts(9,21): error TS2304: Cannot find name 'store'. + + ==== tests/cases/compiler/es6MemberScoping.ts (1 errors) ==== @@ -9,7 +12,7 @@ } public _store = store; // should be an error. ~~~~~ -!!! Cannot find name 'store'. +!!! error TS2304: Cannot find name 'store'. } class Foo2 { diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt index 8ff1f410b37..5dbce43970f 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt @@ -1,3 +1,39 @@ +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type 'number' is not assignable to type 'Date': + Property 'toDateString' is missing in type 'Number'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(38,5): error TS2323: Type 'number' is not assignable to type 'void'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(40,5): error TS2322: Type 'D<{}>' is not assignable to type 'I': + Property 'id' is missing in type 'D<{}>'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(41,5): error TS2322: Type 'D<{}>' is not assignable to type 'C': + Property 'id' is missing in type 'D<{}>'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(42,5): error TS2322: Type 'C' is not assignable to type 'D': + Property 'source' is missing in type 'C'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(43,5): error TS2322: Type '{ id: string; }' is not assignable to type 'I': + Types of property 'id' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(44,5): error TS2322: Type 'C' is not assignable to type '{ id: string; }': + Types of property 'id' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(46,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number': + Types of parameters 'x' and 'x' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(47,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number': + Types of parameters 'x' and 'x' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(48,5): error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number': + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(50,5): error TS2322: Type 'typeof N' is not assignable to type 'typeof M': + Types of property 'A' are incompatible: + Type 'typeof A' is not assignable to type 'typeof A': + Type 'A' is not assignable to type 'A': + Property 'name' is missing in type 'A'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(51,5): error TS2322: Type 'A' is not assignable to type 'A': + Property 'name' is missing in type 'A'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string': + Type 'boolean' is not assignable to type 'string'. + + ==== tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts (15 errors) ==== interface I { id: number; @@ -34,71 +70,71 @@ var aNumber: number = 'this is a string'; ~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. var aString: string = 9.9; ~~~~~~~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. var aDate: Date = 9.9; ~~~~~ -!!! Type 'number' is not assignable to type 'Date': -!!! Property 'toDateString' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type 'Date': +!!! error TS2322: Property 'toDateString' is missing in type 'Number'. var aVoid: void = 9.9; ~~~~~ -!!! Type 'number' is not assignable to type 'void'. +!!! error TS2323: Type 'number' is not assignable to type 'void'. var anInterface: I = new D(); ~~~~~~~~~~~ -!!! Type 'D<{}>' is not assignable to type 'I': -!!! Property 'id' is missing in type 'D<{}>'. +!!! error TS2322: Type 'D<{}>' is not assignable to type 'I': +!!! error TS2322: Property 'id' is missing in type 'D<{}>'. var aClass: C = new D(); ~~~~~~ -!!! Type 'D<{}>' is not assignable to type 'C': -!!! Property 'id' is missing in type 'D<{}>'. +!!! error TS2322: Type 'D<{}>' is not assignable to type 'C': +!!! error TS2322: Property 'id' is missing in type 'D<{}>'. var aGenericClass: D = new C(); ~~~~~~~~~~~~~ -!!! Type 'C' is not assignable to type 'D': -!!! Property 'source' is missing in type 'C'. +!!! error TS2322: Type 'C' is not assignable to type 'D': +!!! error TS2322: Property 'source' is missing in type 'C'. var anObjectLiteral: I = { id: 'a string' }; ~~~~~~~~~~~~~~~ -!!! Type '{ id: string; }' is not assignable to type 'I': -!!! Types of property 'id' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '{ id: string; }' is not assignable to type 'I': +!!! error TS2322: Types of property 'id' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var anOtherObjectLiteral: { id: string } = new C(); ~~~~~~~~~~~~~~~~~~~~ -!!! Type 'C' is not assignable to type '{ id: string; }': -!!! Types of property 'id' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'C' is not assignable to type '{ id: string; }': +!!! error TS2322: Types of property 'id' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. var aFunction: typeof F = F2; ~~~~~~~~~ -!!! Type '(x: number) => boolean' is not assignable to type '(x: string) => number': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. var anOtherFunction: (x: string) => number = F2; ~~~~~~~~~~~~~~~ -!!! Type '(x: number) => boolean' is not assignable to type '(x: string) => number': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. var aLambda: typeof F = (x) => 'a string'; ~~~~~~~ -!!! Type '(x: string) => string' is not assignable to type '(x: string) => number': -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number': +!!! error TS2322: Type 'string' is not assignable to type 'number'. var aModule: typeof M = N; ~~~~~~~ -!!! Type 'typeof N' is not assignable to type 'typeof M': -!!! Types of property 'A' are incompatible: -!!! Type 'typeof A' is not assignable to type 'typeof A': -!!! Type 'A' is not assignable to type 'A': -!!! Property 'name' is missing in type 'A'. +!!! error TS2322: Type 'typeof N' is not assignable to type 'typeof M': +!!! error TS2322: Types of property 'A' are incompatible: +!!! error TS2322: Type 'typeof A' is not assignable to type 'typeof A': +!!! error TS2322: Type 'A' is not assignable to type 'A': +!!! error TS2322: Property 'name' is missing in type 'A'. var aClassInModule: M.A = new N.A(); ~~~~~~~~~~~~~~ -!!! Type 'A' is not assignable to type 'A': -!!! Property 'name' is missing in type 'A'. +!!! error TS2322: Type 'A' is not assignable to type 'A': +!!! error TS2322: Property 'name' is missing in type 'A'. var aFunctionInModule: typeof M.F2 = F2; ~~~~~~~~~~~~~~~~~ -!!! Type '(x: number) => boolean' is not assignable to type '(x: number) => string': -!!! Type 'boolean' is not assignable to type 'string'. +!!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string': +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/exportAlreadySeen.errors.txt b/tests/baselines/reference/exportAlreadySeen.errors.txt index b80498feb5e..eb9f0ce1a95 100644 --- a/tests/baselines/reference/exportAlreadySeen.errors.txt +++ b/tests/baselines/reference/exportAlreadySeen.errors.txt @@ -1,40 +1,52 @@ +tests/cases/compiler/exportAlreadySeen.ts(2,12): error TS1030: 'export' modifier already seen. +tests/cases/compiler/exportAlreadySeen.ts(3,12): error TS1030: 'export' modifier already seen. +tests/cases/compiler/exportAlreadySeen.ts(5,12): error TS1030: 'export' modifier already seen. +tests/cases/compiler/exportAlreadySeen.ts(6,16): error TS1030: 'export' modifier already seen. +tests/cases/compiler/exportAlreadySeen.ts(7,16): error TS1030: 'export' modifier already seen. +tests/cases/compiler/exportAlreadySeen.ts(12,12): error TS1030: 'export' modifier already seen. +tests/cases/compiler/exportAlreadySeen.ts(13,12): error TS1030: 'export' modifier already seen. +tests/cases/compiler/exportAlreadySeen.ts(15,12): error TS1030: 'export' modifier already seen. +tests/cases/compiler/exportAlreadySeen.ts(16,16): error TS1030: 'export' modifier already seen. +tests/cases/compiler/exportAlreadySeen.ts(17,16): error TS1030: 'export' modifier already seen. + + ==== tests/cases/compiler/exportAlreadySeen.ts (10 errors) ==== module M { export export var x = 1; ~~~~~~ -!!! 'export' modifier already seen. +!!! error TS1030: 'export' modifier already seen. export export function f() { } ~~~~~~ -!!! 'export' modifier already seen. +!!! error TS1030: 'export' modifier already seen. export export module N { ~~~~~~ -!!! 'export' modifier already seen. +!!! error TS1030: 'export' modifier already seen. export export class C { } ~~~~~~ -!!! 'export' modifier already seen. +!!! error TS1030: 'export' modifier already seen. export export interface I { } ~~~~~~ -!!! 'export' modifier already seen. +!!! error TS1030: 'export' modifier already seen. } } declare module A { export export var x; ~~~~~~ -!!! 'export' modifier already seen. +!!! error TS1030: 'export' modifier already seen. export export function f() ~~~~~~ -!!! 'export' modifier already seen. +!!! error TS1030: 'export' modifier already seen. export export module N { ~~~~~~ -!!! 'export' modifier already seen. +!!! error TS1030: 'export' modifier already seen. export export class C { } ~~~~~~ -!!! 'export' modifier already seen. +!!! error TS1030: 'export' modifier already seen. export export interface I { } ~~~~~~ -!!! 'export' modifier already seen. +!!! error TS1030: 'export' modifier already seen. } } \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignDottedName.errors.txt b/tests/baselines/reference/exportAssignDottedName.errors.txt index 7faf84e114a..264e32c9cad 100644 --- a/tests/baselines/reference/exportAssignDottedName.errors.txt +++ b/tests/baselines/reference/exportAssignDottedName.errors.txt @@ -1,10 +1,15 @@ +tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo2.ts(2,14): error TS1005: ';' expected. +tests/cases/conformance/externalModules/foo2.ts(2,15): error TS2304: Cannot find name 'x'. + + ==== tests/cases/conformance/externalModules/foo2.ts (2 errors) ==== import foo1 = require('./foo1'); export = foo1.x; // Error, export assignment must be identifier only ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. ==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== export function x(){ @@ -13,5 +18,5 @@ ~~~~~~~~~~~~~ } ~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt b/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt index b1e124896e7..8aa25aee2ad 100644 --- a/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt +++ b/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/conformance/externalModules/foo3.ts (0 errors) ==== import foo2 = require('./foo2'); var x = foo2(); // should be boolean @@ -8,7 +11,7 @@ ~~~~~~~~~~~~~ } ~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== import foo1 = require('./foo1'); diff --git a/tests/baselines/reference/exportAssignNonIdentifier.errors.txt b/tests/baselines/reference/exportAssignNonIdentifier.errors.txt index 7487d9547c1..31ca1be2011 100644 --- a/tests/baselines/reference/exportAssignNonIdentifier.errors.txt +++ b/tests/baselines/reference/exportAssignNonIdentifier.errors.txt @@ -1,25 +1,36 @@ +tests/cases/conformance/externalModules/foo1.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(2,10): error TS1003: Identifier expected. +tests/cases/conformance/externalModules/foo2.ts(1,10): error TS1003: Identifier expected. +tests/cases/conformance/externalModules/foo3.ts(1,10): error TS1003: Identifier expected. +tests/cases/conformance/externalModules/foo4.ts(1,10): error TS1003: Identifier expected. +tests/cases/conformance/externalModules/foo6.ts(1,10): error TS1003: Identifier expected. +tests/cases/conformance/externalModules/foo6.ts(1,14): error TS1109: Expression expected. +tests/cases/conformance/externalModules/foo7.ts(1,15): error TS1005: ';' expected. +tests/cases/conformance/externalModules/foo8.ts(1,10): error TS1003: Identifier expected. + + ==== tests/cases/conformance/externalModules/foo1.ts (2 errors) ==== var x = 10; export = typeof x; // Error ~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ~~~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ==== tests/cases/conformance/externalModules/foo2.ts (1 errors) ==== export = "sausages"; // Error ~~~~~~~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ==== tests/cases/conformance/externalModules/foo3.ts (1 errors) ==== export = class Foo3 {}; // Error ~~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ==== tests/cases/conformance/externalModules/foo4.ts (1 errors) ==== export = true; // Error ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ==== tests/cases/conformance/externalModules/foo5.ts (0 errors) ==== export = undefined; // Valid. undefined is an identifier in JavaScript/TypeScript @@ -27,18 +38,18 @@ ==== tests/cases/conformance/externalModules/foo6.ts (2 errors) ==== export = void; // Error ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ==== tests/cases/conformance/externalModules/foo7.ts (1 errors) ==== export = Date || String; // Error ~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ==== tests/cases/conformance/externalModules/foo8.ts (1 errors) ==== export = null; // Error ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignTypes.errors.txt b/tests/baselines/reference/exportAssignTypes.errors.txt index c4dca71333f..c35e7c0b8f6 100644 --- a/tests/baselines/reference/exportAssignTypes.errors.txt +++ b/tests/baselines/reference/exportAssignTypes.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/externalModules/expString.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/conformance/externalModules/consumer.ts (0 errors) ==== import iString = require('./expString'); var v1: string = iString; @@ -24,7 +27,7 @@ var x = "test"; export = x; ~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ==== tests/cases/conformance/externalModules/expNumber.ts (0 errors) ==== var x = 42; diff --git a/tests/baselines/reference/exportAssignmentAndDeclaration.errors.txt b/tests/baselines/reference/exportAssignmentAndDeclaration.errors.txt index ecae497202e..bb228caa0c9 100644 --- a/tests/baselines/reference/exportAssignmentAndDeclaration.errors.txt +++ b/tests/baselines/reference/exportAssignmentAndDeclaration.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/externalModules/exportAssignmentAndDeclaration.ts(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + ==== tests/cases/conformance/externalModules/exportAssignmentAndDeclaration.ts (1 errors) ==== export enum E1 { A,B,C @@ -10,4 +13,4 @@ // Invalid, as there is already an exported member. export = C1; ~~~~~~~~~~~~ -!!! An export assignment cannot be used in a module with other exported elements. \ No newline at end of file +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt b/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt index 9b933cc439d..cf63c48925f 100644 --- a/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt +++ b/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'. + + ==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ==== import foo = require("./foo_0"); var x = new foo(true); // Should error ~~~~ -!!! Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'. var y = new foo({a: "test", b: 42}); // Should be OK var z: number = y.test.b; ==== tests/cases/conformance/externalModules/foo_0.ts (0 errors) ==== diff --git a/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.errors.txt b/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.errors.txt index 74518bb9c3c..f6736e468f0 100644 --- a/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.errors.txt +++ b/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts(3,13): error TS2304: Cannot find name 'Sammy'. +tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts(4,9): error TS2304: Cannot find name 'Sammy'. + + ==== tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts (2 errors) ==== /// import Sammy = require('exportAssignmentOfDeclaredExternalModule_0'); var x = new Sammy(); // error to use as constructor as there is not constructor symbol ~~~~~ -!!! Cannot find name 'Sammy'. +!!! error TS2304: Cannot find name 'Sammy'. var y = Sammy(); // error to use interface name as call target ~~~~~ -!!! Cannot find name 'Sammy'. +!!! error TS2304: Cannot find name 'Sammy'. var z: Sammy; // no error - z is of type interface Sammy from module 'M' var a = new z(); // constructor - no error var b = z(); // call signature - no error diff --git a/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.errors.txt b/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.errors.txt index 2dd71ce0d07..20355aec05c 100644 --- a/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.errors.txt +++ b/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts(2,1): error TS1120: An export assignment cannot have modifiers. +tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/compiler/exportAssignmentWithDeclareAndExportModifiers.ts (2 errors) ==== var x; export declare export = x; ~~~~~~~~~~~~~~ -!!! An export assignment cannot have modifiers. +!!! error TS1120: An export assignment cannot have modifiers. ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentWithDeclareModifier.errors.txt b/tests/baselines/reference/exportAssignmentWithDeclareModifier.errors.txt index 27b202ce0c8..1d2f2e265d3 100644 --- a/tests/baselines/reference/exportAssignmentWithDeclareModifier.errors.txt +++ b/tests/baselines/reference/exportAssignmentWithDeclareModifier.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/exportAssignmentWithDeclareModifier.ts(2,1): error TS1120: An export assignment cannot have modifiers. +tests/cases/compiler/exportAssignmentWithDeclareModifier.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/compiler/exportAssignmentWithDeclareModifier.ts (2 errors) ==== var x; declare export = x; ~~~~~~~ -!!! An export assignment cannot have modifiers. +!!! error TS1120: An export assignment cannot have modifiers. ~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentWithExportModifier.errors.txt b/tests/baselines/reference/exportAssignmentWithExportModifier.errors.txt index dc3d6cb4cc5..e19ce5bc856 100644 --- a/tests/baselines/reference/exportAssignmentWithExportModifier.errors.txt +++ b/tests/baselines/reference/exportAssignmentWithExportModifier.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/exportAssignmentWithExportModifier.ts(2,1): error TS1120: An export assignment cannot have modifiers. +tests/cases/compiler/exportAssignmentWithExportModifier.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/compiler/exportAssignmentWithExportModifier.ts (2 errors) ==== var x; export export = x; ~~~~~~ -!!! An export assignment cannot have modifiers. +!!! error TS1120: An export assignment cannot have modifiers. ~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentWithExports.errors.txt b/tests/baselines/reference/exportAssignmentWithExports.errors.txt index 7ddda9db538..d47cbae3221 100644 --- a/tests/baselines/reference/exportAssignmentWithExports.errors.txt +++ b/tests/baselines/reference/exportAssignmentWithExports.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/exportAssignmentWithExports.ts(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + ==== tests/cases/compiler/exportAssignmentWithExports.ts (1 errors) ==== export class C { } class D { } export = D; ~~~~~~~~~~~ -!!! An export assignment cannot be used in a module with other exported elements. \ No newline at end of file +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentWithoutIdentifier1.errors.txt b/tests/baselines/reference/exportAssignmentWithoutIdentifier1.errors.txt index 396d932e358..ff21d304e40 100644 --- a/tests/baselines/reference/exportAssignmentWithoutIdentifier1.errors.txt +++ b/tests/baselines/reference/exportAssignmentWithoutIdentifier1.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/exportAssignmentWithoutIdentifier1.ts(7,10): error TS1003: Identifier expected. + + ==== tests/cases/compiler/exportAssignmentWithoutIdentifier1.ts (1 errors) ==== function Greeter() { //... @@ -7,5 +10,5 @@ } export = new Greeter(); ~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/exportDeclareClass1.errors.txt b/tests/baselines/reference/exportDeclareClass1.errors.txt index 6ee2bc0e090..36103269f83 100644 --- a/tests/baselines/reference/exportDeclareClass1.errors.txt +++ b/tests/baselines/reference/exportDeclareClass1.errors.txt @@ -1,15 +1,21 @@ +tests/cases/compiler/exportDeclareClass1.ts(2,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/exportDeclareClass1.ts(2,24): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/exportDeclareClass1.ts(3,31): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/exportDeclareClass1.ts(3,34): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + + ==== tests/cases/compiler/exportDeclareClass1.ts (4 errors) ==== export declare class eaC { static tF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. static tsF(param:any) { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. }; export declare class eaC2 { diff --git a/tests/baselines/reference/exportDeclaredModule.errors.txt b/tests/baselines/reference/exportDeclaredModule.errors.txt index ffa54e92dcf..265061fe2f4 100644 --- a/tests/baselines/reference/exportDeclaredModule.errors.txt +++ b/tests/baselines/reference/exportDeclaredModule.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/externalModules/foo1.ts(6,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== import foo1 = require('./foo1'); var x: number = foo1.b(); @@ -9,5 +12,5 @@ } export = M1; ~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file diff --git a/tests/baselines/reference/exportEqualErrorType.errors.txt b/tests/baselines/reference/exportEqualErrorType.errors.txt index 1023e9eff25..db96a9dc523 100644 --- a/tests/baselines/reference/exportEqualErrorType.errors.txt +++ b/tests/baselines/reference/exportEqualErrorType.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/exportEqualErrorType_1.ts(3,23): error TS2339: Property 'static' does not exist on type '{ (): connectExport; foo: Date; }'. + + ==== tests/cases/compiler/exportEqualErrorType_1.ts (1 errors) ==== /// import connect = require('exportEqualErrorType_0'); connect().use(connect.static('foo')); // Error 1 The property 'static' does not exist on value of type ''. ~~~~~~ -!!! Property 'static' does not exist on type '{ (): connectExport; foo: Date; }'. +!!! error TS2339: Property 'static' does not exist on type '{ (): connectExport; foo: Date; }'. ==== tests/cases/compiler/exportEqualErrorType_0.ts (0 errors) ==== module server { diff --git a/tests/baselines/reference/exportEqualMemberMissing.errors.txt b/tests/baselines/reference/exportEqualMemberMissing.errors.txt index da061bc303e..3e6e7a35a12 100644 --- a/tests/baselines/reference/exportEqualMemberMissing.errors.txt +++ b/tests/baselines/reference/exportEqualMemberMissing.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/exportEqualMemberMissing_1.ts(3,23): error TS2339: Property 'static' does not exist on type '{ (): connectExport; foo: Date; }'. + + ==== tests/cases/compiler/exportEqualMemberMissing_1.ts (1 errors) ==== /// import connect = require('exportEqualMemberMissing_0'); connect().use(connect.static('foo')); // Error 1 The property 'static' does not exist on value of type ''. ~~~~~~ -!!! Property 'static' does not exist on type '{ (): connectExport; foo: Date; }'. +!!! error TS2339: Property 'static' does not exist on type '{ (): connectExport; foo: Date; }'. ==== tests/cases/compiler/exportEqualMemberMissing_0.ts (0 errors) ==== module server { diff --git a/tests/baselines/reference/exportNonVisibleType.errors.txt b/tests/baselines/reference/exportNonVisibleType.errors.txt index 7f615efc615..0eb73b2b04e 100644 --- a/tests/baselines/reference/exportNonVisibleType.errors.txt +++ b/tests/baselines/reference/exportNonVisibleType.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/externalModules/foo1.ts(7,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== interface I1 { a: string; @@ -7,7 +10,7 @@ var x: I1 = {a: "test", b: 42}; export = x; // Should fail, I1 not exported. ~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== diff --git a/tests/baselines/reference/exportSameNameFuncVar.errors.txt b/tests/baselines/reference/exportSameNameFuncVar.errors.txt index 44d0c5446bd..a06457e88ae 100644 --- a/tests/baselines/reference/exportSameNameFuncVar.errors.txt +++ b/tests/baselines/reference/exportSameNameFuncVar.errors.txt @@ -1,6 +1,12 @@ -==== tests/cases/compiler/exportSameNameFuncVar.ts (1 errors) ==== +tests/cases/compiler/exportSameNameFuncVar.ts(1,12): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/exportSameNameFuncVar.ts(2,17): error TS2300: Duplicate identifier 'a'. + + +==== tests/cases/compiler/exportSameNameFuncVar.ts (2 errors) ==== export var a = 10; + ~ +!!! error TS2300: Duplicate identifier 'a'. export function a() { ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/exportingContainingVisibleType.errors.txt b/tests/baselines/reference/exportingContainingVisibleType.errors.txt index 8649494ddb4..83f722b97da 100644 --- a/tests/baselines/reference/exportingContainingVisibleType.errors.txt +++ b/tests/baselines/reference/exportingContainingVisibleType.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/exportingContainingVisibleType.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/exportingContainingVisibleType.ts (1 errors) ==== class Foo { public get foo() { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var i: Foo; return i; // Should be fine (previous bug report visibility error). diff --git a/tests/baselines/reference/expr.errors.txt b/tests/baselines/reference/expr.errors.txt index 5b233d8a2da..41d15a0835b 100644 --- a/tests/baselines/reference/expr.errors.txt +++ b/tests/baselines/reference/expr.errors.txt @@ -1,3 +1,74 @@ +tests/cases/compiler/expr.ts(87,5): error TS2365: Operator '==' cannot be applied to types 'number' and 'string'. +tests/cases/compiler/expr.ts(88,5): error TS2365: Operator '==' cannot be applied to types 'number' and 'boolean'. +tests/cases/compiler/expr.ts(94,5): error TS2365: Operator '==' cannot be applied to types 'string' and 'number'. +tests/cases/compiler/expr.ts(95,5): error TS2365: Operator '==' cannot be applied to types 'string' and 'boolean'. +tests/cases/compiler/expr.ts(98,5): error TS2365: Operator '==' cannot be applied to types 'string' and 'E'. +tests/cases/compiler/expr.ts(115,5): error TS2365: Operator '==' cannot be applied to types 'E' and 'string'. +tests/cases/compiler/expr.ts(116,5): error TS2365: Operator '==' cannot be applied to types 'E' and 'boolean'. +tests/cases/compiler/expr.ts(142,5): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. +tests/cases/compiler/expr.ts(143,5): error TS2365: Operator '+' cannot be applied to types 'number' and 'I'. +tests/cases/compiler/expr.ts(161,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'number'. +tests/cases/compiler/expr.ts(163,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'boolean'. +tests/cases/compiler/expr.ts(165,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'I'. +tests/cases/compiler/expr.ts(166,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'E'. +tests/cases/compiler/expr.ts(170,5): error TS2365: Operator '+' cannot be applied to types 'E' and 'boolean'. +tests/cases/compiler/expr.ts(172,5): error TS2365: Operator '+' cannot be applied to types 'E' and 'I'. +tests/cases/compiler/expr.ts(176,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(177,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(178,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(182,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(183,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(184,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(184,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(185,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(185,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(186,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(186,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(187,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(190,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(191,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(192,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(196,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(197,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(197,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(198,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(198,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(199,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(200,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(200,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(201,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(204,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(205,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(207,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(211,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(212,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(213,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(217,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(218,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(219,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(219,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(220,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(220,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(221,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(221,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(222,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(225,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(226,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(227,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(231,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(232,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(232,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(233,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(233,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(234,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(235,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(235,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(236,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(239,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(240,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/compiler/expr.ts (69 errors) ==== interface I { } @@ -87,10 +158,10 @@ n==a; n==s; ~~~~ -!!! Operator '==' cannot be applied to types 'number' and 'string'. +!!! error TS2365: Operator '==' cannot be applied to types 'number' and 'string'. n==b; ~~~~ -!!! Operator '==' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '==' cannot be applied to types 'number' and 'boolean'. n==i; n==n; n==e; @@ -98,15 +169,15 @@ s==a; s==n; ~~~~ -!!! Operator '==' cannot be applied to types 'string' and 'number'. +!!! error TS2365: Operator '==' cannot be applied to types 'string' and 'number'. s==b; ~~~~ -!!! Operator '==' cannot be applied to types 'string' and 'boolean'. +!!! error TS2365: Operator '==' cannot be applied to types 'string' and 'boolean'. s==i; s==s; s==e; ~~~~ -!!! Operator '==' cannot be applied to types 'string' and 'E'. +!!! error TS2365: Operator '==' cannot be applied to types 'string' and 'E'. a==n; a==s; @@ -125,10 +196,10 @@ e==n; e==s; ~~~~ -!!! Operator '==' cannot be applied to types 'E' and 'string'. +!!! error TS2365: Operator '==' cannot be applied to types 'E' and 'string'. e==b; ~~~~ -!!! Operator '==' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '==' cannot be applied to types 'E' and 'boolean'. e==a; e==i; e==e; @@ -156,10 +227,10 @@ n+s; n+b; ~~~ -!!! Operator '+' cannot be applied to types 'number' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. n+i; ~~~ -!!! Operator '+' cannot be applied to types 'number' and 'I'. +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'I'. n+n; n+e; @@ -179,206 +250,206 @@ i+n; ~~~ -!!! Operator '+' cannot be applied to types 'I' and 'number'. +!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'number'. i+s; i+b; ~~~ -!!! Operator '+' cannot be applied to types 'I' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'boolean'. i+a; i+i; ~~~ -!!! Operator '+' cannot be applied to types 'I' and 'I'. +!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'I'. i+e; ~~~ -!!! Operator '+' cannot be applied to types 'I' and 'E'. +!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'E'. e+n; e+s; e+b; ~~~ -!!! Operator '+' cannot be applied to types 'E' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'boolean'. e+a; e+i; ~~~ -!!! Operator '+' cannot be applied to types 'E' and 'I'. +!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'I'. e+e; n^a; n^s; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. n^b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. n^i; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. n^n; n^e; s^a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s^n; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s^b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s^i; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s^s; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s^e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. a^n; a^s; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. a^b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. a^i; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. a^a; a^e; i^n; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. i^s; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. i^b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. i^a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. i^i; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. i^e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. e^n; e^s; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. e^b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. e^a; e^i; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. e^e; n-a; n-s; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. n-b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. n-i; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. n-n; n-e; s-a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s-n; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s-b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s-i; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s-s; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s-e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. a-n; a-s; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. a-b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. a-i; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. a-a; a-e; i-n; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. i-s; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. i-b; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. i-a; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. i-i; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. i-e; ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. e-n; e-s; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. e-b; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. e-a; e-i; ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. e-e; } \ No newline at end of file diff --git a/tests/baselines/reference/extBaseClass2.errors.txt b/tests/baselines/reference/extBaseClass2.errors.txt index 79e8525a8f3..5e49a2dbc47 100644 --- a/tests/baselines/reference/extBaseClass2.errors.txt +++ b/tests/baselines/reference/extBaseClass2.errors.txt @@ -1,15 +1,19 @@ +tests/cases/compiler/extBaseClass2.ts(2,29): error TS2305: Module 'M' has no exported member 'B'. +tests/cases/compiler/extBaseClass2.ts(7,29): error TS2304: Cannot find name 'B'. + + ==== tests/cases/compiler/extBaseClass2.ts (2 errors) ==== module N { export class C4 extends M.B { ~~~ -!!! Module 'M' has no exported member 'B'. +!!! error TS2305: Module 'M' has no exported member 'B'. } } module M { export class C5 extends B { ~ -!!! Cannot find name 'B'. +!!! error TS2304: Cannot find name 'B'. } } \ No newline at end of file diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType2.errors.txt b/tests/baselines/reference/extendAndImplementTheSameBaseType2.errors.txt index 7b1fde446f8..83fededbcbc 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType2.errors.txt +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType2.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(7,7): error TS2421: Class 'D' incorrectly implements interface 'C': + Types of property 'bar' are incompatible: + Type '() => string' is not assignable to type '() => number': + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(12,5): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(16,5): error TS2323: Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/extendAndImplementTheSameBaseType2.ts (3 errors) ==== class C { foo: number @@ -7,20 +15,20 @@ } class D extends C implements C { ~ -!!! Class 'D' incorrectly implements interface 'C': -!!! Types of property 'bar' are incompatible: -!!! Type '() => string' is not assignable to type '() => number': -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2421: Class 'D' incorrectly implements interface 'C': +!!! error TS2421: Types of property 'bar' are incompatible: +!!! error TS2421: Type '() => string' is not assignable to type '() => number': +!!! error TS2421: Type 'string' is not assignable to type 'number'. baz() { } } var d: D = new D(); var r: string = d.foo; ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. var r2: number = d.foo; var r3: string = d.bar(); var r4: number = d.bar(); ~~ -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2323: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/extendArray.errors.txt b/tests/baselines/reference/extendArray.errors.txt index d9524acebcb..824752820cb 100644 --- a/tests/baselines/reference/extendArray.errors.txt +++ b/tests/baselines/reference/extendArray.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/extendArray.ts(7,19): error TS2304: Cannot find name '_element'. +tests/cases/compiler/extendArray.ts(7,32): error TS2304: Cannot find name '_element'. + + ==== tests/cases/compiler/extendArray.ts (2 errors) ==== var a = [1,2]; a.forEach(function (v,i,a) {}); @@ -7,9 +11,9 @@ interface Array { collect(fn:(e:_element) => _element[]) : any[]; ~~~~~~~~ -!!! Cannot find name '_element'. +!!! error TS2304: Cannot find name '_element'. ~~~~~~~~ -!!! Cannot find name '_element'. +!!! error TS2304: Cannot find name '_element'. } } diff --git a/tests/baselines/reference/extendGenericArray.errors.txt b/tests/baselines/reference/extendGenericArray.errors.txt index 19c93b7edc0..9a427267f1f 100644 --- a/tests/baselines/reference/extendGenericArray.errors.txt +++ b/tests/baselines/reference/extendGenericArray.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/extendGenericArray.ts(6,5): error TS2323: Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/extendGenericArray.ts (1 errors) ==== interface Array { foo(): T; @@ -6,4 +9,4 @@ var arr: string[] = []; var x: number = arr.foo(); ~ -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2323: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/extendGenericArray2.errors.txt b/tests/baselines/reference/extendGenericArray2.errors.txt index 23ca38cd7a7..f411207b225 100644 --- a/tests/baselines/reference/extendGenericArray2.errors.txt +++ b/tests/baselines/reference/extendGenericArray2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/extendGenericArray2.ts(8,5): error TS2323: Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/extendGenericArray2.ts (1 errors) ==== interface IFoo { x: T; @@ -8,4 +11,4 @@ var arr: string[] = []; var y: number = arr.x; ~ -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2323: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/extendNonClassSymbol1.errors.txt b/tests/baselines/reference/extendNonClassSymbol1.errors.txt index 730427f529d..587ac3a5f04 100644 --- a/tests/baselines/reference/extendNonClassSymbol1.errors.txt +++ b/tests/baselines/reference/extendNonClassSymbol1.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/extendNonClassSymbol1.ts(3,17): error TS2304: Cannot find name 'x'. + + ==== tests/cases/compiler/extendNonClassSymbol1.ts (1 errors) ==== class A { foo() { } } var x = A; class C extends x { } // error, could not find symbol xs ~ -!!! Cannot find name 'x'. \ No newline at end of file +!!! error TS2304: Cannot find name 'x'. \ No newline at end of file diff --git a/tests/baselines/reference/extendNonClassSymbol2.errors.txt b/tests/baselines/reference/extendNonClassSymbol2.errors.txt index 69328a3a713..1b54474ac39 100644 --- a/tests/baselines/reference/extendNonClassSymbol2.errors.txt +++ b/tests/baselines/reference/extendNonClassSymbol2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/extendNonClassSymbol2.ts(5,17): error TS2304: Cannot find name 'Foo'. + + ==== tests/cases/compiler/extendNonClassSymbol2.ts (1 errors) ==== function Foo() { this.x = 1; @@ -5,4 +8,4 @@ var x = new Foo(); // legal, considered a constructor function class C extends Foo {} // error, could not find symbol Foo ~~~ -!!! Cannot find name 'Foo'. \ No newline at end of file +!!! error TS2304: Cannot find name 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt b/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt index 5cabc36a6b8..7d7fea1b2c6 100644 --- a/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt +++ b/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt @@ -1,7 +1,12 @@ +tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(1,42): error TS2300: Duplicate identifier 'A'. +tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): error TS2300: Duplicate identifier 'C'. + + ==== tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts (3 errors) ==== interface InterfaceWithMultipleTypars { // should error ~ -!!! Duplicate identifier 'A'. +!!! error TS2300: Duplicate identifier 'A'. bar(): void; } @@ -11,8 +16,8 @@ interface InterfaceWithSomeTypars { // should error ~~~~~~~~~~~~~~~~~~~~~~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. ~ -!!! Duplicate identifier 'C'. +!!! error TS2300: Duplicate identifier 'C'. bar2(): void; } \ No newline at end of file diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types index fefa692b509..991d324e822 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types @@ -25,7 +25,7 @@ var moduleMap: { [key: string]: IHasVisualizationModel } = { >moduleMap : { [x: string]: IHasVisualizationModel; } >key : string >IHasVisualizationModel : IHasVisualizationModel ->{ "moduleA": moduleA, "moduleB": moduleB} : { [x: string]: IHasVisualizationModel; "moduleA": typeof moduleA; "moduleB": typeof moduleB; } +>{ "moduleA": moduleA, "moduleB": moduleB} : { [x: string]: typeof moduleA; "moduleA": typeof moduleA; "moduleB": typeof moduleB; } "moduleA": moduleA, >moduleA : typeof moduleA diff --git a/tests/baselines/reference/extendsClauseAlreadySeen.errors.txt b/tests/baselines/reference/extendsClauseAlreadySeen.errors.txt index f24e3bbc9f4..b2df83aeb0f 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen.errors.txt +++ b/tests/baselines/reference/extendsClauseAlreadySeen.errors.txt @@ -1,15 +1,21 @@ +tests/cases/compiler/extendsClauseAlreadySeen.ts(4,19): error TS1005: '{' expected. +tests/cases/compiler/extendsClauseAlreadySeen.ts(4,29): error TS1005: ';' expected. +tests/cases/compiler/extendsClauseAlreadySeen.ts(5,11): error TS1005: ';' expected. +tests/cases/compiler/extendsClauseAlreadySeen.ts(5,5): error TS2304: Cannot find name 'baz'. + + ==== tests/cases/compiler/extendsClauseAlreadySeen.ts (4 errors) ==== class C { } class D extends C extends C { ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. baz() { } ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~ -!!! Cannot find name 'baz'. +!!! error TS2304: Cannot find name 'baz'. } \ No newline at end of file diff --git a/tests/baselines/reference/extendsClauseAlreadySeen2.errors.txt b/tests/baselines/reference/extendsClauseAlreadySeen2.errors.txt index 9e5c02a4255..45971dc62f3 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen2.errors.txt +++ b/tests/baselines/reference/extendsClauseAlreadySeen2.errors.txt @@ -1,15 +1,20 @@ +tests/cases/compiler/extendsClauseAlreadySeen2.ts(4,30): error TS1005: '{' expected. +tests/cases/compiler/extendsClauseAlreadySeen2.ts(4,38): error TS2365: Operator '>' cannot be applied to types 'boolean' and '{ baz: () => void; }'. +tests/cases/compiler/extendsClauseAlreadySeen2.ts(4,40): error TS2304: Cannot find name 'string'. + + ==== tests/cases/compiler/extendsClauseAlreadySeen2.ts (3 errors) ==== class C { } class D extends C extends C { ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~~~~~~~~~~~ ~~~~~~ -!!! Cannot find name 'string'. +!!! error TS2304: Cannot find name 'string'. baz() { } ~~~~~~~~~~~~~ } ~ -!!! Operator '>' cannot be applied to types 'boolean' and '{ baz: () => void; }'. \ No newline at end of file +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and '{ baz: () => void; }'. \ No newline at end of file diff --git a/tests/baselines/reference/extension.errors.txt b/tests/baselines/reference/extension.errors.txt index 1a5a8f1f01d..e55f15f4381 100644 --- a/tests/baselines/reference/extension.errors.txt +++ b/tests/baselines/reference/extension.errors.txt @@ -1,4 +1,12 @@ -==== tests/cases/compiler/extension.ts (5 errors) ==== +tests/cases/compiler/extension.ts(16,5): error TS1128: Declaration or statement expected. +tests/cases/compiler/extension.ts(16,22): error TS1005: ';' expected. +tests/cases/compiler/extension.ts(10,18): error TS2300: Duplicate identifier 'C'. +tests/cases/compiler/extension.ts(16,12): error TS2304: Cannot find name 'extension'. +tests/cases/compiler/extension.ts(16,28): error TS2300: Duplicate identifier 'C'. +tests/cases/compiler/extension.ts(22,3): error TS2339: Property 'pe' does not exist on type 'C'. + + +==== tests/cases/compiler/extension.ts (6 errors) ==== interface I { x; } @@ -9,6 +17,8 @@ declare module M { export class C { + ~ +!!! error TS2300: Duplicate identifier 'C'. public p:number; } } @@ -16,13 +26,13 @@ declare module M { export extension class C { ~~~~~~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. ~~~~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~~~~ -!!! Cannot find name 'extension'. +!!! error TS2304: Cannot find name 'extension'. ~ -!!! Duplicate identifier 'C'. +!!! error TS2300: Duplicate identifier 'C'. public pe:string; } } @@ -30,7 +40,7 @@ var c=new M.C(); c.pe; ~~ -!!! Property 'pe' does not exist on type 'C'. +!!! error TS2339: Property 'pe' does not exist on type 'C'. c.p; var i:I; i.x; diff --git a/tests/baselines/reference/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index 613f6d9f8d7..49b1598f06e 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -1,24 +1,39 @@ +tests/cases/compiler/externModule.ts(1,9): error TS1005: ';' expected. +tests/cases/compiler/externModule.ts(1,16): error TS1005: ';' expected. +tests/cases/compiler/externModule.ts(2,5): error TS1129: Statement expected. +tests/cases/compiler/externModule.ts(2,18): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/externModule.ts(1,1): error TS2304: Cannot find name 'declare'. +tests/cases/compiler/externModule.ts(1,9): error TS2304: Cannot find name 'module'. +tests/cases/compiler/externModule.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/externModule.ts(4,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/externModule.ts(18,6): error TS2390: Constructor implementation is missing. +tests/cases/compiler/externModule.ts(20,13): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/externModule.ts(26,13): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/externModule.ts(28,13): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/externModule.ts (13 errors) ==== declare module { ~~~~~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~~ -!!! Cannot find name 'declare'. +!!! error TS2304: Cannot find name 'declare'. ~~~~~~ -!!! Cannot find name 'module'. +!!! error TS2304: Cannot find name 'module'. export class XDate { ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. ~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. public getDay():number; ~~~~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. public getXDate():number; ~~~~~~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. // etc. // Called as a function @@ -34,11 +49,11 @@ constructor(value: number); constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation is missing. +!!! error TS2390: Constructor implementation is missing. static parse(string: string): number; ~~~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. static UTC(year: number, month: number): number; static UTC(year: number, month: number, date: number): number; static UTC(year: number, month: number, date: number, hours: number): number; @@ -46,15 +61,15 @@ static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number): number; static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number, ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. ms: number): number; static now(): number; ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. var d=new XDate(); d.getDay(); diff --git a/tests/baselines/reference/externSemantics.errors.txt b/tests/baselines/reference/externSemantics.errors.txt index 2732c28d1ce..b58e2a4950c 100644 --- a/tests/baselines/reference/externSemantics.errors.txt +++ b/tests/baselines/reference/externSemantics.errors.txt @@ -1,9 +1,13 @@ +tests/cases/compiler/externSemantics.ts(1,14): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/compiler/externSemantics.ts(3,21): error TS1039: Initializers are not allowed in ambient contexts. + + ==== tests/cases/compiler/externSemantics.ts (2 errors) ==== declare var x=10; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. declare var v; declare var y:number=3; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. \ No newline at end of file diff --git a/tests/baselines/reference/externSyntax.errors.txt b/tests/baselines/reference/externSyntax.errors.txt index 791df1b7e0e..099c9fa3a99 100644 --- a/tests/baselines/reference/externSyntax.errors.txt +++ b/tests/baselines/reference/externSyntax.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/externSyntax.ts(8,20): error TS1037: A function implementation cannot be declared in an ambient context. + + ==== tests/cases/compiler/externSyntax.ts (1 errors) ==== declare var v; declare module M { @@ -8,7 +11,7 @@ public f(); public g() { } // error body ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. } } diff --git a/tests/baselines/reference/externalModuleExportingGenericClass.errors.txt b/tests/baselines/reference/externalModuleExportingGenericClass.errors.txt index 651f1a2f945..c8712b20864 100644 --- a/tests/baselines/reference/externalModuleExportingGenericClass.errors.txt +++ b/tests/baselines/reference/externalModuleExportingGenericClass.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/externalModuleExportingGenericClass_file1.ts(2,8): error TS2314: Generic type 'C' requires 1 type argument(s). + + ==== tests/cases/compiler/externalModuleExportingGenericClass_file1.ts (1 errors) ==== import a = require('externalModuleExportingGenericClass_file0'); var v: a; // this should report error ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var v2: any = (new a()).foo; var v3: number = (new a()).foo; diff --git a/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.errors.txt b/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.errors.txt index f2dca2d5f44..588183c6283 100644 --- a/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.errors.txt +++ b/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration_file3.ts(3,7): error TS2339: Property 'foo' does not exist on type 'typeof "externalModuleRefernceResolutionOrderInImportDeclaration_file1"'. + + ==== tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration_file3.ts (1 errors) ==== /// import file1 = require('externalModuleRefernceResolutionOrderInImportDeclaration_file1'); file1.foo(); ~~~ -!!! Property 'foo' does not exist on type 'typeof "externalModuleRefernceResolutionOrderInImportDeclaration_file1"'. +!!! error TS2339: Property 'foo' does not exist on type 'typeof "externalModuleRefernceResolutionOrderInImportDeclaration_file1"'. file1.bar(); diff --git a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt index e10855a94ea..f061276aa1a 100644 --- a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt +++ b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts(3,17): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts (1 errors) ==== // Not on line 0 because we want to verify the error is placed in the appropriate location. export module M { ~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. } \ No newline at end of file diff --git a/tests/baselines/reference/fatarrowfunctionsErrors.errors.txt b/tests/baselines/reference/fatarrowfunctionsErrors.errors.txt index 132e369a643..c3ad9b9c159 100644 --- a/tests/baselines/reference/fatarrowfunctionsErrors.errors.txt +++ b/tests/baselines/reference/fatarrowfunctionsErrors.errors.txt @@ -1,49 +1,69 @@ +tests/cases/compiler/fatarrowfunctionsErrors.ts(2,8): error TS1005: ',' expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(2,18): error TS1005: ':' expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(2,19): error TS1005: ',' expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(2,20): error TS1128: Declaration or statement expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(2,21): error TS1128: Declaration or statement expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(5,10): error TS1005: ',' expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(5,18): error TS1005: ';' expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(9,19): error TS1005: '=>' expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(10,27): error TS1005: '=>' expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(11,21): error TS1005: '=>' expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(12,23): error TS1005: '=>' expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(1,1): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/fatarrowfunctionsErrors.ts(2,1): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/fatarrowfunctionsErrors.ts(3,1): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/fatarrowfunctionsErrors.ts(4,1): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/fatarrowfunctionsErrors.ts(5,9): error TS2304: Cannot find name 'x'. +tests/cases/compiler/fatarrowfunctionsErrors.ts(5,21): error TS2304: Cannot find name 'x'. +tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find name 'x'. + + ==== tests/cases/compiler/fatarrowfunctionsErrors.ts (18 errors) ==== foo((...Far:any[])=>{return 0;}) ~~~ -!!! Cannot find name 'foo'. +!!! error TS2304: Cannot find name 'foo'. foo((1)=>{return 0;}); ~~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~ -!!! ':' expected. +!!! error TS1005: ':' expected. ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. ~~~ -!!! Cannot find name 'foo'. +!!! error TS2304: Cannot find name 'foo'. foo((x?)=>{return x;}) ~~~ -!!! Cannot find name 'foo'. +!!! error TS2304: Cannot find name 'foo'. foo((x=0)=>{return x;}) ~~~ -!!! Cannot find name 'foo'. +!!! error TS2304: Cannot find name 'foo'. var y = x:number => x*x; ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. false? (() => null): null; // missing fatarrow var x1 = () :void {}; ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. var x2 = (a:number) :void {}; ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. var x3 = (a:number) {}; ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. var x4= (...a: any[]) { }; ~ -!!! '=>' expected. \ No newline at end of file +!!! error TS1005: '=>' expected. \ No newline at end of file diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.errors.txt b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.errors.txt index a73ec1dd734..e445a1460f5 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.errors.txt +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.errors.txt @@ -1,3 +1,14 @@ +tests/cases/compiler/fatarrowfunctionsOptionalArgs.ts(60,10): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/fatarrowfunctionsOptionalArgs.ts(70,11): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/fatarrowfunctionsOptionalArgs.ts(80,17): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/fatarrowfunctionsOptionalArgs.ts(88,23): error TS1005: ';' expected. +tests/cases/compiler/fatarrowfunctionsOptionalArgs.ts(88,38): error TS1005: ';' expected. +tests/cases/compiler/fatarrowfunctionsOptionalArgs.ts(106,3): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/fatarrowfunctionsOptionalArgs.ts(106,35): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/fatarrowfunctionsOptionalArgs.ts(126,6): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/fatarrowfunctionsOptionalArgs.ts(128,9): error TS1015: Parameter cannot have question mark and initializer. + + ==== tests/cases/compiler/fatarrowfunctionsOptionalArgs.ts (9 errors) ==== // valid @@ -60,7 +71,7 @@ false ? (arg?: number) => 46 : null; false ? (arg?: number = 0) => 47 : null; ~~~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. false ? (...arg: number[]) => 48 : null; // in ternary exression within paren @@ -72,7 +83,7 @@ false ? ((arg?: number) => 56) : null; false ? ((arg?: number = 0) => 57) : null; ~~~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. false ? ((...arg: number[]) => 58) : null; // ternary exression's else clause @@ -84,7 +95,7 @@ false ? null : (arg?: number) => 66; false ? null : (arg?: number = 0) => 67; ~~~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. false ? null : (...arg: number[]) => 68; @@ -94,9 +105,9 @@ //multiple levels (a?) => { return a; } ? (b)=>(c)=>81 : (c)=>(d)=>82; ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. // In Expressions @@ -116,9 +127,9 @@ ((arg:number = 1) => 0) + '' + ((arg:number = 2) => 105); ((arg?:number = 1) => 0) + '' + ((arg?:number = 2) => 106); ~~~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. ~~~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. ((...arg:number[]) => 0) + '' + ((...arg:number[]) => 107); ((arg1, arg2?) => 0) + '' + ((arg1,arg2?) => 108); ((arg1, ...arg2:number[]) => 0) + '' + ((arg1, ...arg2:number[]) => 108); @@ -140,11 +151,11 @@ (a = 0) => 117, (a?: number = 0) => 118, ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. (...a: number[]) => 119, (a, b? = 0, ...c: number[]) => 120, ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. (a) => (b) => (c) => 121, false? (a) => 0 : (b) => 122 ); \ No newline at end of file diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors1.errors.txt b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors1.errors.txt index fd103a3dea2..ce937dd55dc 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors1.errors.txt +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors1.errors.txt @@ -1,19 +1,26 @@ +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(1,9): error TS1016: A required parameter cannot follow an optional parameter. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(2,5): error TS1047: A rest parameter cannot be optional. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(4,5): error TS1048: A rest parameter cannot have an initializer. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(5,5): error TS1003: Identifier expected. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(8,12): error TS1016: A required parameter cannot follow an optional parameter. + + ==== tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts (5 errors) ==== (arg1?, arg2) => 101; ~~~~ -!!! A required parameter cannot follow an optional parameter. +!!! error TS1016: A required parameter cannot follow an optional parameter. (...arg?) => 102; ~~~ -!!! A rest parameter cannot be optional. +!!! error TS1047: A rest parameter cannot be optional. (...arg) => 103; (...arg:number [] = []) => 104; ~~~ -!!! A rest parameter cannot have an initializer. +!!! error TS1048: A rest parameter cannot have an initializer. (...) => 105; ~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. // Non optional parameter following an optional one (arg1 = 1, arg2) => 1; ~~~~ -!!! A required parameter cannot follow an optional parameter. \ No newline at end of file +!!! error TS1016: A required parameter cannot follow an optional parameter. \ No newline at end of file diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.errors.txt b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.errors.txt index daaa90c3ca4..ce237236ca7 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.errors.txt +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.errors.txt @@ -1,39 +1,58 @@ +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,23): error TS1005: ';' expected. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,23): error TS1005: ';' expected. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,17): error TS1005: ';' expected. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,12): error TS2304: Cannot find name 'a'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,16): error TS2304: Cannot find name 'b'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,19): error TS2304: Cannot find name 'c'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,26): error TS2304: Cannot find name 'a'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,28): error TS2304: Cannot find name 'b'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,30): error TS2304: Cannot find name 'c'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,13): error TS2304: Cannot find name 'a'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,17): error TS2304: Cannot find name 'b'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,20): error TS2304: Cannot find name 'c'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,26): error TS2304: Cannot find name 'a'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,28): error TS2304: Cannot find name 'b'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,30): error TS2304: Cannot find name 'c'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,13): error TS2304: Cannot find name 'a'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,20): error TS2304: Cannot find name 'a'. + + ==== tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts (17 errors) ==== var tt1 = (a, (b, c)) => a+b+c; ~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Cannot find name 'a'. +!!! error TS2304: Cannot find name 'a'. ~ -!!! Cannot find name 'b'. +!!! error TS2304: Cannot find name 'b'. ~ -!!! Cannot find name 'c'. +!!! error TS2304: Cannot find name 'c'. ~ -!!! Cannot find name 'a'. +!!! error TS2304: Cannot find name 'a'. ~ -!!! Cannot find name 'b'. +!!! error TS2304: Cannot find name 'b'. ~ -!!! Cannot find name 'c'. +!!! error TS2304: Cannot find name 'c'. var tt2 = ((a), b, c) => a+b+c; ~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Cannot find name 'a'. +!!! error TS2304: Cannot find name 'a'. ~ -!!! Cannot find name 'b'. +!!! error TS2304: Cannot find name 'b'. ~ -!!! Cannot find name 'c'. +!!! error TS2304: Cannot find name 'c'. ~ -!!! Cannot find name 'a'. +!!! error TS2304: Cannot find name 'a'. ~ -!!! Cannot find name 'b'. +!!! error TS2304: Cannot find name 'b'. ~ -!!! Cannot find name 'c'. +!!! error TS2304: Cannot find name 'c'. var tt3 = ((a)) => a; ~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Cannot find name 'a'. +!!! error TS2304: Cannot find name 'a'. ~ -!!! Cannot find name 'a'. \ No newline at end of file +!!! error TS2304: Cannot find name 'a'. \ No newline at end of file diff --git a/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt b/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt index 40d00c1cff7..dd2374f2447 100644 --- a/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt +++ b/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt @@ -1,9 +1,16 @@ -==== tests/cases/compiler/fieldAndGetterWithSameName.ts (2 errors) ==== +tests/cases/compiler/fieldAndGetterWithSameName.ts(3,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/fieldAndGetterWithSameName.ts(2,5): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/fieldAndGetterWithSameName.ts(3,7): error TS2300: Duplicate identifier 'x'. + + +==== tests/cases/compiler/fieldAndGetterWithSameName.ts (3 errors) ==== export class C { x: number; + ~ +!!! error TS2300: Duplicate identifier 'x'. get x(): number { return 1; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt new file mode 100644 index 00000000000..d9416eb4c25 --- /dev/null +++ b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts (1 errors) ==== + function bar(item1: T, item2: T) { } + bar(1, ""); // Should be ok + ~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types deleted file mode 100644 index 95214571df9..00000000000 --- a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types +++ /dev/null @@ -1,13 +0,0 @@ -=== tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts === -function bar(item1: T, item2: T) { } ->bar : (item1: T, item2: T) => void ->T : T ->item1 : T ->T : T ->item2 : T ->T : T - -bar(1, ""); // Should be ok ->bar(1, "") : void ->bar : (item1: T, item2: T) => void - diff --git a/tests/baselines/reference/for-inStatements.errors.txt b/tests/baselines/reference/for-inStatements.errors.txt index e90e3dea3d2..7e20b8ca316 100644 --- a/tests/baselines/reference/for-inStatements.errors.txt +++ b/tests/baselines/reference/for-inStatements.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + + ==== tests/cases/conformance/statements/for-inStatements/for-inStatements.ts (1 errors) ==== var aString: string; for (aString in {}) { } @@ -79,5 +82,5 @@ for (var x in Color) { } for (var x in Color.Blue) { } ~~~~~~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatementsInvalid.errors.txt b/tests/baselines/reference/for-inStatementsInvalid.errors.txt index 4b4fff8c51c..67e536a3069 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.errors.txt +++ b/tests/baselines/reference/for-inStatementsInvalid.errors.txt @@ -1,48 +1,66 @@ +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(2,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(5,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(8,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(10,10): error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(13,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(17,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(18,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(19,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(20,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(21,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(22,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(29,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(38,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(46,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(51,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(62,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + + ==== tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts (16 errors) ==== var aNumber: number; for (aNumber in {}) { } ~~~~~~~ -!!! The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. var aBoolean: boolean; for (aBoolean in {}) { } ~~~~~~~~ -!!! The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. var aRegExp: RegExp; for (aRegExp in {}) { } ~~~~~~~ -!!! The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. for (var idx : number in {}) { } ~~~ -!!! The left-hand side of a 'for...in' statement cannot use a type annotation. +!!! error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. function fn(): void { } for (var x in fn()) { } ~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. var c : string, d:string, e; for (var x in c || d) { } ~~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in e ? c : d) { } ~~~~~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in 42 ? c : d) { } ~~~~~~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in '' ? c : d) { } ~~~~~~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in 42 ? d[x] : c[x]) { } ~~~~~~~~~~~~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in c[23]) { } ~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in ((x: T) => x)) { } for (var x in function (x: string, y: number) { return x + y }) { } @@ -51,7 +69,7 @@ biz() : number{ for (var x in this.biz()) { } ~~~~~~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in this.biz) { } for (var x in this) { } return null; @@ -62,7 +80,7 @@ for (var x in this.baz) { } for (var x in this.baz()) { } ~~~~~~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. return null; } @@ -72,14 +90,14 @@ boz() { for (var x in this.biz()) { } ~~~~~~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in this.biz) { } for (var x in this) { } for (var x in super.biz) { } for (var x in super.biz()) { } ~~~~~~~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. return null; } } @@ -92,5 +110,5 @@ for (var x in i[42]) { } ~~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/for.errors.txt b/tests/baselines/reference/for.errors.txt index 8df068271a2..41ed5765c9a 100644 --- a/tests/baselines/reference/for.errors.txt +++ b/tests/baselines/reference/for.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/for.ts(29,6): error TS1109: Expression expected. + + ==== tests/cases/compiler/for.ts (1 errors) ==== for (var i = 0; i < 10; i++) { // ok var x1 = i; @@ -29,5 +32,5 @@ for () { // error ~ -!!! Expression expected. +!!! error TS1109: Expression expected. } \ No newline at end of file diff --git a/tests/baselines/reference/forIn.errors.txt b/tests/baselines/reference/forIn.errors.txt index 51a3b220359..ccc1423f1aa 100644 --- a/tests/baselines/reference/forIn.errors.txt +++ b/tests/baselines/reference/forIn.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/forIn.ts(2,10): error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. +tests/cases/compiler/forIn.ts(20,4): error TS2304: Cannot find name 'k'. + + ==== tests/cases/compiler/forIn.ts (2 errors) ==== var arr = null; for (var i:number in arr) { // error ~ -!!! The left-hand side of a 'for...in' statement cannot use a type annotation. +!!! error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. var x1 = arr[i]; var y1 = arr[i]; } @@ -22,5 +26,5 @@ // error in the body k[l] = 1; ~ -!!! Cannot find name 'k'. +!!! error TS2304: Cannot find name 'k'. } \ No newline at end of file diff --git a/tests/baselines/reference/forIn2.errors.txt b/tests/baselines/reference/forIn2.errors.txt index c1dbfa2da9b..f6a0b34e3e6 100644 --- a/tests/baselines/reference/forIn2.errors.txt +++ b/tests/baselines/reference/forIn2.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/forIn2.ts(1,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + + ==== tests/cases/compiler/forIn2.ts (1 errors) ==== for (var i in 1) { ~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. } \ No newline at end of file diff --git a/tests/baselines/reference/forInStatement2.errors.txt b/tests/baselines/reference/forInStatement2.errors.txt index ef064280a7e..575936eab5e 100644 --- a/tests/baselines/reference/forInStatement2.errors.txt +++ b/tests/baselines/reference/forInStatement2.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/forInStatement2.ts(2,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + + ==== tests/cases/compiler/forInStatement2.ts (1 errors) ==== var expr: number; for (var a in expr) { ~~~~ -!!! The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. } \ No newline at end of file diff --git a/tests/baselines/reference/forInStatement4.errors.txt b/tests/baselines/reference/forInStatement4.errors.txt index b228fb93c89..816f706c77c 100644 --- a/tests/baselines/reference/forInStatement4.errors.txt +++ b/tests/baselines/reference/forInStatement4.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/forInStatement4.ts(2,10): error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. + + ==== tests/cases/compiler/forInStatement4.ts (1 errors) ==== var expr: any; for (var a: number in expr) { ~ -!!! The left-hand side of a 'for...in' statement cannot use a type annotation. +!!! error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. } \ No newline at end of file diff --git a/tests/baselines/reference/forInStatement7.errors.txt b/tests/baselines/reference/forInStatement7.errors.txt index 432fe82237f..6f8e18c40ab 100644 --- a/tests/baselines/reference/forInStatement7.errors.txt +++ b/tests/baselines/reference/forInStatement7.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/forInStatement7.ts(3,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. + + ==== tests/cases/compiler/forInStatement7.ts (1 errors) ==== var a: number; var expr: any; for (a in expr) { ~ -!!! The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt index 17f50e3ff10..66e8a2a66df 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt @@ -1,3 +1,17 @@ +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(32,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(33,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(34,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(35,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(36,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(39,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(40,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(43,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(46,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'Array>'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(50,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(53,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. + + ==== tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts (12 errors) ==== interface I { id: number; @@ -32,47 +46,47 @@ for( var a: any;;){} for( var a = 1;;){} ~ -!!! Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. for( var a = 'a string';;){} ~ -!!! Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. for( var a = new C();;){} ~ -!!! Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. for( var a = new D();;){} ~ -!!! Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. for( var a = M;;){} ~ -!!! Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. for( var b: I;;){} for( var b = new C();;){} ~ -!!! Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. for( var b = new C2();;){} ~ -!!! Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. for(var f = F;;){} for( var f = (x: number) => '';;){} ~ -!!! Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. for(var arr: string[];;){} for( var arr = [1, 2, 3, 4];;){} ~~~ -!!! Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. for( var arr = [new C(), new C2(), new D()];;){} ~~~ -!!! Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '{}[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'Array>'. for(var arr2 = [new D()];;){} for( var arr2 = new Array>();;){} ~~~~ -!!! Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. for(var m: typeof M;;){} for( var m = M.A;;){} ~ -!!! Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. \ No newline at end of file diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.types b/tests/baselines/reference/forStatementsMultipleValidDecl.types index 2f3bfd70cea..c2458a306c7 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.types +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.types @@ -109,11 +109,11 @@ for (var a = ['a', 'b']; ;) { } for (var a = []; ;) { } >a : string[] >[] : string[] ->[] : string[] +>[] : undefined[] for (var a: string[] = []; ;) { } >a : string[] ->[] : string[] +>[] : undefined[] for (var a = new Array(); ;) { } >a : string[] diff --git a/tests/baselines/reference/forgottenNew.errors.txt b/tests/baselines/reference/forgottenNew.errors.txt index ba44223819c..56e5d2bfd24 100644 --- a/tests/baselines/reference/forgottenNew.errors.txt +++ b/tests/baselines/reference/forgottenNew.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/expressions/functionCalls/forgottenNew.ts(5,14): error TS2348: Value of type 'typeof NullLogger' is not callable. Did you mean to include 'new'? + + ==== tests/cases/conformance/expressions/functionCalls/forgottenNew.ts (1 errors) ==== module Tools { export class NullLogger { } @@ -5,4 +8,4 @@ var logger = Tools.NullLogger(); ~~~~~~~~~~~~~~~~~~ -!!! Value of type 'typeof NullLogger' is not callable. Did you mean to include 'new'? \ No newline at end of file +!!! error TS2348: Value of type 'typeof NullLogger' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/funClodule.errors.txt b/tests/baselines/reference/funClodule.errors.txt index e4d72d3fc0d..72a9ed0db51 100644 --- a/tests/baselines/reference/funClodule.errors.txt +++ b/tests/baselines/reference/funClodule.errors.txt @@ -1,26 +1,49 @@ -==== tests/cases/compiler/funClodule.ts (3 errors) ==== +tests/cases/compiler/funClodule.ts(1,18): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/funClodule.ts(2,16): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/funClodule.ts(5,15): error TS2300: Duplicate identifier 'foo'. +tests/cases/compiler/funClodule.ts(8,15): error TS2300: Duplicate identifier 'foo2'. +tests/cases/compiler/funClodule.ts(9,16): error TS2300: Duplicate identifier 'foo2'. +tests/cases/compiler/funClodule.ts(12,18): error TS2300: Duplicate identifier 'foo2'. +tests/cases/compiler/funClodule.ts(15,10): error TS2300: Duplicate identifier 'foo3'. +tests/cases/compiler/funClodule.ts(16,8): error TS2300: Duplicate identifier 'foo3'. +tests/cases/compiler/funClodule.ts(19,7): error TS2300: Duplicate identifier 'foo3'. + + +==== tests/cases/compiler/funClodule.ts (9 errors) ==== declare function foo(); + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. declare module foo { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. export function x(): any; } declare class foo { } // Should error ~~~ -!!! Duplicate identifier 'foo'. +!!! error TS2300: Duplicate identifier 'foo'. declare class foo2 { } + ~~~~ +!!! error TS2300: Duplicate identifier 'foo2'. declare module foo2 { + ~~~~ +!!! error TS2300: Duplicate identifier 'foo2'. export function x(): any; } declare function foo2(); // Should error ~~~~ -!!! Duplicate identifier 'foo2'. +!!! error TS2300: Duplicate identifier 'foo2'. function foo3() { } + ~~~~ +!!! error TS2300: Duplicate identifier 'foo3'. module foo3 { + ~~~~ +!!! error TS2300: Duplicate identifier 'foo3'. export function x(): any { } } class foo3 { } // Should error ~~~~ -!!! Duplicate identifier 'foo3'. \ No newline at end of file +!!! error TS2300: Duplicate identifier 'foo3'. \ No newline at end of file diff --git a/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt b/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt index 58936d29dbb..72f24af0c63 100644 --- a/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt +++ b/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts(6,5): error TS2411: Property 'prop' of type 'number' is not assignable to string index type 'string'. + + ==== tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts (2 errors) ==== function Foo(s: string); ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function Foo(n: number) { } interface Foo { [s: string]: string; prop: number; ~~~~~~~~~~~~~ -!!! Property 'prop' of type 'number' is not assignable to string index type 'string'. +!!! error TS2411: Property 'prop' of type 'number' is not assignable to string index type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt b/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt index 4eda4b8136c..640844064c4 100644 --- a/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt +++ b/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt @@ -1,11 +1,18 @@ -==== tests/cases/compiler/functionAndPropertyNameConflict.ts (2 errors) ==== +tests/cases/compiler/functionAndPropertyNameConflict.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/functionAndPropertyNameConflict.ts(2,12): error TS2300: Duplicate identifier 'aaaaa'. +tests/cases/compiler/functionAndPropertyNameConflict.ts(3,16): error TS2300: Duplicate identifier 'aaaaa'. + + +==== tests/cases/compiler/functionAndPropertyNameConflict.ts (3 errors) ==== class C65 { public aaaaa() { } + ~~~~~ +!!! error TS2300: Duplicate identifier 'aaaaa'. public get aaaaa() { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~ -!!! Duplicate identifier 'aaaaa'. +!!! error TS2300: Duplicate identifier 'aaaaa'. return 1; } } \ No newline at end of file diff --git a/tests/baselines/reference/functionArgShadowing.errors.txt b/tests/baselines/reference/functionArgShadowing.errors.txt index f1583f4185e..93022178452 100644 --- a/tests/baselines/reference/functionArgShadowing.errors.txt +++ b/tests/baselines/reference/functionArgShadowing.errors.txt @@ -1,20 +1,25 @@ +tests/cases/compiler/functionArgShadowing.ts(4,8): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'A', but here has type 'B'. +tests/cases/compiler/functionArgShadowing.ts(5,8): error TS2339: Property 'bar' does not exist on type 'A'. +tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'number', but here has type 'string'. + + ==== tests/cases/compiler/functionArgShadowing.ts (3 errors) ==== class A { foo() { } } class B { bar() { } } function foo(x: A) { var x: B = new B(); ~ -!!! Subsequent variable declarations must have the same type. Variable 'x' must be of type 'A', but here has type 'B'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'A', but here has type 'B'. x.bar(); // the property bar does not exist on a value of type A ~~~ -!!! Property 'bar' does not exist on type 'A'. +!!! error TS2339: Property 'bar' does not exist on type 'A'. } class C { constructor(public p: number) { var p: string; ~ -!!! Subsequent variable declarations must have the same type. Variable 'p' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'number', but here has type 'string'. var n: number = p; } diff --git a/tests/baselines/reference/functionAssignment.errors.txt b/tests/baselines/reference/functionAssignment.errors.txt index 76981e98885..c588d7fdc43 100644 --- a/tests/baselines/reference/functionAssignment.errors.txt +++ b/tests/baselines/reference/functionAssignment.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/functionAssignment.ts(22,5): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/functionAssignment.ts(34,17): error TS2339: Property 'length' does not exist on type 'number'. + + ==== tests/cases/compiler/functionAssignment.ts (2 errors) ==== function f(n: Function) { } f(function () { }); @@ -22,7 +26,7 @@ var n = ''; n = 4; ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. }); function f3(a: { a: number; b: number; }) { } @@ -36,7 +40,7 @@ callb((a) =>{ a.length; }); ~~~~~~ -!!! Property 'length' does not exist on type 'number'. +!!! error TS2339: Property 'length' does not exist on type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall10.errors.txt b/tests/baselines/reference/functionCall10.errors.txt index 5ae80cff0e8..8352fc70a58 100644 --- a/tests/baselines/reference/functionCall10.errors.txt +++ b/tests/baselines/reference/functionCall10.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/functionCall10.ts(3,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/compiler/functionCall10.ts(5,8): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + + ==== tests/cases/compiler/functionCall10.ts (2 errors) ==== function foo(...a:number[]){}; foo(0, 1); foo('foo'); ~~~~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. foo(); foo(1, 'bar'); ~~~~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall11.errors.txt b/tests/baselines/reference/functionCall11.errors.txt index 91593adb4e5..a1790974bbb 100644 --- a/tests/baselines/reference/functionCall11.errors.txt +++ b/tests/baselines/reference/functionCall11.errors.txt @@ -1,14 +1,19 @@ +tests/cases/compiler/functionCall11.ts(4,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/functionCall11.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall11.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/functionCall11.ts (3 errors) ==== function foo(a:string, b?:number){} foo('foo', 1); foo('foo'); foo(); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. foo(1, 'bar'); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 1, 'bar'); ~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall12.errors.txt b/tests/baselines/reference/functionCall12.errors.txt index 1a89772d74e..eabe1131ec1 100644 --- a/tests/baselines/reference/functionCall12.errors.txt +++ b/tests/baselines/reference/functionCall12.errors.txt @@ -1,15 +1,20 @@ +tests/cases/compiler/functionCall12.ts(4,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/functionCall12.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/functionCall12.ts (3 errors) ==== function foo(a:string, b?:number, c?:string){} foo('foo', 1); foo('foo'); foo(); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. foo(1, 'bar'); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 1, 'bar'); foo('foo', 1, 3); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall13.errors.txt b/tests/baselines/reference/functionCall13.errors.txt index 72a06c77c94..31c05915aab 100644 --- a/tests/baselines/reference/functionCall13.errors.txt +++ b/tests/baselines/reference/functionCall13.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/functionCall13.ts(4,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/functionCall13.ts (2 errors) ==== function foo(a:string, ...b:number[]){} foo('foo', 1); foo('foo'); foo(); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. foo(1, 'bar'); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 1, 3); \ No newline at end of file diff --git a/tests/baselines/reference/functionCall14.errors.txt b/tests/baselines/reference/functionCall14.errors.txt index adfd2530532..3b671d0252b 100644 --- a/tests/baselines/reference/functionCall14.errors.txt +++ b/tests/baselines/reference/functionCall14.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/functionCall14.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/functionCall14.ts (1 errors) ==== function foo(a?:string, ...b:number[]){} foo('foo', 1); @@ -5,6 +8,6 @@ foo(); foo(1, 'bar'); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 1, 3); \ No newline at end of file diff --git a/tests/baselines/reference/functionCall15.errors.txt b/tests/baselines/reference/functionCall15.errors.txt index cb009fc63ab..4b6acf34e14 100644 --- a/tests/baselines/reference/functionCall15.errors.txt +++ b/tests/baselines/reference/functionCall15.errors.txt @@ -1,4 +1,10 @@ -==== tests/cases/compiler/functionCall15.ts (1 errors) ==== +tests/cases/compiler/functionCall15.ts(1,25): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/functionCall15.ts(1,39): error TS2300: Duplicate identifier 'b'. + + +==== tests/cases/compiler/functionCall15.ts (2 errors) ==== function foo(a?:string, b?:number, ...b:number[]){} + ~ +!!! error TS2300: Duplicate identifier 'b'. ~ -!!! Duplicate identifier 'b'. \ No newline at end of file +!!! error TS2300: Duplicate identifier 'b'. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall16.errors.txt b/tests/baselines/reference/functionCall16.errors.txt index f29d90f56c2..eb71df23eca 100644 --- a/tests/baselines/reference/functionCall16.errors.txt +++ b/tests/baselines/reference/functionCall16.errors.txt @@ -1,15 +1,20 @@ +tests/cases/compiler/functionCall16.ts(2,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall16.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/functionCall16.ts (3 errors) ==== function foo(a:string, b?:string, ...c:number[]){} foo('foo', 1); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo'); foo('foo', 'bar'); foo(); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. foo(1, 'bar'); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 'bar', 3); \ No newline at end of file diff --git a/tests/baselines/reference/functionCall17.errors.txt b/tests/baselines/reference/functionCall17.errors.txt index f6280586cb2..09f36c22cfb 100644 --- a/tests/baselines/reference/functionCall17.errors.txt +++ b/tests/baselines/reference/functionCall17.errors.txt @@ -1,17 +1,23 @@ +tests/cases/compiler/functionCall17.ts(2,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall17.ts(4,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/functionCall17.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/functionCall17.ts (4 errors) ==== function foo(a:string, b?:string, c?:number, ...d:number[]){} foo('foo', 1); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo'); foo(); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. foo(1, 'bar'); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 1, 3); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 'bar', 3, 4); \ No newline at end of file diff --git a/tests/baselines/reference/functionCall3.types b/tests/baselines/reference/functionCall3.types index a9b8e46069c..ea47de3e6d9 100644 --- a/tests/baselines/reference/functionCall3.types +++ b/tests/baselines/reference/functionCall3.types @@ -1,7 +1,7 @@ === tests/cases/compiler/functionCall3.ts === function foo():any[]{return [1];} >foo : () => any[] ->[1] : any[] +>[1] : number[] var x = foo(); >x : any[] diff --git a/tests/baselines/reference/functionCall6.errors.txt b/tests/baselines/reference/functionCall6.errors.txt index c871e15d30a..4da265ea5e2 100644 --- a/tests/baselines/reference/functionCall6.errors.txt +++ b/tests/baselines/reference/functionCall6.errors.txt @@ -1,13 +1,18 @@ +tests/cases/compiler/functionCall6.ts(3,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall6.ts(4,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/functionCall6.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/functionCall6.ts (3 errors) ==== function foo(a:string){}; foo('bar'); foo(2); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 'bar'); ~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. foo(); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall7.errors.txt b/tests/baselines/reference/functionCall7.errors.txt index d41add08dd3..576ea9c266e 100644 --- a/tests/baselines/reference/functionCall7.errors.txt +++ b/tests/baselines/reference/functionCall7.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/functionCall7.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/functionCall7.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'. +tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/functionCall7.ts (3 errors) ==== module m1 { export class c1 { public a; }} function foo(a:m1.c1){ a.a = 1; }; @@ -5,11 +10,11 @@ foo(myC); foo(myC, myC); ~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. foo(4); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'c1'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'. foo(); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall8.errors.txt b/tests/baselines/reference/functionCall8.errors.txt index 85eee804724..0e5479c8cfd 100644 --- a/tests/baselines/reference/functionCall8.errors.txt +++ b/tests/baselines/reference/functionCall8.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/functionCall8.ts(3,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/functionCall8.ts(4,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/functionCall8.ts (2 errors) ==== function foo(a?:string){} foo('foo'); foo('foo', 'bar'); ~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. foo(4); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo(); \ No newline at end of file diff --git a/tests/baselines/reference/functionCall9.errors.txt b/tests/baselines/reference/functionCall9.errors.txt index 5feb59f77c6..d9d00593414 100644 --- a/tests/baselines/reference/functionCall9.errors.txt +++ b/tests/baselines/reference/functionCall9.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/functionCall9.ts(4,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/compiler/functionCall9.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/functionCall9.ts (2 errors) ==== function foo(a?:string, b?:number){}; foo('foo', 1); foo('foo'); foo('foo','bar'); ~~~~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. foo('foo', 1, 'bar'); ~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. foo(); \ No newline at end of file diff --git a/tests/baselines/reference/functionCalls.errors.txt b/tests/baselines/reference/functionCalls.errors.txt index 3aa587c70a3..dc1417cdc98 100644 --- a/tests/baselines/reference/functionCalls.errors.txt +++ b/tests/baselines/reference/functionCalls.errors.txt @@ -1,3 +1,14 @@ +tests/cases/conformance/expressions/functionCalls/functionCalls.ts(9,1): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/expressions/functionCalls/functionCalls.ts(10,1): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/expressions/functionCalls/functionCalls.ts(11,1): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/expressions/functionCalls/functionCalls.ts(26,1): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/expressions/functionCalls/functionCalls.ts(27,1): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/expressions/functionCalls/functionCalls.ts(28,1): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/expressions/functionCalls/functionCalls.ts(33,1): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/expressions/functionCalls/functionCalls.ts(34,1): error TS2347: Untyped function calls may not accept type arguments. +tests/cases/conformance/expressions/functionCalls/functionCalls.ts(35,1): error TS2347: Untyped function calls may not accept type arguments. + + ==== tests/cases/conformance/expressions/functionCalls/functionCalls.ts (9 errors) ==== // Invoke function call on value of type 'any' with no type arguments @@ -9,13 +20,13 @@ // These should be errors anyVar('hello'); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. anyVar(); ~~~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. anyVar(undefined); ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. // Invoke function call on value of a subtype of Function with no call signatures with no type arguments @@ -32,24 +43,24 @@ // These should be errors subFunc(0); ~~~~~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. subFunc(''); ~~~~~~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. subFunc(); ~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. // Invoke function call on value of type Function with no call signatures with type arguments // These should be errors var func: Function; func(0); ~~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. func(''); ~~~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. func(); ~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. +!!! error TS2347: Untyped function calls may not accept type arguments. \ No newline at end of file diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt index 3fb2b84fed5..4af5c01c505 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt +++ b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt @@ -1,3 +1,19 @@ +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(24,15): error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(25,15): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(26,15): error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(28,16): error TS2345: Argument of type '(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(29,16): error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(30,16): error TS2345: Argument of type 'new (x: T) => T' is not assignable to parameter of type '(x: string) => string'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(34,16): error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(36,38): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(38,10): error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'. + + ==== tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts (14 errors) ==== // satisfaction of a constraint to Function, all of these invocations are errors unless otherwise noted @@ -5,13 +21,13 @@ foo(1); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'Function'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'. foo(() => { }, 1); ~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. foo(1, () => { }); ~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. function foo2 string>(x: T): T { return x; } @@ -29,41 +45,41 @@ var r = foo2(new Function()); ~~~~~~~~~~~~~~ -!!! Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'. var r2 = foo2((x: string[]) => x); ~~~~~~~~~~~~~~~~~~ -!!! Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. var r6 = foo2(C); ~ -!!! Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. var r7 = foo2(b); ~ -!!! Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'. var r8 = foo2((x: U) => x); // no error expected var r11 = foo2((x: U, y: V) => x); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Argument of type '(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'. var r13 = foo2(C2); ~~ -!!! Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'. var r14 = foo2(b2); ~~ -!!! Argument of type 'new (x: T) => T' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Argument of type 'new (x: T) => T' is not assignable to parameter of type '(x: string) => string'. interface F2 extends Function { foo: string; } var f2: F2; var r16 = foo2(f2); ~~ -!!! Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'. function fff(x: T, y: U) { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo2(x); ~ -!!! Argument of type 'T' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'. foo2(y); ~ -!!! Argument of type 'U' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'. } \ No newline at end of file diff --git a/tests/baselines/reference/functionExpressionInWithBlock.errors.txt b/tests/baselines/reference/functionExpressionInWithBlock.errors.txt index 6a0947e95b2..eabb8af49f9 100644 --- a/tests/baselines/reference/functionExpressionInWithBlock.errors.txt +++ b/tests/baselines/reference/functionExpressionInWithBlock.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/functionExpressionInWithBlock.ts(2,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. + + ==== tests/cases/compiler/functionExpressionInWithBlock.ts (1 errors) ==== function x() { with({}) { ~~ -!!! All symbols within a 'with' block will be resolved to 'any'. +!!! error TS2410: All symbols within a 'with' block will be resolved to 'any'. function f() { () => this; } diff --git a/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt b/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt index e8f34d5d556..74b4c171a57 100644 --- a/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt +++ b/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt @@ -1,9 +1,13 @@ +tests/cases/compiler/functionExpressionShadowedByParams.ts(3,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/functionExpressionShadowedByParams.ts(10,9): error TS2339: Property 'apply' does not exist on type 'number'. + + ==== tests/cases/compiler/functionExpressionShadowedByParams.ts (2 errors) ==== function b1(b1: number) { b1.toPrecision(2); // should not error b1(12); // should error ~~~~~~ -!!! Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. } @@ -12,7 +16,7 @@ b.toPrecision(2); // should not error b.apply(null, null); // should error ~~~~~ -!!! Property 'apply' does not exist on type 'number'. +!!! error TS2339: Property 'apply' does not exist on type 'number'. } }; \ No newline at end of file diff --git a/tests/baselines/reference/functionImplementationErrors.errors.txt b/tests/baselines/reference/functionImplementationErrors.errors.txt index 5c2d678840e..fbae17a609d 100644 --- a/tests/baselines/reference/functionImplementationErrors.errors.txt +++ b/tests/baselines/reference/functionImplementationErrors.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/functions/functionImplementationErrors.ts(2,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(6,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(10,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(16,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(25,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +tests/cases/conformance/functions/functionImplementationErrors.ts(30,17): error TS2373: Initializer of parameter 'n' cannot reference identifier 'm' declared after it. +tests/cases/conformance/functions/functionImplementationErrors.ts(35,17): error TS2373: Initializer of parameter 'n' cannot reference identifier 'm' declared after it. +tests/cases/conformance/functions/functionImplementationErrors.ts(40,28): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. + + ==== tests/cases/conformance/functions/functionImplementationErrors.ts (8 errors) ==== // FunctionExpression with no return type annotation with multiple return statements with unrelated types var f1 = function () { @@ -8,7 +18,7 @@ ~~~~~~~~~~~~~ }; ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. var f2 = function x() { ~~~~~~~~~~~~~~ return ''; @@ -17,7 +27,7 @@ ~~~~~~~~~~~~~ }; ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. var f3 = () => { ~~~~~~~ return ''; @@ -26,7 +36,7 @@ ~~~~~~~~~~~~~ }; ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. // FunctionExpression with no return type annotation with return branch of number[] and other of string[] var f4 = function () { @@ -43,33 +53,33 @@ ~~~~~ } ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. // Function implemetnation with non -void return type annotation with no return function f5(): number { ~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. } var m; // Function signature with parameter initializer referencing in scope local variable function f6(n = m) { ~ -!!! Initializer of parameter 'n' cannot reference identifier 'm' declared after it. +!!! error TS2373: Initializer of parameter 'n' cannot reference identifier 'm' declared after it. var m = 4; } // Function signature with initializer referencing other parameter to the right function f7(n = m, m?) { ~ -!!! Initializer of parameter 'n' cannot reference identifier 'm' declared after it. +!!! error TS2373: Initializer of parameter 'n' cannot reference identifier 'm' declared after it. } // FunctionExpression with non -void return type annotation with a throw, no return, and other code // Should be error but isn't undefined === function (): number { ~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. throw undefined; var x = 4; }; diff --git a/tests/baselines/reference/functionNameConflicts.errors.txt b/tests/baselines/reference/functionNameConflicts.errors.txt index 0442a51324b..86fa348d817 100644 --- a/tests/baselines/reference/functionNameConflicts.errors.txt +++ b/tests/baselines/reference/functionNameConflicts.errors.txt @@ -1,40 +1,63 @@ -==== tests/cases/conformance/functions/functionNameConflicts.ts (6 errors) ==== +tests/cases/conformance/functions/functionNameConflicts.ts(5,14): error TS2300: Duplicate identifier 'fn1'. +tests/cases/conformance/functions/functionNameConflicts.ts(6,9): error TS2300: Duplicate identifier 'fn1'. +tests/cases/conformance/functions/functionNameConflicts.ts(8,9): error TS2300: Duplicate identifier 'fn2'. +tests/cases/conformance/functions/functionNameConflicts.ts(9,14): error TS2300: Duplicate identifier 'fn2'. +tests/cases/conformance/functions/functionNameConflicts.ts(12,10): error TS2300: Duplicate identifier 'fn3'. +tests/cases/conformance/functions/functionNameConflicts.ts(13,5): error TS2300: Duplicate identifier 'fn3'. +tests/cases/conformance/functions/functionNameConflicts.ts(16,9): error TS2300: Duplicate identifier 'fn4'. +tests/cases/conformance/functions/functionNameConflicts.ts(17,14): error TS2300: Duplicate identifier 'fn4'. +tests/cases/conformance/functions/functionNameConflicts.ts(19,14): error TS2300: Duplicate identifier 'fn5'. +tests/cases/conformance/functions/functionNameConflicts.ts(20,9): error TS2300: Duplicate identifier 'fn5'. +tests/cases/conformance/functions/functionNameConflicts.ts(24,10): error TS2389: Function implementation name must be 'over'. + + +==== tests/cases/conformance/functions/functionNameConflicts.ts (11 errors) ==== //Function and variable of the same name in same declaration space //Function overload with different name from implementation signature module M { function fn1() { } + ~~~ +!!! error TS2300: Duplicate identifier 'fn1'. var fn1; ~~~ -!!! Duplicate identifier 'fn1'. +!!! error TS2300: Duplicate identifier 'fn1'. var fn2; + ~~~ +!!! error TS2300: Duplicate identifier 'fn2'. function fn2() { } ~~~ -!!! Duplicate identifier 'fn2'. +!!! error TS2300: Duplicate identifier 'fn2'. } function fn3() { } + ~~~ +!!! error TS2300: Duplicate identifier 'fn3'. var fn3; ~~~ -!!! Duplicate identifier 'fn3'. +!!! error TS2300: Duplicate identifier 'fn3'. function func() { var fn4; + ~~~ +!!! error TS2300: Duplicate identifier 'fn4'. function fn4() { } ~~~ -!!! Duplicate identifier 'fn4'. +!!! error TS2300: Duplicate identifier 'fn4'. function fn5() { } + ~~~ +!!! error TS2300: Duplicate identifier 'fn5'. var fn5; ~~~ -!!! Duplicate identifier 'fn5'. +!!! error TS2300: Duplicate identifier 'fn5'. } function over(); function overrr() { ~~~~~~ -!!! Function implementation name must be 'over'. +!!! error TS2389: Function implementation name must be 'over'. } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadAmbiguity1.errors.txt b/tests/baselines/reference/functionOverloadAmbiguity1.errors.txt index 7c9eb9482df..75fc140bc68 100644 --- a/tests/baselines/reference/functionOverloadAmbiguity1.errors.txt +++ b/tests/baselines/reference/functionOverloadAmbiguity1.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/functionOverloadAmbiguity1.ts(4,18): error TS2339: Property 'length' does not exist on type 'number'. + + ==== tests/cases/compiler/functionOverloadAmbiguity1.ts (1 errors) ==== function callb(lam: (l: number) => void ); function callb(lam: (n: string) => void ); function callb(a) { } callb((a) => { a.length; } ); // error, chose first overload ~~~~~~ -!!! Property 'length' does not exist on type 'number'. +!!! error TS2339: Property 'length' does not exist on type 'number'. function callb2(lam: (n: string) => void ); function callb2(lam: (l: number) => void ); diff --git a/tests/baselines/reference/functionOverloadErrors.errors.txt b/tests/baselines/reference/functionOverloadErrors.errors.txt index c2fcff7a943..bc4fea0a98b 100644 --- a/tests/baselines/reference/functionOverloadErrors.errors.txt +++ b/tests/baselines/reference/functionOverloadErrors.errors.txt @@ -1,8 +1,24 @@ +tests/cases/conformance/functions/functionOverloadErrors.ts(2,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/functions/functionOverloadErrors.ts(44,25): error TS2304: Cannot find name 'Window'. +tests/cases/conformance/functions/functionOverloadErrors.ts(50,25): error TS2304: Cannot find name 'Window'. +tests/cases/conformance/functions/functionOverloadErrors.ts(51,32): error TS2304: Cannot find name 'window'. +tests/cases/conformance/functions/functionOverloadErrors.ts(65,13): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/functions/functionOverloadErrors.ts(68,13): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/functions/functionOverloadErrors.ts(75,21): error TS2383: Overload signatures must all be exported or not exported. +tests/cases/conformance/functions/functionOverloadErrors.ts(79,14): error TS2383: Overload signatures must all be exported or not exported. +tests/cases/conformance/functions/functionOverloadErrors.ts(85,18): error TS2384: Overload signatures must all be ambient or non-ambient. +tests/cases/conformance/functions/functionOverloadErrors.ts(90,18): error TS2384: Overload signatures must all be ambient or non-ambient. +tests/cases/conformance/functions/functionOverloadErrors.ts(94,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/functions/functionOverloadErrors.ts(99,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/functions/functionOverloadErrors.ts(103,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/functions/functionOverloadErrors.ts(116,19): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + + ==== tests/cases/conformance/functions/functionOverloadErrors.ts (14 errors) ==== //Function overload signature with initializer function fn1(x = 3); ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. function fn1() { } //Multiple function overload signatures that are identical @@ -46,7 +62,7 @@ //Function overloads that differ only by type parameter constraints function fn10(); ~~~~~~ -!!! Cannot find name 'Window'. +!!! error TS2304: Cannot find name 'Window'. function fn10(); function fn10() { } // (actually OK) @@ -54,10 +70,10 @@ //Function overloads that differ only by type parameter constraints where constraints are structually identical function fn11(); ~~~~~~ -!!! Cannot find name 'Window'. +!!! error TS2304: Cannot find name 'Window'. function fn11(); ~~~~~~ -!!! Cannot find name 'window'. +!!! error TS2304: Cannot find name 'window'. function fn11() { } //Function overloads that differ only by type parameter constraints where constraints include infinitely recursive type reference @@ -73,12 +89,12 @@ public f(); private f(s: string); ~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. f() { } private g(s: string); ~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. public g(); g() { } } @@ -87,13 +103,13 @@ module M { export function fn1(); ~~~ -!!! Overload signatures must all be exported or not exported. +!!! error TS2383: Overload signatures must all be exported or not exported. function fn1(n: string); function fn1() { } function fn2(n: string); ~~~ -!!! Overload signatures must all be exported or not exported. +!!! error TS2383: Overload signatures must all be exported or not exported. export function fn2(); export function fn2() { } } @@ -101,33 +117,33 @@ //Function overloads with differing ambience declare function dfn1(); ~~~~ -!!! Overload signatures must all be ambient or non-ambient. +!!! error TS2384: Overload signatures must all be ambient or non-ambient. function dfn1(s: string); function dfn1() { } function dfn2(); declare function dfn2(s: string); ~~~~ -!!! Overload signatures must all be ambient or non-ambient. +!!! error TS2384: Overload signatures must all be ambient or non-ambient. function dfn2() { } //Function overloads with fewer params than implementation signature function fewerParams(); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function fewerParams(n: string) { } //Function implementation whose parameter types are not assignable to all corresponding overload signature parameters function fn13(n: string); ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function fn13(n: number) { } //Function overloads where return types are not all subtype of implementation return type function fn14(n: string): string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function fn14() { return 3; } @@ -142,6 +158,6 @@ //Function overloads which use initializer expressions function initExpr(n = 13); ~~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. function initExpr() { } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadErrorsSyntax.errors.txt b/tests/baselines/reference/functionOverloadErrorsSyntax.errors.txt index 81f7a63b967..98e7f4cd714 100644 --- a/tests/baselines/reference/functionOverloadErrorsSyntax.errors.txt +++ b/tests/baselines/reference/functionOverloadErrorsSyntax.errors.txt @@ -1,18 +1,23 @@ +tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(2,27): error TS1016: A required parameter cannot follow an optional parameter. +tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(5,38): error TS1016: A required parameter cannot follow an optional parameter. +tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(9,28): error TS1014: A rest parameter must be last in a parameter list. + + ==== tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts (3 errors) ==== //Function overload signature with optional parameter followed by non-optional parameter function fn4a(x?: number, y: string); ~ -!!! A required parameter cannot follow an optional parameter. +!!! error TS1016: A required parameter cannot follow an optional parameter. function fn4a() { } function fn4b(n: string, x?: number, y: string); ~ -!!! A required parameter cannot follow an optional parameter. +!!! error TS1016: A required parameter cannot follow an optional parameter. function fn4b() { } //Function overload signature with rest param followed by non-optional parameter function fn5(x: string, ...y: any[], z: string); ~ -!!! A rest parameter must be last in a parameter list. +!!! error TS1014: A rest parameter must be last in a parameter list. function fn5() { } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadImplementationOfWrongName.errors.txt b/tests/baselines/reference/functionOverloadImplementationOfWrongName.errors.txt index 427595d1e05..d1d02f63ccf 100644 --- a/tests/baselines/reference/functionOverloadImplementationOfWrongName.errors.txt +++ b/tests/baselines/reference/functionOverloadImplementationOfWrongName.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/functionOverloadImplementationOfWrongName.ts(3,10): error TS2389: Function implementation name must be 'foo'. + + ==== tests/cases/compiler/functionOverloadImplementationOfWrongName.ts (1 errors) ==== function foo(x); function foo(x, y); function bar() { } ~~~ -!!! Function implementation name must be 'foo'. \ No newline at end of file +!!! error TS2389: Function implementation name must be 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt b/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt index c656065b375..07826696854 100644 --- a/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt +++ b/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/functionOverloadImplementationOfWrongName2.ts(2,10): error TS2389: Function implementation name must be 'foo'. +tests/cases/compiler/functionOverloadImplementationOfWrongName2.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/functionOverloadImplementationOfWrongName2.ts (2 errors) ==== function foo(x); function bar() { } ~~~ -!!! Function implementation name must be 'foo'. +!!! error TS2389: Function implementation name must be 'foo'. function foo(x, y); ~~~ -!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file +!!! error TS2391: Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads.errors.txt b/tests/baselines/reference/functionOverloads.errors.txt index 1b2e20e5a8d..bd3bab3388b 100644 --- a/tests/baselines/reference/functionOverloads.errors.txt +++ b/tests/baselines/reference/functionOverloads.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/functionOverloads.ts(4,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/functionOverloads.ts (1 errors) ==== function foo(): string; function foo(bar: string): number; function foo(bar?: string): any { return "" }; var x = foo(5); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads1.errors.txt b/tests/baselines/reference/functionOverloads1.errors.txt index 610363c772f..1f920c0ecf1 100644 --- a/tests/baselines/reference/functionOverloads1.errors.txt +++ b/tests/baselines/reference/functionOverloads1.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/functionOverloads1.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/functionOverloads1.ts (1 errors) ==== function foo(); ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. 1+1; function foo():string { return "a" } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads11.errors.txt b/tests/baselines/reference/functionOverloads11.errors.txt index a3a8393ec78..18155cbe69f 100644 --- a/tests/baselines/reference/functionOverloads11.errors.txt +++ b/tests/baselines/reference/functionOverloads11.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/functionOverloads11.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. + + ==== tests/cases/compiler/functionOverloads11.ts (1 errors) ==== function foo():number; ~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo():string { return "" } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads17.errors.txt b/tests/baselines/reference/functionOverloads17.errors.txt index 434cacaeac1..44565702632 100644 --- a/tests/baselines/reference/functionOverloads17.errors.txt +++ b/tests/baselines/reference/functionOverloads17.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/functionOverloads17.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. + + ==== tests/cases/compiler/functionOverloads17.ts (1 errors) ==== function foo():{a:number;} ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo():{a:string;} { return {a:""} } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads18.errors.txt b/tests/baselines/reference/functionOverloads18.errors.txt index 9db680de2e2..384c1e3fa8f 100644 --- a/tests/baselines/reference/functionOverloads18.errors.txt +++ b/tests/baselines/reference/functionOverloads18.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/functionOverloads18.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. + + ==== tests/cases/compiler/functionOverloads18.ts (1 errors) ==== function foo(bar:{a:number;}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo(bar:{a:string;}) { return {a:""} } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads19.errors.txt b/tests/baselines/reference/functionOverloads19.errors.txt index 807a3383c86..4c6935493e9 100644 --- a/tests/baselines/reference/functionOverloads19.errors.txt +++ b/tests/baselines/reference/functionOverloads19.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/functionOverloads19.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. + + ==== tests/cases/compiler/functionOverloads19.ts (1 errors) ==== function foo(bar:{b:string;}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo(bar:{a:string;}); function foo(bar:{a:any;}) { return {a:""} } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads2.errors.txt b/tests/baselines/reference/functionOverloads2.errors.txt index c0023ab9dcd..85a4a882487 100644 --- a/tests/baselines/reference/functionOverloads2.errors.txt +++ b/tests/baselines/reference/functionOverloads2.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/functionOverloads2.ts(4,13): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. + + ==== tests/cases/compiler/functionOverloads2.ts (1 errors) ==== function foo(bar: string): string; function foo(bar: number): number; function foo(bar: any): any { return bar }; var x = foo(true); ~~~~ -!!! Argument of type 'boolean' is not assignable to parameter of type 'number'. \ No newline at end of file +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads20.errors.txt b/tests/baselines/reference/functionOverloads20.errors.txt index 106dde569a8..2a51afefe0c 100644 --- a/tests/baselines/reference/functionOverloads20.errors.txt +++ b/tests/baselines/reference/functionOverloads20.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/functionOverloads20.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. + + ==== tests/cases/compiler/functionOverloads20.ts (1 errors) ==== function foo(bar:{a:number;}): number; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo(bar:{a:string;}): string; function foo(bar:{a:any;}): string {return ""} \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads22.errors.txt b/tests/baselines/reference/functionOverloads22.errors.txt index e091094f01e..bc075e0c3ef 100644 --- a/tests/baselines/reference/functionOverloads22.errors.txt +++ b/tests/baselines/reference/functionOverloads22.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/functionOverloads22.ts(2,1): error TS2394: Overload signature is not compatible with function implementation. + + ==== tests/cases/compiler/functionOverloads22.ts (1 errors) ==== function foo(bar:number):{a:number;}[]; function foo(bar:string):{a:number; b:string;}[]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo(bar:any):{a:any;b?:any;}[] { return [{a:""}] } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads27.errors.txt b/tests/baselines/reference/functionOverloads27.errors.txt index 35216e2fe42..a5d16935f2f 100644 --- a/tests/baselines/reference/functionOverloads27.errors.txt +++ b/tests/baselines/reference/functionOverloads27.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/functionOverloads27.ts(4,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/functionOverloads27.ts (1 errors) ==== function foo():string; function foo(bar:string):number; function foo(bar?:any):any{ return '' } var x = foo(5); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads29.errors.txt b/tests/baselines/reference/functionOverloads29.errors.txt index 510d9c4575f..763405e351b 100644 --- a/tests/baselines/reference/functionOverloads29.errors.txt +++ b/tests/baselines/reference/functionOverloads29.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/functionOverloads29.ts(4,9): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/functionOverloads29.ts (1 errors) ==== function foo(bar:string):string; function foo(bar:number):number; function foo(bar:any):any{ return bar } var x = foo(); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads3.errors.txt b/tests/baselines/reference/functionOverloads3.errors.txt index b153d81c109..1f02b0fbc47 100644 --- a/tests/baselines/reference/functionOverloads3.errors.txt +++ b/tests/baselines/reference/functionOverloads3.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/functionOverloads3.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/functionOverloads3.ts (1 errors) ==== function foo():string; ~~~ -!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file +!!! error TS2391: Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads34.errors.txt b/tests/baselines/reference/functionOverloads34.errors.txt index 6dc7b45c3d2..ccd771d2130 100644 --- a/tests/baselines/reference/functionOverloads34.errors.txt +++ b/tests/baselines/reference/functionOverloads34.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/functionOverloads34.ts(4,9): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/functionOverloads34.ts (1 errors) ==== function foo(bar:{a:number;}):string; function foo(bar:{a:boolean;}):number; function foo(bar:{a:any;}):any{ return bar } var x = foo(); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads37.errors.txt b/tests/baselines/reference/functionOverloads37.errors.txt index 0e93e7a459b..742e1bedb22 100644 --- a/tests/baselines/reference/functionOverloads37.errors.txt +++ b/tests/baselines/reference/functionOverloads37.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/functionOverloads37.ts(4,9): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/functionOverloads37.ts (1 errors) ==== function foo(bar:{a:number;}[]):string; function foo(bar:{a:boolean;}[]):number; function foo(bar:{a:any;}[]):any{ return bar } var x = foo(); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads4.errors.txt b/tests/baselines/reference/functionOverloads4.errors.txt index 3ec1a19dd35..1e41fde6021 100644 --- a/tests/baselines/reference/functionOverloads4.errors.txt +++ b/tests/baselines/reference/functionOverloads4.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/functionOverloads4.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. + + ==== tests/cases/compiler/functionOverloads4.ts (1 errors) ==== function foo():number; ~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo():string { return "a" } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads40.errors.txt b/tests/baselines/reference/functionOverloads40.errors.txt index 94e9ccc9ab2..cf23d39c108 100644 --- a/tests/baselines/reference/functionOverloads40.errors.txt +++ b/tests/baselines/reference/functionOverloads40.errors.txt @@ -1,11 +1,17 @@ +tests/cases/compiler/functionOverloads40.ts(4,13): error TS2345: Argument of type '{ a: string; }[]' is not assignable to parameter of type '{ a: boolean; }[]'. + Type '{ a: string; }' is not assignable to type '{ a: boolean; }': + Types of property 'a' are incompatible: + Type 'string' is not assignable to type 'boolean'. + + ==== tests/cases/compiler/functionOverloads40.ts (1 errors) ==== function foo(bar:{a:number;}[]):string; function foo(bar:{a:boolean;}[]):number; function foo(bar:{a:any;}[]):any{ return bar } var x = foo([{a:'bar'}]); ~~~~~~~~~~~ -!!! Argument of type '{ a: string; }[]' is not assignable to parameter of type '{ a: boolean; }[]'. -!!! Type '{ a: string; }' is not assignable to type '{ a: boolean; }': -!!! Types of property 'a' are incompatible: -!!! Type 'string' is not assignable to type 'boolean'. +!!! error TS2345: Argument of type '{ a: string; }[]' is not assignable to parameter of type '{ a: boolean; }[]'. +!!! error TS2345: Type '{ a: string; }' is not assignable to type '{ a: boolean; }': +!!! error TS2345: Types of property 'a' are incompatible: +!!! error TS2345: Type 'string' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads41.errors.txt b/tests/baselines/reference/functionOverloads41.errors.txt index 5d84364f8d2..47b1e031133 100644 --- a/tests/baselines/reference/functionOverloads41.errors.txt +++ b/tests/baselines/reference/functionOverloads41.errors.txt @@ -1,10 +1,15 @@ +tests/cases/compiler/functionOverloads41.ts(4,13): error TS2345: Argument of type '{}[]' is not assignable to parameter of type '{ a: boolean; }[]'. + Type '{}' is not assignable to type '{ a: boolean; }': + Property 'a' is missing in type '{}'. + + ==== tests/cases/compiler/functionOverloads41.ts (1 errors) ==== function foo(bar:{a:number;}[]):string; function foo(bar:{a:boolean;}[]):number; function foo(bar:{a:any;}[]):any{ return bar } var x = foo([{}]); ~~~~ -!!! Argument of type '{}[]' is not assignable to parameter of type '{ a: boolean; }[]'. -!!! Type '{}' is not assignable to type '{ a: boolean; }': -!!! Property 'a' is missing in type '{}'. +!!! error TS2345: Argument of type '{}[]' is not assignable to parameter of type '{ a: boolean; }[]'. +!!! error TS2345: Type '{}' is not assignable to type '{ a: boolean; }': +!!! error TS2345: Property 'a' is missing in type '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads42.types b/tests/baselines/reference/functionOverloads42.types index dec6a041440..6641a28c87a 100644 --- a/tests/baselines/reference/functionOverloads42.types +++ b/tests/baselines/reference/functionOverloads42.types @@ -19,7 +19,7 @@ var x = foo([{a:'s'}]); >x : number >foo([{a:'s'}]) : number >foo : { (bar: { a: number; }[]): string; (bar: { a: any; }[]): number; } ->[{a:'s'}] : { a: any; }[] +>[{a:'s'}] : { a: string; }[] >{a:'s'} : { a: string; } >a : string diff --git a/tests/baselines/reference/functionOverloads5.errors.txt b/tests/baselines/reference/functionOverloads5.errors.txt index a73fb152a0e..60a74f103e0 100644 --- a/tests/baselines/reference/functionOverloads5.errors.txt +++ b/tests/baselines/reference/functionOverloads5.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/functionOverloads5.ts(2,10): error TS2385: Overload signatures must all be public, private or protected. + + ==== tests/cases/compiler/functionOverloads5.ts (1 errors) ==== class baz { public foo(); ~~~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private foo(bar?:any){ } } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt b/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt index c5cfcb2ac73..8aab3d3e387 100644 --- a/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt +++ b/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/functionOverloadsOutOfOrder.ts(6,13): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/functionOverloadsOutOfOrder.ts(14,13): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/functionOverloadsOutOfOrder.ts (2 errors) ==== class d { private foo(n: number): string; @@ -6,7 +10,7 @@ } private foo(s: string): string; ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } class e { @@ -16,5 +20,5 @@ private foo(s: string): string; private foo(n: number): string; ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt b/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt index 7d7a66e42b1..f731a2e7bba 100644 --- a/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt +++ b/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/functionSignatureAssignmentCompat1.ts(10,5): error TS2322: Type '(delimiter?: string) => ParserFunc' is not assignable to type 'ParserFunc': + Types of parameters 'delimiter' and 'eventEmitter' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/functionSignatureAssignmentCompat1.ts (1 errors) ==== interface ParserFunc { (eventEmitter: number, buffer: string): void; @@ -10,7 +15,7 @@ var c: ParserFunc = parsers.raw; // ok! var d: ParserFunc = parsers.readline; // not ok ~ -!!! Type '(delimiter?: string) => ParserFunc' is not assignable to type 'ParserFunc': -!!! Types of parameters 'delimiter' and 'eventEmitter' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(delimiter?: string) => ParserFunc' is not assignable to type 'ParserFunc': +!!! error TS2322: Types of parameters 'delimiter' and 'eventEmitter' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var e: ParserFunc = parsers.readline(); // ok \ No newline at end of file diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.types b/tests/baselines/reference/functionSubtypingOfVarArgs2.types index 2fef933594d..2f81898c7de 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.types +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.types @@ -5,7 +5,7 @@ class EventBase { private _listeners: { (...args: any[]): void; }[] = []; >_listeners : { (...args: any[]): void; }[] >args : any[] ->[] : { (...args: any[]): void; }[] +>[] : undefined[] add(listener: (...args: any[]) => void): void { >add : (listener: (...args: any[]) => void) => void diff --git a/tests/baselines/reference/functionTypeArgumentArrayAssignment.errors.txt b/tests/baselines/reference/functionTypeArgumentArrayAssignment.errors.txt index d6c22626604..9897286a624 100644 --- a/tests/baselines/reference/functionTypeArgumentArrayAssignment.errors.txt +++ b/tests/baselines/reference/functionTypeArgumentArrayAssignment.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/functionTypeArgumentArrayAssignment.ts(3,2): error TS2300: Duplicate identifier 'length'. + + ==== tests/cases/compiler/functionTypeArgumentArrayAssignment.ts (1 errors) ==== interface Array { foo: T; length: number; ~~~~~~ -!!! Duplicate identifier 'length'. +!!! error TS2300: Duplicate identifier 'length'. } function map() { diff --git a/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt b/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt index a7c07b9de77..366e1732b29 100644 --- a/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt +++ b/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts(12,1): error TS2304: Cannot find name 'console'. + + ==== tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts (1 errors) ==== var f : { (x:T): T; @@ -12,5 +15,5 @@ console.log(s); ~~~~~~~ -!!! Cannot find name 'console'. +!!! error TS2304: Cannot find name 'console'. \ No newline at end of file diff --git a/tests/baselines/reference/functionTypesLackingReturnTypes.errors.txt b/tests/baselines/reference/functionTypesLackingReturnTypes.errors.txt new file mode 100644 index 00000000000..a0be6f32df0 --- /dev/null +++ b/tests/baselines/reference/functionTypesLackingReturnTypes.errors.txt @@ -0,0 +1,22 @@ +tests/cases/compiler/functionTypesLackingReturnTypes.ts(3,17): error TS1005: '=>' expected. +tests/cases/compiler/functionTypesLackingReturnTypes.ts(7,15): error TS1005: '=>' expected. + + +==== tests/cases/compiler/functionTypesLackingReturnTypes.ts (2 errors) ==== + + // Error (no '=>') + function f(x: ()) { + ~ +!!! error TS1005: '=>' expected. + } + + // Error (no '=>') + var g: (param); + ~ +!!! error TS1005: '=>' expected. + + // Okay + var h: { () } + + // Okay + var i: { new () } \ No newline at end of file diff --git a/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt b/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt index d599e2da445..d9a25e24566 100644 --- a/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt +++ b/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt @@ -1,3 +1,14 @@ +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(4,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(12,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(22,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(31,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(43,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(48,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(56,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(56,13): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(56,26): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts (9 errors) ==== // return type of a function with multiple returns is the BCT of each return statement // it is an error if there is no single BCT, these are error cases @@ -16,7 +27,7 @@ ~~~~~ } ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. function f2() { ~~~~~~~~~~~~~~~ @@ -36,7 +47,7 @@ ~~~~~ } ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. function f3() { ~~~~~~~~~~~~~~~ @@ -54,7 +65,7 @@ ~~~~~ } ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. function f4() { ~~~~~~~~~~~~~~~ @@ -78,7 +89,7 @@ ~~~~~ } ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. function f5() { ~~~~~~~~~~~~~~~ @@ -88,7 +99,7 @@ ~~~~~~~~~~~~~~ } ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. function f6(x: T, y:U) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -104,14 +115,14 @@ ~~~~~ } ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. function f8(x: T, y: U) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. if (true) { ~~~~~~~~~~~~~~~ return x; @@ -124,5 +135,5 @@ ~~~~~ } ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. \ No newline at end of file diff --git a/tests/baselines/reference/functionWithSameNameAsField.errors.txt b/tests/baselines/reference/functionWithSameNameAsField.errors.txt index ce69b7feb56..168b9191df4 100644 --- a/tests/baselines/reference/functionWithSameNameAsField.errors.txt +++ b/tests/baselines/reference/functionWithSameNameAsField.errors.txt @@ -1,9 +1,15 @@ -==== tests/cases/compiler/functionWithSameNameAsField.ts (1 errors) ==== +tests/cases/compiler/functionWithSameNameAsField.ts(2,12): error TS2300: Duplicate identifier 'total'. +tests/cases/compiler/functionWithSameNameAsField.ts(3,12): error TS2300: Duplicate identifier 'total'. + + +==== tests/cases/compiler/functionWithSameNameAsField.ts (2 errors) ==== class TestProgressBar { public total: number; + ~~~~~ +!!! error TS2300: Duplicate identifier 'total'. public total(total: number) { ~~~~~ -!!! Duplicate identifier 'total'. +!!! error TS2300: Duplicate identifier 'total'. this.total = total; return this; } diff --git a/tests/baselines/reference/functionWithThrowButNoReturn1.errors.txt b/tests/baselines/reference/functionWithThrowButNoReturn1.errors.txt index b354a9f8852..72f45da8d97 100644 --- a/tests/baselines/reference/functionWithThrowButNoReturn1.errors.txt +++ b/tests/baselines/reference/functionWithThrowButNoReturn1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/functionWithThrowButNoReturn1.ts(1,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. + + ==== tests/cases/compiler/functionWithThrowButNoReturn1.ts (1 errors) ==== function fn(): number { ~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. throw new Error('NYI'); var t; } diff --git a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt index 6ddbc91db57..11ceb2aa3dd 100644 --- a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt +++ b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt @@ -1,8 +1,15 @@ +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(117,5): error TS1003: Identifier expected. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(2,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(64,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(94,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(112,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + + ==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (5 errors) ==== function f1(): string { ~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. // errors because there are no return statements } @@ -66,7 +73,7 @@ function f14(): number { ~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. // Not fine, since we can *only* consist of a single throw statement // if no return statements are present but we are annotated. throw undefined; @@ -98,7 +105,7 @@ class C { public get m1() { ~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. // Errors; get accessors must return a value. } @@ -118,12 +125,12 @@ public get m5() { ~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. // Not fine, since we can *only* consist of a single throw statement // if no return statements are present but we are a get accessor. throw null; throw undefined. } ~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. } \ No newline at end of file diff --git a/tests/baselines/reference/funduleSplitAcrossFiles.errors.txt b/tests/baselines/reference/funduleSplitAcrossFiles.errors.txt index 2d70aed4a3e..1fc68fff709 100644 --- a/tests/baselines/reference/funduleSplitAcrossFiles.errors.txt +++ b/tests/baselines/reference/funduleSplitAcrossFiles.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/funduleSplitAcrossFiles_module.ts(1,8): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged + + ==== tests/cases/compiler/funduleSplitAcrossFiles_function.ts (0 errors) ==== function D() { } ==== tests/cases/compiler/funduleSplitAcrossFiles_module.ts (1 errors) ==== module D { ~ -!!! A module declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged export var y = "hi"; } D.y; \ No newline at end of file diff --git a/tests/baselines/reference/fuzzy.errors.txt b/tests/baselines/reference/fuzzy.errors.txt index 36124da5cea..321a03f5470 100644 --- a/tests/baselines/reference/fuzzy.errors.txt +++ b/tests/baselines/reference/fuzzy.errors.txt @@ -1,3 +1,12 @@ +tests/cases/compiler/fuzzy.ts(13,18): error TS2421: Class 'C' incorrectly implements interface 'I': + Property 'alsoWorks' is missing in type 'C'. +tests/cases/compiler/fuzzy.ts(21,20): error TS2322: Type '{ anything: number; oneI: C; }' is not assignable to type 'R': + Types of property 'oneI' are incompatible: + Type 'C' is not assignable to type 'I'. +tests/cases/compiler/fuzzy.ts(25,20): error TS2353: Neither type '{ oneI: C; }' nor type 'R' is assignable to the other: + Property 'anything' is missing in type '{ oneI: C; }'. + + ==== tests/cases/compiler/fuzzy.ts (3 errors) ==== module M { export interface I { @@ -13,8 +22,8 @@ export class C implements I { ~ -!!! Class 'C' incorrectly implements interface 'I': -!!! Property 'alsoWorks' is missing in type 'C'. +!!! error TS2421: Class 'C' incorrectly implements interface 'I': +!!! error TS2421: Property 'alsoWorks' is missing in type 'C'. constructor(public x:number) { } works():R { @@ -24,16 +33,16 @@ doesntWork():R { return { anything:1, oneI:this }; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Type '{ anything: number; oneI: C; }' is not assignable to type 'R': -!!! Types of property 'oneI' are incompatible: -!!! Type 'C' is not assignable to type 'I'. +!!! error TS2322: Type '{ anything: number; oneI: C; }' is not assignable to type 'R': +!!! error TS2322: Types of property 'oneI' are incompatible: +!!! error TS2322: Type 'C' is not assignable to type 'I'. } worksToo():R { return ({ oneI: this }); ~~~~~~~~~~~~~~~~~~~ -!!! Neither type '{ oneI: C; }' nor type 'R' is assignable to the other: -!!! Property 'anything' is missing in type '{ oneI: C; }'. +!!! error TS2353: Neither type '{ oneI: C; }' nor type 'R' is assignable to the other: +!!! error TS2353: Property 'anything' is missing in type '{ oneI: C; }'. } } } diff --git a/tests/baselines/reference/generatedContextualTyping.types b/tests/baselines/reference/generatedContextualTyping.types index 57b5408eabe..78fc6f6cfef 100644 --- a/tests/baselines/reference/generatedContextualTyping.types +++ b/tests/baselines/reference/generatedContextualTyping.types @@ -34,57 +34,57 @@ var b = new Base(), d1 = new Derived1(), d2 = new Derived2(); var x1: () => Base[] = () => [d1, d2]; >x1 : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x2: () => Base[] = function() { return [d1, d2] }; >x2 : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x3: () => Base[] = function named() { return [d1, d2] }; >x3 : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x4: { (): Base[]; } = () => [d1, d2]; >x4 : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x5: { (): Base[]; } = function() { return [d1, d2] }; >x5 : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x6: { (): Base[]; } = function named() { return [d1, d2] }; >x6 : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x7: Base[] = [d1, d2]; >x7 : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -92,7 +92,7 @@ var x8: Array = [d1, d2]; >x8 : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -100,7 +100,7 @@ var x9: { [n: number]: Base; } = [d1, d2]; >x9 : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -108,9 +108,9 @@ var x10: {n: Base[]; } = { n: [d1, d2] }; >x10 : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -127,11 +127,11 @@ var x12: Genric = { func: n => { return [d1, d2]; } }; >x12 : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -139,8 +139,8 @@ class x13 { member: () => Base[] = () => [d1, d2] } >x13 : x13 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -148,8 +148,8 @@ class x14 { member: () => Base[] = function() { return [d1, d2] } } >x14 : x14 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -157,9 +157,9 @@ class x15 { member: () => Base[] = function named() { return [d1, d2] } } >x15 : x15 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -167,8 +167,8 @@ class x16 { member: { (): Base[]; } = () => [d1, d2] } >x16 : x16 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -176,8 +176,8 @@ class x17 { member: { (): Base[]; } = function() { return [d1, d2] } } >x17 : x17 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -185,9 +185,9 @@ class x18 { member: { (): Base[]; } = function named() { return [d1, d2] } } >x18 : x18 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -195,7 +195,7 @@ class x19 { member: Base[] = [d1, d2] } >x19 : x19 >member : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -204,7 +204,7 @@ class x20 { member: Array = [d1, d2] } >member : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -213,7 +213,7 @@ class x21 { member: { [n: number]: Base; } = [d1, d2] } >member : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -222,9 +222,9 @@ class x22 { member: {n: Base[]; } = { n: [d1, d2] } } >member : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -243,11 +243,11 @@ class x24 { member: Genric = { func: n => { return [d1, d2]; } } } >member : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -255,8 +255,8 @@ class x25 { private member: () => Base[] = () => [d1, d2] } >x25 : x25 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -264,8 +264,8 @@ class x26 { private member: () => Base[] = function() { return [d1, d2] } } >x26 : x26 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -273,9 +273,9 @@ class x27 { private member: () => Base[] = function named() { return [d1, d2] } >x27 : x27 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -283,8 +283,8 @@ class x28 { private member: { (): Base[]; } = () => [d1, d2] } >x28 : x28 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -292,8 +292,8 @@ class x29 { private member: { (): Base[]; } = function() { return [d1, d2] } } >x29 : x29 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -301,9 +301,9 @@ class x30 { private member: { (): Base[]; } = function named() { return [d1, d2] >x30 : x30 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -311,7 +311,7 @@ class x31 { private member: Base[] = [d1, d2] } >x31 : x31 >member : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -320,7 +320,7 @@ class x32 { private member: Array = [d1, d2] } >member : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -329,7 +329,7 @@ class x33 { private member: { [n: number]: Base; } = [d1, d2] } >member : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -338,9 +338,9 @@ class x34 { private member: {n: Base[]; } = { n: [d1, d2] } } >member : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -359,11 +359,11 @@ class x36 { private member: Genric = { func: n => { return [d1, d2]; } } } >member : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -371,8 +371,8 @@ class x37 { public member: () => Base[] = () => [d1, d2] } >x37 : x37 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -380,8 +380,8 @@ class x38 { public member: () => Base[] = function() { return [d1, d2] } } >x38 : x38 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -389,9 +389,9 @@ class x39 { public member: () => Base[] = function named() { return [d1, d2] } } >x39 : x39 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -399,8 +399,8 @@ class x40 { public member: { (): Base[]; } = () => [d1, d2] } >x40 : x40 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -408,8 +408,8 @@ class x41 { public member: { (): Base[]; } = function() { return [d1, d2] } } >x41 : x41 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -417,9 +417,9 @@ class x42 { public member: { (): Base[]; } = function named() { return [d1, d2] >x42 : x42 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -427,7 +427,7 @@ class x43 { public member: Base[] = [d1, d2] } >x43 : x43 >member : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -436,7 +436,7 @@ class x44 { public member: Array = [d1, d2] } >member : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -445,7 +445,7 @@ class x45 { public member: { [n: number]: Base; } = [d1, d2] } >member : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -454,9 +454,9 @@ class x46 { public member: {n: Base[]; } = { n: [d1, d2] } } >member : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -475,11 +475,11 @@ class x48 { public member: Genric = { func: n => { return [d1, d2]; } } } >member : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -487,8 +487,8 @@ class x49 { static member: () => Base[] = () => [d1, d2] } >x49 : x49 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -496,8 +496,8 @@ class x50 { static member: () => Base[] = function() { return [d1, d2] } } >x50 : x50 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -505,9 +505,9 @@ class x51 { static member: () => Base[] = function named() { return [d1, d2] } } >x51 : x51 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -515,8 +515,8 @@ class x52 { static member: { (): Base[]; } = () => [d1, d2] } >x52 : x52 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -524,8 +524,8 @@ class x53 { static member: { (): Base[]; } = function() { return [d1, d2] } } >x53 : x53 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -533,9 +533,9 @@ class x54 { static member: { (): Base[]; } = function named() { return [d1, d2] >x54 : x54 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -543,7 +543,7 @@ class x55 { static member: Base[] = [d1, d2] } >x55 : x55 >member : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -552,7 +552,7 @@ class x56 { static member: Array = [d1, d2] } >member : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -561,7 +561,7 @@ class x57 { static member: { [n: number]: Base; } = [d1, d2] } >member : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -570,9 +570,9 @@ class x58 { static member: {n: Base[]; } = { n: [d1, d2] } } >member : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -591,11 +591,11 @@ class x60 { static member: Genric = { func: n => { return [d1, d2]; } } } >member : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -603,8 +603,8 @@ class x61 { private static member: () => Base[] = () => [d1, d2] } >x61 : x61 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -612,8 +612,8 @@ class x62 { private static member: () => Base[] = function() { return [d1, d2] } >x62 : x62 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -621,9 +621,9 @@ class x63 { private static member: () => Base[] = function named() { return [d1, >x63 : x63 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -631,8 +631,8 @@ class x64 { private static member: { (): Base[]; } = () => [d1, d2] } >x64 : x64 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -640,8 +640,8 @@ class x65 { private static member: { (): Base[]; } = function() { return [d1, d2 >x65 : x65 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -649,9 +649,9 @@ class x66 { private static member: { (): Base[]; } = function named() { return [ >x66 : x66 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -659,7 +659,7 @@ class x67 { private static member: Base[] = [d1, d2] } >x67 : x67 >member : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -668,7 +668,7 @@ class x68 { private static member: Array = [d1, d2] } >member : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -677,7 +677,7 @@ class x69 { private static member: { [n: number]: Base; } = [d1, d2] } >member : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -686,9 +686,9 @@ class x70 { private static member: {n: Base[]; } = { n: [d1, d2] } } >member : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -707,11 +707,11 @@ class x72 { private static member: Genric = { func: n => { return [d1, d2] >member : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -719,8 +719,8 @@ class x73 { public static member: () => Base[] = () => [d1, d2] } >x73 : x73 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -728,8 +728,8 @@ class x74 { public static member: () => Base[] = function() { return [d1, d2] } >x74 : x74 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -737,9 +737,9 @@ class x75 { public static member: () => Base[] = function named() { return [d1, >x75 : x75 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -747,8 +747,8 @@ class x76 { public static member: { (): Base[]; } = () => [d1, d2] } >x76 : x76 >member : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -756,8 +756,8 @@ class x77 { public static member: { (): Base[]; } = function() { return [d1, d2] >x77 : x77 >member : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -765,9 +765,9 @@ class x78 { public static member: { (): Base[]; } = function named() { return [d >x78 : x78 >member : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -775,7 +775,7 @@ class x79 { public static member: Base[] = [d1, d2] } >x79 : x79 >member : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -784,7 +784,7 @@ class x80 { public static member: Array = [d1, d2] } >member : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -793,7 +793,7 @@ class x81 { public static member: { [n: number]: Base; } = [d1, d2] } >member : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -802,9 +802,9 @@ class x82 { public static member: {n: Base[]; } = { n: [d1, d2] } } >member : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -823,11 +823,11 @@ class x84 { public static member: Genric = { func: n => { return [d1, d2]; >member : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -835,8 +835,8 @@ class x85 { constructor(parm: () => Base[] = () => [d1, d2]) { } } >x85 : x85 >parm : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -844,8 +844,8 @@ class x86 { constructor(parm: () => Base[] = function() { return [d1, d2] }) { } >x86 : x86 >parm : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -853,9 +853,9 @@ class x87 { constructor(parm: () => Base[] = function named() { return [d1, d2] >x87 : x87 >parm : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -863,8 +863,8 @@ class x88 { constructor(parm: { (): Base[]; } = () => [d1, d2]) { } } >x88 : x88 >parm : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -872,8 +872,8 @@ class x89 { constructor(parm: { (): Base[]; } = function() { return [d1, d2] }) >x89 : x89 >parm : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -881,9 +881,9 @@ class x90 { constructor(parm: { (): Base[]; } = function named() { return [d1, d >x90 : x90 >parm : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -891,7 +891,7 @@ class x91 { constructor(parm: Base[] = [d1, d2]) { } } >x91 : x91 >parm : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -900,7 +900,7 @@ class x92 { constructor(parm: Array = [d1, d2]) { } } >parm : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -909,7 +909,7 @@ class x93 { constructor(parm: { [n: number]: Base; } = [d1, d2]) { } } >parm : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -918,9 +918,9 @@ class x94 { constructor(parm: {n: Base[]; } = { n: [d1, d2] }) { } } >parm : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -939,11 +939,11 @@ class x96 { constructor(parm: Genric = { func: n => { return [d1, d2]; } } >parm : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -951,8 +951,8 @@ class x97 { constructor(public parm: () => Base[] = () => [d1, d2]) { } } >x97 : x97 >parm : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -960,8 +960,8 @@ class x98 { constructor(public parm: () => Base[] = function() { return [d1, d2] >x98 : x98 >parm : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -969,9 +969,9 @@ class x99 { constructor(public parm: () => Base[] = function named() { return [d >x99 : x99 >parm : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -979,8 +979,8 @@ class x100 { constructor(public parm: { (): Base[]; } = () => [d1, d2]) { } } >x100 : x100 >parm : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -988,8 +988,8 @@ class x101 { constructor(public parm: { (): Base[]; } = function() { return [d1, >x101 : x101 >parm : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -997,9 +997,9 @@ class x102 { constructor(public parm: { (): Base[]; } = function named() { retur >x102 : x102 >parm : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1007,7 +1007,7 @@ class x103 { constructor(public parm: Base[] = [d1, d2]) { } } >x103 : x103 >parm : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1016,7 +1016,7 @@ class x104 { constructor(public parm: Array = [d1, d2]) { } } >parm : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1025,7 +1025,7 @@ class x105 { constructor(public parm: { [n: number]: Base; } = [d1, d2]) { } } >parm : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1034,9 +1034,9 @@ class x106 { constructor(public parm: {n: Base[]; } = { n: [d1, d2] }) { } } >parm : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1055,11 +1055,11 @@ class x108 { constructor(public parm: Genric = { func: n => { return [d1, >parm : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1067,8 +1067,8 @@ class x109 { constructor(private parm: () => Base[] = () => [d1, d2]) { } } >x109 : x109 >parm : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1076,8 +1076,8 @@ class x110 { constructor(private parm: () => Base[] = function() { return [d1, d >x110 : x110 >parm : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1085,9 +1085,9 @@ class x111 { constructor(private parm: () => Base[] = function named() { return >x111 : x111 >parm : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1095,8 +1095,8 @@ class x112 { constructor(private parm: { (): Base[]; } = () => [d1, d2]) { } } >x112 : x112 >parm : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1104,8 +1104,8 @@ class x113 { constructor(private parm: { (): Base[]; } = function() { return [d1 >x113 : x113 >parm : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1113,9 +1113,9 @@ class x114 { constructor(private parm: { (): Base[]; } = function named() { retu >x114 : x114 >parm : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1123,7 +1123,7 @@ class x115 { constructor(private parm: Base[] = [d1, d2]) { } } >x115 : x115 >parm : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1132,7 +1132,7 @@ class x116 { constructor(private parm: Array = [d1, d2]) { } } >parm : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1141,7 +1141,7 @@ class x117 { constructor(private parm: { [n: number]: Base; } = [d1, d2]) { } } >parm : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1150,9 +1150,9 @@ class x118 { constructor(private parm: {n: Base[]; } = { n: [d1, d2] }) { } } >parm : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1171,11 +1171,11 @@ class x120 { constructor(private parm: Genric = { func: n => { return [d1, >parm : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1183,8 +1183,8 @@ function x121(parm: () => Base[] = () => [d1, d2]) { } >x121 : (parm?: () => Base[]) => void >parm : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1192,8 +1192,8 @@ function x122(parm: () => Base[] = function() { return [d1, d2] }) { } >x122 : (parm?: () => Base[]) => void >parm : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1201,9 +1201,9 @@ function x123(parm: () => Base[] = function named() { return [d1, d2] }) { } >x123 : (parm?: () => Base[]) => void >parm : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1211,8 +1211,8 @@ function x124(parm: { (): Base[]; } = () => [d1, d2]) { } >x124 : (parm?: () => Base[]) => void >parm : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1220,8 +1220,8 @@ function x125(parm: { (): Base[]; } = function() { return [d1, d2] }) { } >x125 : (parm?: () => Base[]) => void >parm : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1229,9 +1229,9 @@ function x126(parm: { (): Base[]; } = function named() { return [d1, d2] }) { } >x126 : (parm?: () => Base[]) => void >parm : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1239,7 +1239,7 @@ function x127(parm: Base[] = [d1, d2]) { } >x127 : (parm?: Base[]) => void >parm : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1248,7 +1248,7 @@ function x128(parm: Array = [d1, d2]) { } >parm : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1257,7 +1257,7 @@ function x129(parm: { [n: number]: Base; } = [d1, d2]) { } >parm : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1266,9 +1266,9 @@ function x130(parm: {n: Base[]; } = { n: [d1, d2] }) { } >parm : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1287,68 +1287,68 @@ function x132(parm: Genric = { func: n => { return [d1, d2]; } }) { } >parm : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x133(): () => Base[] { return () => [d1, d2]; } >x133 : () => () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x134(): () => Base[] { return function() { return [d1, d2] }; } >x134 : () => () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x135(): () => Base[] { return function named() { return [d1, d2] }; } >x135 : () => () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x136(): { (): Base[]; } { return () => [d1, d2]; } >x136 : () => () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x137(): { (): Base[]; } { return function() { return [d1, d2] }; } >x137 : () => () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x138(): { (): Base[]; } { return function named() { return [d1, d2] }; } >x138 : () => () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x139(): Base[] { return [d1, d2]; } >x139 : () => Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1356,7 +1356,7 @@ function x140(): Array { return [d1, d2]; } >x140 : () => Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1364,7 +1364,7 @@ function x141(): { [n: number]: Base; } { return [d1, d2]; } >x141 : () => { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1372,9 +1372,9 @@ function x142(): {n: Base[]; } { return { n: [d1, d2] }; } >x142 : () => { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1391,97 +1391,97 @@ function x144(): Genric { return { func: n => { return [d1, d2]; } }; } >x144 : () => Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x145(): () => Base[] { return () => [d1, d2]; return () => [d1, d2]; } >x145 : () => () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x146(): () => Base[] { return function() { return [d1, d2] }; return function() { return [d1, d2] }; } >x146 : () => () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x147(): () => Base[] { return function named() { return [d1, d2] }; return function named() { return [d1, d2] }; } >x147 : () => () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x148(): { (): Base[]; } { return () => [d1, d2]; return () => [d1, d2]; } >x148 : () => () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x149(): { (): Base[]; } { return function() { return [d1, d2] }; return function() { return [d1, d2] }; } >x149 : () => () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x150(): { (): Base[]; } { return function named() { return [d1, d2] }; return function named() { return [d1, d2] }; } >x150 : () => () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 function x151(): Base[] { return [d1, d2]; return [d1, d2]; } >x151 : () => Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1489,10 +1489,10 @@ function x152(): Array { return [d1, d2]; return [d1, d2]; } >x152 : () => Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1500,10 +1500,10 @@ function x153(): { [n: number]: Base; } { return [d1, d2]; return [d1, d2]; } >x153 : () => { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1511,14 +1511,14 @@ function x154(): {n: Base[]; } { return { n: [d1, d2] }; return { n: [d1, d2] } >x154 : () => { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1539,82 +1539,82 @@ function x156(): Genric { return { func: n => { return [d1, d2]; } }; retu >x156 : () => Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x157: () => () => Base[] = () => { return () => [d1, d2]; }; >x157 : () => () => Base[] >Base : Base ->() => { return () => [d1, d2]; } : () => () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => { return () => [d1, d2]; } : () => () => Array +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x158: () => () => Base[] = () => { return function() { return [d1, d2] }; }; >x158 : () => () => Base[] >Base : Base ->() => { return function() { return [d1, d2] }; } : () => () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>() => { return function() { return [d1, d2] }; } : () => () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x159: () => () => Base[] = () => { return function named() { return [d1, d2] }; }; >x159 : () => () => Base[] >Base : Base ->() => { return function named() { return [d1, d2] }; } : () => () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>() => { return function named() { return [d1, d2] }; } : () => () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x160: () => { (): Base[]; } = () => { return () => [d1, d2]; }; >x160 : () => () => Base[] >Base : Base ->() => { return () => [d1, d2]; } : () => () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => { return () => [d1, d2]; } : () => () => Array +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x161: () => { (): Base[]; } = () => { return function() { return [d1, d2] }; }; >x161 : () => () => Base[] >Base : Base ->() => { return function() { return [d1, d2] }; } : () => () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>() => { return function() { return [d1, d2] }; } : () => () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x162: () => { (): Base[]; } = () => { return function named() { return [d1, d2] }; }; >x162 : () => () => Base[] >Base : Base ->() => { return function named() { return [d1, d2] }; } : () => () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>() => { return function named() { return [d1, d2] }; } : () => () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x163: () => Base[] = () => { return [d1, d2]; }; >x163 : () => Base[] >Base : Base ->() => { return [d1, d2]; } : () => Base[] ->[d1, d2] : Base[] +>() => { return [d1, d2]; } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1622,8 +1622,8 @@ var x164: () => Array = () => { return [d1, d2]; }; >x164 : () => Base[] >Array : T[] >Base : Base ->() => { return [d1, d2]; } : () => Base[] ->[d1, d2] : Base[] +>() => { return [d1, d2]; } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1631,8 +1631,8 @@ var x165: () => { [n: number]: Base; } = () => { return [d1, d2]; }; >x165 : () => { [x: number]: Base; } >n : number >Base : Base ->() => { return [d1, d2]; } : () => Base[] ->[d1, d2] : Base[] +>() => { return [d1, d2]; } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1640,10 +1640,10 @@ var x166: () => {n: Base[]; } = () => { return { n: [d1, d2] }; }; >x166 : () => { n: Base[]; } >n : Base[] >Base : Base ->() => { return { n: [d1, d2] }; } : () => { n: Base[]; } ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>() => { return { n: [d1, d2] }; } : () => { n: Array; } +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1661,76 +1661,76 @@ var x168: () => Genric = () => { return { func: n => { return [d1, d2]; } >x168 : () => Genric >Genric : Genric >Base : Base ->() => { return { func: n => { return [d1, d2]; } }; } : () => { func: (n: Base[]) => {}[]; } ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>() => { return { func: n => { return [d1, d2]; } }; } : () => { func: (n: Base[]) => Array; } +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x169: () => () => Base[] = function() { return () => [d1, d2]; }; >x169 : () => () => Base[] >Base : Base ->function() { return () => [d1, d2]; } : () => () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>function() { return () => [d1, d2]; } : () => () => Array +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x170: () => () => Base[] = function() { return function() { return [d1, d2] }; }; >x170 : () => () => Base[] >Base : Base ->function() { return function() { return [d1, d2] }; } : () => () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return function() { return [d1, d2] }; } : () => () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x171: () => () => Base[] = function() { return function named() { return [d1, d2] }; }; >x171 : () => () => Base[] >Base : Base ->function() { return function named() { return [d1, d2] }; } : () => () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function() { return function named() { return [d1, d2] }; } : () => () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x172: () => { (): Base[]; } = function() { return () => [d1, d2]; }; >x172 : () => () => Base[] >Base : Base ->function() { return () => [d1, d2]; } : () => () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>function() { return () => [d1, d2]; } : () => () => Array +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x173: () => { (): Base[]; } = function() { return function() { return [d1, d2] }; }; >x173 : () => () => Base[] >Base : Base ->function() { return function() { return [d1, d2] }; } : () => () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return function() { return [d1, d2] }; } : () => () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x174: () => { (): Base[]; } = function() { return function named() { return [d1, d2] }; }; >x174 : () => () => Base[] >Base : Base ->function() { return function named() { return [d1, d2] }; } : () => () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function() { return function named() { return [d1, d2] }; } : () => () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x175: () => Base[] = function() { return [d1, d2]; }; >x175 : () => Base[] >Base : Base ->function() { return [d1, d2]; } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2]; } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1738,8 +1738,8 @@ var x176: () => Array = function() { return [d1, d2]; }; >x176 : () => Base[] >Array : T[] >Base : Base ->function() { return [d1, d2]; } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2]; } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1747,8 +1747,8 @@ var x177: () => { [n: number]: Base; } = function() { return [d1, d2]; }; >x177 : () => { [x: number]: Base; } >n : number >Base : Base ->function() { return [d1, d2]; } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2]; } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1756,10 +1756,10 @@ var x178: () => {n: Base[]; } = function() { return { n: [d1, d2] }; }; >x178 : () => { n: Base[]; } >n : Base[] >Base : Base ->function() { return { n: [d1, d2] }; } : () => { n: Base[]; } ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>function() { return { n: [d1, d2] }; } : () => { n: Array; } +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1777,12 +1777,12 @@ var x180: () => Genric = function() { return { func: n => { return [d1, d2 >x180 : () => Genric >Genric : Genric >Base : Base ->function() { return { func: n => { return [d1, d2]; } }; } : () => { func: (n: Base[]) => {}[]; } ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>function() { return { func: n => { return [d1, d2]; } }; } : () => { func: (n: Base[]) => Array; } +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1790,8 +1790,8 @@ module x181 { var t: () => Base[] = () => [d1, d2]; } >x181 : typeof x181 >t : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1799,8 +1799,8 @@ module x182 { var t: () => Base[] = function() { return [d1, d2] }; } >x182 : typeof x182 >t : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1808,9 +1808,9 @@ module x183 { var t: () => Base[] = function named() { return [d1, d2] }; } >x183 : typeof x183 >t : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1818,8 +1818,8 @@ module x184 { var t: { (): Base[]; } = () => [d1, d2]; } >x184 : typeof x184 >t : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1827,8 +1827,8 @@ module x185 { var t: { (): Base[]; } = function() { return [d1, d2] }; } >x185 : typeof x185 >t : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1836,9 +1836,9 @@ module x186 { var t: { (): Base[]; } = function named() { return [d1, d2] }; } >x186 : typeof x186 >t : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1846,7 +1846,7 @@ module x187 { var t: Base[] = [d1, d2]; } >x187 : typeof x187 >t : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1855,7 +1855,7 @@ module x188 { var t: Array = [d1, d2]; } >t : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1864,7 +1864,7 @@ module x189 { var t: { [n: number]: Base; } = [d1, d2]; } >t : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1873,9 +1873,9 @@ module x190 { var t: {n: Base[]; } = { n: [d1, d2] }; } >t : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1894,11 +1894,11 @@ module x192 { var t: Genric = { func: n => { return [d1, d2]; } }; } >t : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1906,8 +1906,8 @@ module x193 { export var t: () => Base[] = () => [d1, d2]; } >x193 : typeof x193 >t : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1915,8 +1915,8 @@ module x194 { export var t: () => Base[] = function() { return [d1, d2] }; } >x194 : typeof x194 >t : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1924,9 +1924,9 @@ module x195 { export var t: () => Base[] = function named() { return [d1, d2] }; >x195 : typeof x195 >t : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1934,8 +1934,8 @@ module x196 { export var t: { (): Base[]; } = () => [d1, d2]; } >x196 : typeof x196 >t : () => Base[] >Base : Base ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1943,8 +1943,8 @@ module x197 { export var t: { (): Base[]; } = function() { return [d1, d2] }; } >x197 : typeof x197 >t : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1952,9 +1952,9 @@ module x198 { export var t: { (): Base[]; } = function named() { return [d1, d2] >x198 : typeof x198 >t : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1962,7 +1962,7 @@ module x199 { export var t: Base[] = [d1, d2]; } >x199 : typeof x199 >t : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1971,7 +1971,7 @@ module x200 { export var t: Array = [d1, d2]; } >t : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1980,7 +1980,7 @@ module x201 { export var t: { [n: number]: Base; } = [d1, d2]; } >t : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -1989,9 +1989,9 @@ module x202 { export var t: {n: Base[]; } = { n: [d1, d2] }; } >t : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2010,11 +2010,11 @@ module x204 { export var t: Genric = { func: n => { return [d1, d2]; } }; >t : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2022,8 +2022,8 @@ var x206 = <() => Base[]>function() { return [d1, d2] }; >x206 : () => Base[] ><() => Base[]>function() { return [d1, d2] } : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2031,9 +2031,9 @@ var x207 = <() => Base[]>function named() { return [d1, d2] }; >x207 : () => Base[] ><() => Base[]>function named() { return [d1, d2] } : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2041,8 +2041,8 @@ var x209 = <{ (): Base[]; }>function() { return [d1, d2] }; >x209 : () => Base[] ><{ (): Base[]; }>function() { return [d1, d2] } : () => Base[] >Base : Base ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2050,9 +2050,9 @@ var x210 = <{ (): Base[]; }>function named() { return [d1, d2] }; >x210 : () => Base[] ><{ (): Base[]; }>function named() { return [d1, d2] } : () => Base[] >Base : Base ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2060,7 +2060,7 @@ var x211 = [d1, d2]; >x211 : Base[] >[d1, d2] : Base[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2069,7 +2069,7 @@ var x212 = >[d1, d2]; >>[d1, d2] : Base[] >Array : T[] >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2078,7 +2078,7 @@ var x213 = <{ [n: number]: Base; }>[d1, d2]; ><{ [n: number]: Base; }>[d1, d2] : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2087,9 +2087,9 @@ var x214 = <{n: Base[]; } >{ n: [d1, d2] }; ><{n: Base[]; } >{ n: [d1, d2] } : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2098,11 +2098,11 @@ var x216 = >{ func: n => { return [d1, d2]; } }; >>{ func: n => { return [d1, d2]; } } : Genric >Genric : Genric >Base : Base ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2113,8 +2113,8 @@ var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] }; ><() => Base[]>undefined : () => Base[] >Base : Base >undefined : undefined ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2125,9 +2125,9 @@ var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] }; ><() => Base[]>undefined : () => Base[] >Base : Base >undefined : undefined ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2138,8 +2138,8 @@ var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] }; ><{ (): Base[]; }>undefined : () => Base[] >Base : Base >undefined : undefined ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2150,9 +2150,9 @@ var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] }; ><{ (): Base[]; }>undefined : () => Base[] >Base : Base >undefined : undefined ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2163,7 +2163,7 @@ var x221 = (undefined) || [d1, d2]; >undefined : Base[] >Base : Base >undefined : undefined ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2175,7 +2175,7 @@ var x222 = (>undefined) || [d1, d2]; >Array : T[] >Base : Base >undefined : undefined ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2187,7 +2187,7 @@ var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; >n : number >Base : Base >undefined : undefined ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2199,80 +2199,80 @@ var x224 = (<{n: Base[]; } >undefined) || { n: [d1, d2] }; >n : Base[] >Base : Base >undefined : undefined ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x225: () => Base[]; x225 = () => [d1, d2]; >x225 : () => Base[] >Base : Base ->x225 = () => [d1, d2] : () => Base[] +>x225 = () => [d1, d2] : () => Array >x225 : () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x226: () => Base[]; x226 = function() { return [d1, d2] }; >x226 : () => Base[] >Base : Base ->x226 = function() { return [d1, d2] } : () => Base[] +>x226 = function() { return [d1, d2] } : () => Array >x226 : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x227: () => Base[]; x227 = function named() { return [d1, d2] }; >x227 : () => Base[] >Base : Base ->x227 = function named() { return [d1, d2] } : () => Base[] +>x227 = function named() { return [d1, d2] } : () => Array >x227 : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x228: { (): Base[]; }; x228 = () => [d1, d2]; >x228 : () => Base[] >Base : Base ->x228 = () => [d1, d2] : () => Base[] +>x228 = () => [d1, d2] : () => Array >x228 : () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x229: { (): Base[]; }; x229 = function() { return [d1, d2] }; >x229 : () => Base[] >Base : Base ->x229 = function() { return [d1, d2] } : () => Base[] +>x229 = function() { return [d1, d2] } : () => Array >x229 : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x230: { (): Base[]; }; x230 = function named() { return [d1, d2] }; >x230 : () => Base[] >Base : Base ->x230 = function named() { return [d1, d2] } : () => Base[] +>x230 = function named() { return [d1, d2] } : () => Array >x230 : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x231: Base[]; x231 = [d1, d2]; >x231 : Base[] >Base : Base ->x231 = [d1, d2] : Base[] +>x231 = [d1, d2] : Array >x231 : Base[] ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2280,9 +2280,9 @@ var x232: Array; x232 = [d1, d2]; >x232 : Base[] >Array : T[] >Base : Base ->x232 = [d1, d2] : Base[] +>x232 = [d1, d2] : Array >x232 : Base[] ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2290,9 +2290,9 @@ var x233: { [n: number]: Base; }; x233 = [d1, d2]; >x233 : { [x: number]: Base; } >n : number >Base : Base ->x233 = [d1, d2] : Base[] +>x233 = [d1, d2] : Array >x233 : { [x: number]: Base; } ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2300,11 +2300,11 @@ var x234: {n: Base[]; } ; x234 = { n: [d1, d2] }; >x234 : { n: Base[]; } >n : Base[] >Base : Base ->x234 = { n: [d1, d2] } : { n: Base[]; } +>x234 = { n: [d1, d2] } : { n: Array; } >x234 : { n: Base[]; } ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2323,13 +2323,13 @@ var x236: Genric; x236 = { func: n => { return [d1, d2]; } }; >x236 : Genric >Genric : Genric >Base : Base ->x236 = { func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } +>x236 = { func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } >x236 : Genric ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2337,10 +2337,10 @@ var x237: { n: () => Base[]; } = { n: () => [d1, d2] }; >x237 : { n: () => Base[]; } >n : () => Base[] >Base : Base ->{ n: () => [d1, d2] } : { n: () => Base[]; } ->n : () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>{ n: () => [d1, d2] } : { n: () => Array; } +>n : () => Array +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2348,10 +2348,10 @@ var x238: { n: () => Base[]; } = { n: function() { return [d1, d2] } }; >x238 : { n: () => Base[]; } >n : () => Base[] >Base : Base ->{ n: function() { return [d1, d2] } } : { n: () => Base[]; } ->n : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>{ n: function() { return [d1, d2] } } : { n: () => Array; } +>n : () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2359,11 +2359,11 @@ var x239: { n: () => Base[]; } = { n: function named() { return [d1, d2] } }; >x239 : { n: () => Base[]; } >n : () => Base[] >Base : Base ->{ n: function named() { return [d1, d2] } } : { n: () => Base[]; } ->n : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>{ n: function named() { return [d1, d2] } } : { n: () => Array; } +>n : () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2371,10 +2371,10 @@ var x240: { n: { (): Base[]; }; } = { n: () => [d1, d2] }; >x240 : { n: () => Base[]; } >n : () => Base[] >Base : Base ->{ n: () => [d1, d2] } : { n: () => Base[]; } ->n : () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>{ n: () => [d1, d2] } : { n: () => Array; } +>n : () => Array +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2382,10 +2382,10 @@ var x241: { n: { (): Base[]; }; } = { n: function() { return [d1, d2] } }; >x241 : { n: () => Base[]; } >n : () => Base[] >Base : Base ->{ n: function() { return [d1, d2] } } : { n: () => Base[]; } ->n : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>{ n: function() { return [d1, d2] } } : { n: () => Array; } +>n : () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2393,11 +2393,11 @@ var x242: { n: { (): Base[]; }; } = { n: function named() { return [d1, d2] } }; >x242 : { n: () => Base[]; } >n : () => Base[] >Base : Base ->{ n: function named() { return [d1, d2] } } : { n: () => Base[]; } ->n : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>{ n: function named() { return [d1, d2] } } : { n: () => Array; } +>n : () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2405,9 +2405,9 @@ var x243: { n: Base[]; } = { n: [d1, d2] }; >x243 : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2416,9 +2416,9 @@ var x244: { n: Array; } = { n: [d1, d2] }; >n : Base[] >Array : T[] >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2427,9 +2427,9 @@ var x245: { n: { [n: number]: Base; }; } = { n: [d1, d2] }; >n : { [x: number]: Base; } >n : number >Base : Base ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2438,11 +2438,11 @@ var x246: { n: {n: Base[]; } ; } = { n: { n: [d1, d2] } }; >n : { n: Base[]; } >n : Base[] >Base : Base ->{ n: { n: [d1, d2] } } : { n: { n: Base[]; }; } ->n : { n: Base[]; } ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: { n: [d1, d2] } } : { n: { n: Array; }; } +>n : { n: Array; } +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2463,49 +2463,49 @@ var x248: { n: Genric; } = { n: { func: n => { return [d1, d2]; } } }; >n : Genric >Genric : Genric >Base : Base ->{ n: { func: n => { return [d1, d2]; } } } : { n: { func: (n: Base[]) => {}[]; }; } ->n : { func: (n: Base[]) => {}[]; } ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ n: { func: n => { return [d1, d2]; } } } : { n: { func: (n: Base[]) => Array; }; } +>n : { func: (n: Base[]) => Array; } +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x252: { (): Base[]; }[] = [() => [d1, d2]]; >x252 : { (): Base[]; }[] >Base : Base ->[() => [d1, d2]] : { (): Base[]; }[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>[() => [d1, d2]] : { (): Array; }[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x253: { (): Base[]; }[] = [function() { return [d1, d2] }]; >x253 : { (): Base[]; }[] >Base : Base ->[function() { return [d1, d2] }] : { (): Base[]; }[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>[function() { return [d1, d2] }] : { (): Array; }[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x254: { (): Base[]; }[] = [function named() { return [d1, d2] }]; >x254 : { (): Base[]; }[] >Base : Base ->[function named() { return [d1, d2] }] : { (): Base[]; }[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>[function named() { return [d1, d2] }] : { (): Array; }[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x255: Base[][] = [[d1, d2]]; >x255 : Base[][] >Base : Base ->[[d1, d2]] : Base[][] ->[d1, d2] : Base[] +>[[d1, d2]] : Array[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2513,8 +2513,8 @@ var x256: Array[] = [[d1, d2]]; >x256 : Base[][] >Array : T[] >Base : Base ->[[d1, d2]] : Base[][] ->[d1, d2] : Base[] +>[[d1, d2]] : Array[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2522,8 +2522,8 @@ var x257: { [n: number]: Base; }[] = [[d1, d2]]; >x257 : { [x: number]: Base; }[] >n : number >Base : Base ->[[d1, d2]] : { [x: number]: Base; }[] ->[d1, d2] : Base[] +>[[d1, d2]] : Array[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2531,10 +2531,10 @@ var x258: {n: Base[]; } [] = [{ n: [d1, d2] }]; >x258 : { n: Base[]; }[] >n : Base[] >Base : Base ->[{ n: [d1, d2] }] : { n: Base[]; }[] ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>[{ n: [d1, d2] }] : { n: Array; }[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2542,21 +2542,21 @@ var x260: Genric[] = [{ func: n => { return [d1, d2]; } }]; >x260 : Genric[] >Genric : Genric >Base : Base ->[{ func: n => { return [d1, d2]; } }] : Genric[] ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>[{ func: n => { return [d1, d2]; } }] : { func: (n: Base[]) => Array; }[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x261: () => Base[] = function() { return [d1, d2] } || undefined; >x261 : () => Base[] >Base : Base ->function() { return [d1, d2] } || undefined : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } || undefined : () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -2564,10 +2564,10 @@ var x261: () => Base[] = function() { return [d1, d2] } || undefined; var x262: () => Base[] = function named() { return [d1, d2] } || undefined; >x262 : () => Base[] >Base : Base ->function named() { return [d1, d2] } || undefined : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } || undefined : () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -2575,9 +2575,9 @@ var x262: () => Base[] = function named() { return [d1, d2] } || undefined; var x263: { (): Base[]; } = function() { return [d1, d2] } || undefined; >x263 : () => Base[] >Base : Base ->function() { return [d1, d2] } || undefined : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } || undefined : () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -2585,10 +2585,10 @@ var x263: { (): Base[]; } = function() { return [d1, d2] } || undefined; var x264: { (): Base[]; } = function named() { return [d1, d2] } || undefined; >x264 : () => Base[] >Base : Base ->function named() { return [d1, d2] } || undefined : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } || undefined : () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -2596,8 +2596,8 @@ var x264: { (): Base[]; } = function named() { return [d1, d2] } || undefined; var x265: Base[] = [d1, d2] || undefined; >x265 : Base[] >Base : Base ->[d1, d2] || undefined : Base[] ->[d1, d2] : Base[] +>[d1, d2] || undefined : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -2606,8 +2606,8 @@ var x266: Array = [d1, d2] || undefined; >x266 : Base[] >Array : T[] >Base : Base ->[d1, d2] || undefined : Base[] ->[d1, d2] : Base[] +>[d1, d2] || undefined : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -2616,8 +2616,8 @@ var x267: { [n: number]: Base; } = [d1, d2] || undefined; >x267 : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] || undefined : { [x: number]: Base; } ->[d1, d2] : Base[] +>[d1, d2] || undefined : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -2626,10 +2626,10 @@ var x268: {n: Base[]; } = { n: [d1, d2] } || undefined; >x268 : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } || undefined : { n: Base[]; } ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } || undefined : { n: Array; } +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -2637,51 +2637,51 @@ var x268: {n: Base[]; } = { n: [d1, d2] } || undefined; var x269: () => Base[] = undefined || function() { return [d1, d2] }; >x269 : () => Base[] >Base : Base ->undefined || function() { return [d1, d2] } : () => Base[] +>undefined || function() { return [d1, d2] } : () => Array >undefined : undefined ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x270: () => Base[] = undefined || function named() { return [d1, d2] }; >x270 : () => Base[] >Base : Base ->undefined || function named() { return [d1, d2] } : () => Base[] +>undefined || function named() { return [d1, d2] } : () => Array >undefined : undefined ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x271: { (): Base[]; } = undefined || function() { return [d1, d2] }; >x271 : () => Base[] >Base : Base ->undefined || function() { return [d1, d2] } : () => Base[] +>undefined || function() { return [d1, d2] } : () => Array >undefined : undefined ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x272: { (): Base[]; } = undefined || function named() { return [d1, d2] }; >x272 : () => Base[] >Base : Base ->undefined || function named() { return [d1, d2] } : () => Base[] +>undefined || function named() { return [d1, d2] } : () => Array >undefined : undefined ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x273: Base[] = undefined || [d1, d2]; >x273 : Base[] >Base : Base ->undefined || [d1, d2] : Base[] +>undefined || [d1, d2] : Array >undefined : undefined ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2689,9 +2689,9 @@ var x274: Array = undefined || [d1, d2]; >x274 : Base[] >Array : T[] >Base : Base ->undefined || [d1, d2] : Base[] +>undefined || [d1, d2] : Array >undefined : undefined ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2699,9 +2699,9 @@ var x275: { [n: number]: Base; } = undefined || [d1, d2]; >x275 : { [x: number]: Base; } >n : number >Base : Base ->undefined || [d1, d2] : { [x: number]: Base; } +>undefined || [d1, d2] : Array >undefined : undefined ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2709,78 +2709,78 @@ var x276: {n: Base[]; } = undefined || { n: [d1, d2] }; >x276 : { n: Base[]; } >n : Base[] >Base : Base ->undefined || { n: [d1, d2] } : { n: Base[]; } +>undefined || { n: [d1, d2] } : { n: Array; } >undefined : undefined ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x277: () => Base[] = function() { return [d1, d2] } || function() { return [d1, d2] }; >x277 : () => Base[] >Base : Base ->function() { return [d1, d2] } || function() { return [d1, d2] } : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } || function() { return [d1, d2] } : () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x278: () => Base[] = function named() { return [d1, d2] } || function named() { return [d1, d2] }; >x278 : () => Base[] >Base : Base ->function named() { return [d1, d2] } || function named() { return [d1, d2] } : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } || function named() { return [d1, d2] } : () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x279: { (): Base[]; } = function() { return [d1, d2] } || function() { return [d1, d2] }; >x279 : () => Base[] >Base : Base ->function() { return [d1, d2] } || function() { return [d1, d2] } : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } || function() { return [d1, d2] } : () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x280: { (): Base[]; } = function named() { return [d1, d2] } || function named() { return [d1, d2] }; >x280 : () => Base[] >Base : Base ->function named() { return [d1, d2] } || function named() { return [d1, d2] } : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } || function named() { return [d1, d2] } : () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x281: Base[] = [d1, d2] || [d1, d2]; >x281 : Base[] >Base : Base ->[d1, d2] || [d1, d2] : Base[] ->[d1, d2] : Base[] +>[d1, d2] || [d1, d2] : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2788,11 +2788,11 @@ var x282: Array = [d1, d2] || [d1, d2]; >x282 : Base[] >Array : T[] >Base : Base ->[d1, d2] || [d1, d2] : Base[] ->[d1, d2] : Base[] +>[d1, d2] || [d1, d2] : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2800,11 +2800,11 @@ var x283: { [n: number]: Base; } = [d1, d2] || [d1, d2]; >x283 : { [x: number]: Base; } >n : number >Base : Base ->[d1, d2] || [d1, d2] : { [x: number]: Base; } ->[d1, d2] : Base[] +>[d1, d2] || [d1, d2] : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2812,108 +2812,108 @@ var x284: {n: Base[]; } = { n: [d1, d2] } || { n: [d1, d2] }; >x284 : { n: Base[]; } >n : Base[] >Base : Base ->{ n: [d1, d2] } || { n: [d1, d2] } : { n: Base[]; } ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } || { n: [d1, d2] } : { n: Array; } +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x285: () => Base[] = true ? () => [d1, d2] : () => [d1, d2]; >x285 : () => Base[] >Base : Base ->true ? () => [d1, d2] : () => [d1, d2] : () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>true ? () => [d1, d2] : () => [d1, d2] : () => Array +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x286: () => Base[] = true ? function() { return [d1, d2] } : function() { return [d1, d2] }; >x286 : () => Base[] >Base : Base ->true ? function() { return [d1, d2] } : function() { return [d1, d2] } : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>true ? function() { return [d1, d2] } : function() { return [d1, d2] } : () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x287: () => Base[] = true ? function named() { return [d1, d2] } : function named() { return [d1, d2] }; >x287 : () => Base[] >Base : Base ->true ? function named() { return [d1, d2] } : function named() { return [d1, d2] } : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>true ? function named() { return [d1, d2] } : function named() { return [d1, d2] } : () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x288: { (): Base[]; } = true ? () => [d1, d2] : () => [d1, d2]; >x288 : () => Base[] >Base : Base ->true ? () => [d1, d2] : () => [d1, d2] : () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>true ? () => [d1, d2] : () => [d1, d2] : () => Array +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x289: { (): Base[]; } = true ? function() { return [d1, d2] } : function() { return [d1, d2] }; >x289 : () => Base[] >Base : Base ->true ? function() { return [d1, d2] } : function() { return [d1, d2] } : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>true ? function() { return [d1, d2] } : function() { return [d1, d2] } : () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x290: { (): Base[]; } = true ? function named() { return [d1, d2] } : function named() { return [d1, d2] }; >x290 : () => Base[] >Base : Base ->true ? function named() { return [d1, d2] } : function named() { return [d1, d2] } : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>true ? function named() { return [d1, d2] } : function named() { return [d1, d2] } : () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x291: Base[] = true ? [d1, d2] : [d1, d2]; >x291 : Base[] >Base : Base ->true ? [d1, d2] : [d1, d2] : Base[] ->[d1, d2] : Base[] +>true ? [d1, d2] : [d1, d2] : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2921,11 +2921,11 @@ var x292: Array = true ? [d1, d2] : [d1, d2]; >x292 : Base[] >Array : T[] >Base : Base ->true ? [d1, d2] : [d1, d2] : Base[] ->[d1, d2] : Base[] +>true ? [d1, d2] : [d1, d2] : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2933,11 +2933,11 @@ var x293: { [n: number]: Base; } = true ? [d1, d2] : [d1, d2]; >x293 : { [x: number]: Base; } >n : number >Base : Base ->true ? [d1, d2] : [d1, d2] : { [x: number]: Base; } ->[d1, d2] : Base[] +>true ? [d1, d2] : [d1, d2] : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2945,15 +2945,15 @@ var x294: {n: Base[]; } = true ? { n: [d1, d2] } : { n: [d1, d2] }; >x294 : { n: Base[]; } >n : Base[] >Base : Base ->true ? { n: [d1, d2] } : { n: [d1, d2] } : { n: Base[]; } ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>true ? { n: [d1, d2] } : { n: [d1, d2] } : { n: Array; } +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -2961,7 +2961,7 @@ var x295: (s: Base[]) => any = true ? n => { var n: Base[]; return null; } : n = >x295 : (s: Base[]) => any >s : Base[] >Base : Base ->true ? n => { var n: Base[]; return null; } : n => { var n: Base[]; return null; } : (s: Base[]) => any +>true ? n => { var n: Base[]; return null; } : n => { var n: Base[]; return null; } : (n: Base[]) => any >n => { var n: Base[]; return null; } : (n: Base[]) => any >n : Base[] >n : Base[] @@ -2975,90 +2975,90 @@ var x296: Genric = true ? { func: n => { return [d1, d2]; } } : { func: n >x296 : Genric >Genric : Genric >Base : Base ->true ? { func: n => { return [d1, d2]; } } : { func: n => { return [d1, d2]; } } : Genric ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>true ? { func: n => { return [d1, d2]; } } : { func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x297: () => Base[] = true ? undefined : () => [d1, d2]; >x297 : () => Base[] >Base : Base ->true ? undefined : () => [d1, d2] : () => Base[] +>true ? undefined : () => [d1, d2] : () => Array >undefined : undefined ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x298: () => Base[] = true ? undefined : function() { return [d1, d2] }; >x298 : () => Base[] >Base : Base ->true ? undefined : function() { return [d1, d2] } : () => Base[] +>true ? undefined : function() { return [d1, d2] } : () => Array >undefined : undefined ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x299: () => Base[] = true ? undefined : function named() { return [d1, d2] }; >x299 : () => Base[] >Base : Base ->true ? undefined : function named() { return [d1, d2] } : () => Base[] +>true ? undefined : function named() { return [d1, d2] } : () => Array >undefined : undefined ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x300: { (): Base[]; } = true ? undefined : () => [d1, d2]; >x300 : () => Base[] >Base : Base ->true ? undefined : () => [d1, d2] : () => Base[] +>true ? undefined : () => [d1, d2] : () => Array >undefined : undefined ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x301: { (): Base[]; } = true ? undefined : function() { return [d1, d2] }; >x301 : () => Base[] >Base : Base ->true ? undefined : function() { return [d1, d2] } : () => Base[] +>true ? undefined : function() { return [d1, d2] } : () => Array >undefined : undefined ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x302: { (): Base[]; } = true ? undefined : function named() { return [d1, d2] }; >x302 : () => Base[] >Base : Base ->true ? undefined : function named() { return [d1, d2] } : () => Base[] +>true ? undefined : function named() { return [d1, d2] } : () => Array >undefined : undefined ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x303: Base[] = true ? undefined : [d1, d2]; >x303 : Base[] >Base : Base ->true ? undefined : [d1, d2] : Base[] +>true ? undefined : [d1, d2] : Array >undefined : undefined ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3066,9 +3066,9 @@ var x304: Array = true ? undefined : [d1, d2]; >x304 : Base[] >Array : T[] >Base : Base ->true ? undefined : [d1, d2] : Base[] +>true ? undefined : [d1, d2] : Array >undefined : undefined ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3076,9 +3076,9 @@ var x305: { [n: number]: Base; } = true ? undefined : [d1, d2]; >x305 : { [x: number]: Base; } >n : number >Base : Base ->true ? undefined : [d1, d2] : { [x: number]: Base; } +>true ? undefined : [d1, d2] : Array >undefined : undefined ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3086,11 +3086,11 @@ var x306: {n: Base[]; } = true ? undefined : { n: [d1, d2] }; >x306 : { n: Base[]; } >n : Base[] >Base : Base ->true ? undefined : { n: [d1, d2] } : { n: Base[]; } +>true ? undefined : { n: [d1, d2] } : { n: Array; } >undefined : undefined ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3098,7 +3098,7 @@ var x307: (s: Base[]) => any = true ? undefined : n => { var n: Base[]; return n >x307 : (s: Base[]) => any >s : Base[] >Base : Base ->true ? undefined : n => { var n: Base[]; return null; } : (s: Base[]) => any +>true ? undefined : n => { var n: Base[]; return null; } : (n: Base[]) => any >undefined : undefined >n => { var n: Base[]; return null; } : (n: Base[]) => any >n : Base[] @@ -3109,22 +3109,22 @@ var x308: Genric = true ? undefined : { func: n => { return [d1, d2]; } }; >x308 : Genric >Genric : Genric >Base : Base ->true ? undefined : { func: n => { return [d1, d2]; } } : Genric +>true ? undefined : { func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } >undefined : undefined ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 var x309: () => Base[] = true ? () => [d1, d2] : undefined; >x309 : () => Base[] >Base : Base ->true ? () => [d1, d2] : undefined : () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>true ? () => [d1, d2] : undefined : () => Array +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3132,9 +3132,9 @@ var x309: () => Base[] = true ? () => [d1, d2] : undefined; var x310: () => Base[] = true ? function() { return [d1, d2] } : undefined; >x310 : () => Base[] >Base : Base ->true ? function() { return [d1, d2] } : undefined : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>true ? function() { return [d1, d2] } : undefined : () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3142,10 +3142,10 @@ var x310: () => Base[] = true ? function() { return [d1, d2] } : undefined; var x311: () => Base[] = true ? function named() { return [d1, d2] } : undefined; >x311 : () => Base[] >Base : Base ->true ? function named() { return [d1, d2] } : undefined : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>true ? function named() { return [d1, d2] } : undefined : () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3153,9 +3153,9 @@ var x311: () => Base[] = true ? function named() { return [d1, d2] } : undefined var x312: { (): Base[]; } = true ? () => [d1, d2] : undefined; >x312 : () => Base[] >Base : Base ->true ? () => [d1, d2] : undefined : () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>true ? () => [d1, d2] : undefined : () => Array +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3163,9 +3163,9 @@ var x312: { (): Base[]; } = true ? () => [d1, d2] : undefined; var x313: { (): Base[]; } = true ? function() { return [d1, d2] } : undefined; >x313 : () => Base[] >Base : Base ->true ? function() { return [d1, d2] } : undefined : () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>true ? function() { return [d1, d2] } : undefined : () => Array +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3173,10 +3173,10 @@ var x313: { (): Base[]; } = true ? function() { return [d1, d2] } : undefined; var x314: { (): Base[]; } = true ? function named() { return [d1, d2] } : undefined; >x314 : () => Base[] >Base : Base ->true ? function named() { return [d1, d2] } : undefined : () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>true ? function named() { return [d1, d2] } : undefined : () => Array +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3184,8 +3184,8 @@ var x314: { (): Base[]; } = true ? function named() { return [d1, d2] } : undefi var x315: Base[] = true ? [d1, d2] : undefined; >x315 : Base[] >Base : Base ->true ? [d1, d2] : undefined : Base[] ->[d1, d2] : Base[] +>true ? [d1, d2] : undefined : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3194,8 +3194,8 @@ var x316: Array = true ? [d1, d2] : undefined; >x316 : Base[] >Array : T[] >Base : Base ->true ? [d1, d2] : undefined : Base[] ->[d1, d2] : Base[] +>true ? [d1, d2] : undefined : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3204,8 +3204,8 @@ var x317: { [n: number]: Base; } = true ? [d1, d2] : undefined; >x317 : { [x: number]: Base; } >n : number >Base : Base ->true ? [d1, d2] : undefined : { [x: number]: Base; } ->[d1, d2] : Base[] +>true ? [d1, d2] : undefined : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3214,10 +3214,10 @@ var x318: {n: Base[]; } = true ? { n: [d1, d2] } : undefined; >x318 : { n: Base[]; } >n : Base[] >Base : Base ->true ? { n: [d1, d2] } : undefined : { n: Base[]; } ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>true ? { n: [d1, d2] } : undefined : { n: Array; } +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3226,7 +3226,7 @@ var x319: (s: Base[]) => any = true ? n => { var n: Base[]; return null; } : und >x319 : (s: Base[]) => any >s : Base[] >Base : Base ->true ? n => { var n: Base[]; return null; } : undefined : (s: Base[]) => any +>true ? n => { var n: Base[]; return null; } : undefined : (n: Base[]) => any >n => { var n: Base[]; return null; } : (n: Base[]) => any >n : Base[] >n : Base[] @@ -3237,12 +3237,12 @@ var x320: Genric = true ? { func: n => { return [d1, d2]; } } : undefined; >x320 : Genric >Genric : Genric >Base : Base ->true ? { func: n => { return [d1, d2]; } } : undefined : Genric ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>true ? { func: n => { return [d1, d2]; } } : undefined : { func: (n: Base[]) => Array; } +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 >undefined : undefined @@ -3253,8 +3253,8 @@ function x321(n: () => Base[]) { }; x321(() => [d1, d2]); >Base : Base >x321(() => [d1, d2]) : void >x321 : (n: () => Base[]) => void ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3264,8 +3264,8 @@ function x322(n: () => Base[]) { }; x322(function() { return [d1, d2] }); >Base : Base >x322(function() { return [d1, d2] }) : void >x322 : (n: () => Base[]) => void ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3275,9 +3275,9 @@ function x323(n: () => Base[]) { }; x323(function named() { return [d1, d2] }); >Base : Base >x323(function named() { return [d1, d2] }) : void >x323 : (n: () => Base[]) => void ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3287,8 +3287,8 @@ function x324(n: { (): Base[]; }) { }; x324(() => [d1, d2]); >Base : Base >x324(() => [d1, d2]) : void >x324 : (n: () => Base[]) => void ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3298,8 +3298,8 @@ function x325(n: { (): Base[]; }) { }; x325(function() { return [d1, d2] }); >Base : Base >x325(function() { return [d1, d2] }) : void >x325 : (n: () => Base[]) => void ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3309,9 +3309,9 @@ function x326(n: { (): Base[]; }) { }; x326(function named() { return [d1, d2] } >Base : Base >x326(function named() { return [d1, d2] }) : void >x326 : (n: () => Base[]) => void ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3321,7 +3321,7 @@ function x327(n: Base[]) { }; x327([d1, d2]); >Base : Base >x327([d1, d2]) : void >x327 : (n: Base[]) => void ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3332,7 +3332,7 @@ function x328(n: Array) { }; x328([d1, d2]); >Base : Base >x328([d1, d2]) : void >x328 : (n: Base[]) => void ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3343,7 +3343,7 @@ function x329(n: { [n: number]: Base; }) { }; x329([d1, d2]); >Base : Base >x329([d1, d2]) : void >x329 : (n: { [x: number]: Base; }) => void ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3354,9 +3354,9 @@ function x330(n: {n: Base[]; } ) { }; x330({ n: [d1, d2] }); >Base : Base >x330({ n: [d1, d2] }) : void >x330 : (n: { n: Base[]; }) => void ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3379,11 +3379,11 @@ function x332(n: Genric) { }; x332({ func: n => { return [d1, d2]; } }); >Base : Base >x332({ func: n => { return [d1, d2]; } }) : void >x332 : (n: Genric) => void ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3395,8 +3395,8 @@ var x333 = (n: () => Base[]) => n; x333(() => [d1, d2]); >n : () => Base[] >x333(() => [d1, d2]) : () => Base[] >x333 : (n: () => Base[]) => () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3408,8 +3408,8 @@ var x334 = (n: () => Base[]) => n; x334(function() { return [d1, d2] }); >n : () => Base[] >x334(function() { return [d1, d2] }) : () => Base[] >x334 : (n: () => Base[]) => () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3421,9 +3421,9 @@ var x335 = (n: () => Base[]) => n; x335(function named() { return [d1, d2] }); >n : () => Base[] >x335(function named() { return [d1, d2] }) : () => Base[] >x335 : (n: () => Base[]) => () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3435,8 +3435,8 @@ var x336 = (n: { (): Base[]; }) => n; x336(() => [d1, d2]); >n : () => Base[] >x336(() => [d1, d2]) : () => Base[] >x336 : (n: () => Base[]) => () => Base[] ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3448,8 +3448,8 @@ var x337 = (n: { (): Base[]; }) => n; x337(function() { return [d1, d2] }); >n : () => Base[] >x337(function() { return [d1, d2] }) : () => Base[] >x337 : (n: () => Base[]) => () => Base[] ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3461,9 +3461,9 @@ var x338 = (n: { (): Base[]; }) => n; x338(function named() { return [d1, d2] }) >n : () => Base[] >x338(function named() { return [d1, d2] }) : () => Base[] >x338 : (n: () => Base[]) => () => Base[] ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3475,7 +3475,7 @@ var x339 = (n: Base[]) => n; x339([d1, d2]); >n : Base[] >x339([d1, d2]) : Base[] >x339 : (n: Base[]) => Base[] ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3488,7 +3488,7 @@ var x340 = (n: Array) => n; x340([d1, d2]); >n : Base[] >x340([d1, d2]) : Base[] >x340 : (n: Base[]) => Base[] ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3501,7 +3501,7 @@ var x341 = (n: { [n: number]: Base; }) => n; x341([d1, d2]); >n : { [x: number]: Base; } >x341([d1, d2]) : { [x: number]: Base; } >x341 : (n: { [x: number]: Base; }) => { [x: number]: Base; } ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3514,9 +3514,9 @@ var x342 = (n: {n: Base[]; } ) => n; x342({ n: [d1, d2] }); >n : { n: Base[]; } >x342({ n: [d1, d2] }) : { n: Base[]; } >x342 : (n: { n: Base[]; }) => { n: Base[]; } ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3543,11 +3543,11 @@ var x344 = (n: Genric) => n; x344({ func: n => { return [d1, d2]; } }); >n : Genric >x344({ func: n => { return [d1, d2]; } }) : Genric >x344 : (n: Genric) => Genric ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3558,8 +3558,8 @@ var x345 = function(n: () => Base[]) { }; x345(() => [d1, d2]); >Base : Base >x345(() => [d1, d2]) : void >x345 : (n: () => Base[]) => void ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3570,8 +3570,8 @@ var x346 = function(n: () => Base[]) { }; x346(function() { return [d1, d2] }); >Base : Base >x346(function() { return [d1, d2] }) : void >x346 : (n: () => Base[]) => void ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3582,9 +3582,9 @@ var x347 = function(n: () => Base[]) { }; x347(function named() { return [d1, d2 >Base : Base >x347(function named() { return [d1, d2] }) : void >x347 : (n: () => Base[]) => void ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3595,8 +3595,8 @@ var x348 = function(n: { (): Base[]; }) { }; x348(() => [d1, d2]); >Base : Base >x348(() => [d1, d2]) : void >x348 : (n: () => Base[]) => void ->() => [d1, d2] : () => Base[] ->[d1, d2] : Base[] +>() => [d1, d2] : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3607,8 +3607,8 @@ var x349 = function(n: { (): Base[]; }) { }; x349(function() { return [d1, d2] } >Base : Base >x349(function() { return [d1, d2] }) : void >x349 : (n: () => Base[]) => void ->function() { return [d1, d2] } : () => Base[] ->[d1, d2] : Base[] +>function() { return [d1, d2] } : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3619,9 +3619,9 @@ var x350 = function(n: { (): Base[]; }) { }; x350(function named() { return [d1, >Base : Base >x350(function named() { return [d1, d2] }) : void >x350 : (n: () => Base[]) => void ->function named() { return [d1, d2] } : () => Base[] ->named : () => Base[] ->[d1, d2] : Base[] +>function named() { return [d1, d2] } : () => Array +>named : () => Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3632,7 +3632,7 @@ var x351 = function(n: Base[]) { }; x351([d1, d2]); >Base : Base >x351([d1, d2]) : void >x351 : (n: Base[]) => void ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3644,7 +3644,7 @@ var x352 = function(n: Array) { }; x352([d1, d2]); >Base : Base >x352([d1, d2]) : void >x352 : (n: Base[]) => void ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3656,7 +3656,7 @@ var x353 = function(n: { [n: number]: Base; }) { }; x353([d1, d2]); >Base : Base >x353([d1, d2]) : void >x353 : (n: { [x: number]: Base; }) => void ->[d1, d2] : Base[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3668,9 +3668,9 @@ var x354 = function(n: {n: Base[]; } ) { }; x354({ n: [d1, d2] }); >Base : Base >x354({ n: [d1, d2] }) : void >x354 : (n: { n: Base[]; }) => void ->{ n: [d1, d2] } : { n: Base[]; } ->n : Base[] ->[d1, d2] : Base[] +>{ n: [d1, d2] } : { n: Array; } +>n : Array +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 @@ -3695,11 +3695,11 @@ var x356 = function(n: Genric) { }; x356({ func: n => { return [d1, d2]; } >Base : Base >x356({ func: n => { return [d1, d2]; } }) : void >x356 : (n: Genric) => void ->{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => {}[]; } ->func : (n: Base[]) => {}[] ->n => { return [d1, d2]; } : (n: Base[]) => {}[] +>{ func: n => { return [d1, d2]; } } : { func: (n: Base[]) => Array; } +>func : (n: Base[]) => Array +>n => { return [d1, d2]; } : (n: Base[]) => Array >n : Base[] ->[d1, d2] : {}[] +>[d1, d2] : Array >d1 : Derived1 >d2 : Derived2 diff --git a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt index d07bbe81e1e..4c3245b11f7 100644 --- a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(16,15): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(40,22): error TS2428: All declarations of an interface must have identical type parameters. + + ==== tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts (3 errors) ==== // generic and non-generic interfaces with the same name do not merge @@ -7,7 +12,7 @@ interface A { // error ~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. bar: T; } @@ -18,7 +23,7 @@ interface A { // error ~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. foo: string; } } @@ -44,7 +49,7 @@ module M3 { export interface A { // error ~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. bar: T; } } \ No newline at end of file diff --git a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types index 2ac2483c405..f16e747d41e 100644 --- a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types +++ b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types @@ -49,7 +49,7 @@ _.all([true, 1, null, 'yes'], _.identity); >_.all : (list: T[], iterator?: Underscore.Iterator, context?: any) => boolean >_ : Underscore.Static >all : (list: T[], iterator?: Underscore.Iterator, context?: any) => boolean ->[true, 1, null, 'yes'] : {}[] +>[true, 1, null, 'yes'] : Array >_.identity : (value: T) => T >_ : Underscore.Static >identity : (value: T) => T diff --git a/tests/baselines/reference/genericArray0.types b/tests/baselines/reference/genericArray0.types index 80a9d5199bd..bf0155bb9ba 100644 --- a/tests/baselines/reference/genericArray0.types +++ b/tests/baselines/reference/genericArray0.types @@ -16,6 +16,6 @@ function map() { var ys: U[] = []; >ys : U[] >U : U ->[] : U[] +>[] : undefined[] } diff --git a/tests/baselines/reference/genericArrayAssignment1.errors.txt b/tests/baselines/reference/genericArrayAssignment1.errors.txt index 1b8d6cb2aab..c0ffc6e1901 100644 --- a/tests/baselines/reference/genericArrayAssignment1.errors.txt +++ b/tests/baselines/reference/genericArrayAssignment1.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/genericArrayAssignment1.ts(4,1): error TS2322: Type 'number[]' is not assignable to type 'string[]': + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/genericArrayAssignment1.ts (1 errors) ==== var s: string[]; var n: number[]; s = n; ~ -!!! Type 'number[]' is not assignable to type 'string[]': -!!! Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'number[]' is not assignable to type 'string[]': +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt b/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt index e57112cf0fa..02ac17bb10c 100644 --- a/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt +++ b/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/genericArrayAssignmentCompatErrors.ts(2,15): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/genericArrayAssignmentCompatErrors.ts(4,14): error TS2314: Generic type 'Array' requires 1 type argument(s). + + ==== tests/cases/compiler/genericArrayAssignmentCompatErrors.ts (2 errors) ==== var myCars=new Array(); var myCars2 = new []; ~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. var myCars3 = new Array({}); var myCars4: Array; // error ~~~~~ -!!! Generic type 'Array' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). var myCars5: Array[]; myCars = myCars2; diff --git a/tests/baselines/reference/genericArrayExtenstions.errors.txt b/tests/baselines/reference/genericArrayExtenstions.errors.txt index c13b637a392..d5ba57ddb55 100644 --- a/tests/baselines/reference/genericArrayExtenstions.errors.txt +++ b/tests/baselines/reference/genericArrayExtenstions.errors.txt @@ -1,10 +1,15 @@ +tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS2421: Class 'ObservableArray' incorrectly implements interface 'T[]': + Property 'length' is missing in type 'ObservableArray'. + + ==== tests/cases/compiler/genericArrayExtenstions.ts (2 errors) ==== export declare class ObservableArray implements Array { // MS.Entertainment.ObservableArray ~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ~~~~~~~~~~~~~~~ -!!! Class 'ObservableArray' incorrectly implements interface 'T[]': -!!! Property 'length' is missing in type 'ObservableArray'. +!!! error TS2421: Class 'ObservableArray' incorrectly implements interface 'T[]': +!!! error TS2421: Property 'length' is missing in type 'ObservableArray'. concat(...items: U[]): T[]; concat(...items: T[]): T[]; } diff --git a/tests/baselines/reference/genericArrayMethods1.errors.txt b/tests/baselines/reference/genericArrayMethods1.errors.txt index 669fa926c26..9b037155e33 100644 --- a/tests/baselines/reference/genericArrayMethods1.errors.txt +++ b/tests/baselines/reference/genericArrayMethods1.errors.txt @@ -1,6 +1,10 @@ +tests/cases/compiler/genericArrayMethods1.ts(1,5): error TS2322: Type 'number[]' is not assignable to type 'string[]': + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/genericArrayMethods1.ts (1 errors) ==== var x:string[] = [0,1].slice(0); // this should be an error ~ -!!! Type 'number[]' is not assignable to type 'string[]': -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'number[]' is not assignable to type 'string[]': +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericArrayWithoutTypeAnnotation.errors.txt b/tests/baselines/reference/genericArrayWithoutTypeAnnotation.errors.txt index 7cec6a532a4..dcb0de1cbb5 100644 --- a/tests/baselines/reference/genericArrayWithoutTypeAnnotation.errors.txt +++ b/tests/baselines/reference/genericArrayWithoutTypeAnnotation.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/genericArrayWithoutTypeAnnotation.ts(4,24): error TS2314: Generic type 'IFoo' requires 1 type argument(s). + + ==== tests/cases/compiler/genericArrayWithoutTypeAnnotation.ts (1 errors) ==== interface IFoo{ } class Bar { public getBar(foo: IFoo[]) { ~~~~ -!!! Generic type 'IFoo' requires 1 type argument(s). +!!! error TS2314: Generic type 'IFoo' requires 1 type argument(s). } } \ No newline at end of file diff --git a/tests/baselines/reference/genericAssignmentCompatOfFunctionSignatures1.errors.txt b/tests/baselines/reference/genericAssignmentCompatOfFunctionSignatures1.errors.txt index ad664c5c5b8..2ff34413595 100644 --- a/tests/baselines/reference/genericAssignmentCompatOfFunctionSignatures1.errors.txt +++ b/tests/baselines/reference/genericAssignmentCompatOfFunctionSignatures1.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/genericAssignmentCompatOfFunctionSignatures1.ts(1,27): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/genericAssignmentCompatOfFunctionSignatures1.ts(2,27): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/genericAssignmentCompatOfFunctionSignatures1.ts (2 errors) ==== var x1 = function foo3(x: T, z: U) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var x2 = function foo3(x: T, z: U) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. x1 = x2; x2 = x1; \ No newline at end of file diff --git a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt index 8bd0c913128..8fea5ddfa72 100644 --- a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt +++ b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt @@ -1,3 +1,33 @@ +tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(12,5): error TS2322: Type '{ x: A; }' is not assignable to type 'I': + Types of property 'x' are incompatible: + Type 'A' is not assignable to type 'Comparable': + Types of property 'compareTo' are incompatible: + Type '(other: number) => number' is not assignable to type '(other: string) => number': + Types of parameters 'other' and 'other' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(13,5): error TS2322: Type '{ x: A; }' is not assignable to type 'I': + Types of property 'x' are incompatible: + Type 'A' is not assignable to type 'Comparable': + Types of property 'compareTo' are incompatible: + Type '(other: number) => number' is not assignable to type '(other: string) => number': + Types of parameters 'other' and 'other' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(16,5): error TS2322: Type '{ x: A; }' is not assignable to type 'I': + Types of property 'x' are incompatible: + Type 'A' is not assignable to type 'Comparable': + Types of property 'compareTo' are incompatible: + Type '(other: number) => number' is not assignable to type '(other: string) => number': + Types of parameters 'other' and 'other' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(17,5): error TS2322: Type 'K' is not assignable to type 'I': + Types of property 'x' are incompatible: + Type 'A' is not assignable to type 'Comparable': + Types of property 'compareTo' are incompatible: + Type '(other: number) => number' is not assignable to type '(other: string) => number': + Types of parameters 'other' and 'other' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts (4 errors) ==== interface Comparable { compareTo(other: T): number; @@ -12,41 +42,41 @@ var z = { x: new A() }; var a1: I = { x: new A() }; ~~ -!!! Type '{ x: A; }' is not assignable to type 'I': -!!! Types of property 'x' are incompatible: -!!! Type 'A' is not assignable to type 'Comparable': -!!! Types of property 'compareTo' are incompatible: -!!! Type '(other: number) => number' is not assignable to type '(other: string) => number': -!!! Types of parameters 'other' and 'other' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '{ x: A; }' is not assignable to type 'I': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'A' is not assignable to type 'Comparable': +!!! error TS2322: Types of property 'compareTo' are incompatible: +!!! error TS2322: Type '(other: number) => number' is not assignable to type '(other: string) => number': +!!! error TS2322: Types of parameters 'other' and 'other' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. var a2: I = function (): { x: A } { ~~ -!!! Type '{ x: A; }' is not assignable to type 'I': -!!! Types of property 'x' are incompatible: -!!! Type 'A' is not assignable to type 'Comparable': -!!! Types of property 'compareTo' are incompatible: -!!! Type '(other: number) => number' is not assignable to type '(other: string) => number': -!!! Types of parameters 'other' and 'other' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '{ x: A; }' is not assignable to type 'I': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'A' is not assignable to type 'Comparable': +!!! error TS2322: Types of property 'compareTo' are incompatible: +!!! error TS2322: Type '(other: number) => number' is not assignable to type '(other: string) => number': +!!! error TS2322: Types of parameters 'other' and 'other' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. var z = { x: new A() }; return z; } (); var a3: I = z; ~~ -!!! Type '{ x: A; }' is not assignable to type 'I': -!!! Types of property 'x' are incompatible: -!!! Type 'A' is not assignable to type 'Comparable': -!!! Types of property 'compareTo' are incompatible: -!!! Type '(other: number) => number' is not assignable to type '(other: string) => number': -!!! Types of parameters 'other' and 'other' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '{ x: A; }' is not assignable to type 'I': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'A' is not assignable to type 'Comparable': +!!! error TS2322: Types of property 'compareTo' are incompatible: +!!! error TS2322: Type '(other: number) => number' is not assignable to type '(other: string) => number': +!!! error TS2322: Types of parameters 'other' and 'other' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. var a4: I = >z; ~~ -!!! Type 'K' is not assignable to type 'I': -!!! Types of property 'x' are incompatible: -!!! Type 'A' is not assignable to type 'Comparable': -!!! Types of property 'compareTo' are incompatible: -!!! Type '(other: number) => number' is not assignable to type '(other: string) => number': -!!! Types of parameters 'other' and 'other' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'K' is not assignable to type 'I': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'A' is not assignable to type 'Comparable': +!!! error TS2322: Types of property 'compareTo' are incompatible: +!!! error TS2322: Type '(other: number) => number' is not assignable to type '(other: string) => number': +!!! error TS2322: Types of parameters 'other' and 'other' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.types b/tests/baselines/reference/genericBaseClassLiteralProperty2.types index b2d156e3c16..9caa45b8b8f 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.types +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.types @@ -14,11 +14,11 @@ class BaseCollection2 { constructor() { this._itemsByKey = {}; ->this._itemsByKey = {} : { [x: string]: TItem; } +>this._itemsByKey = {} : { [x: string]: undefined; } >this._itemsByKey : { [x: string]: TItem; } >this : BaseCollection2 >_itemsByKey : { [x: string]: TItem; } ->{} : { [x: string]: TItem; } +>{} : { [x: string]: undefined; } } } diff --git a/tests/baselines/reference/genericCallSpecializedToTypeArg.errors.txt b/tests/baselines/reference/genericCallSpecializedToTypeArg.errors.txt index 40d523e01e1..4deec14741c 100644 --- a/tests/baselines/reference/genericCallSpecializedToTypeArg.errors.txt +++ b/tests/baselines/reference/genericCallSpecializedToTypeArg.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/genericCallSpecializedToTypeArg.ts(6,5): error TS2339: Property 'getDist' does not exist on type 'U'. + + ==== tests/cases/compiler/genericCallSpecializedToTypeArg.ts (1 errors) ==== function dupe(x: T): T { return x; @@ -6,7 +9,7 @@ var y = dupe(x); //<-- dupe has incorrect type here y.getDist(); //<-- this requires a missing constraint, but it's not caught ~~~~~~~ -!!! Property 'getDist' does not exist on type 'U'. +!!! error TS2339: Property 'getDist' does not exist on type 'U'. return y; } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithArrayLiteralArgs.types b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types index c79efb0792c..84082a68ebd 100644 --- a/tests/baselines/reference/genericCallWithArrayLiteralArgs.types +++ b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types @@ -25,36 +25,36 @@ var ra = foo([1, 2]); // any[] >ra : any[] >foo([1, 2]) : any[] >foo : (t: T) => T ->[1, 2] : any[] +>[1, 2] : number[] var r2 = foo([]); // any[] >r2 : any[] >foo([]) : any[] >foo : (t: T) => T ->[] : any[] +>[] : undefined[] var r3 = foo([]); // number[] >r3 : number[] >foo([]) : number[] >foo : (t: T) => T ->[] : number[] +>[] : undefined[] var r4 = foo([1, '']); // {}[] ->r4 : {}[] ->foo([1, '']) : {}[] +>r4 : Array +>foo([1, '']) : Array >foo : (t: T) => T ->[1, ''] : {}[] +>[1, ''] : Array var r5 = foo([1, '']); // any[] >r5 : any[] >foo([1, '']) : any[] >foo : (t: T) => T ->[1, ''] : any[] +>[1, ''] : Array var r6 = foo([1, '']); // Object[] >r6 : Object[] >foo([1, '']) : Object[] >foo : (t: T) => T >Object : Object ->[1, ''] : Object[] +>[1, ''] : Array diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt index 6d829215cd2..604896319ca 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt @@ -1,9 +1,13 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(3,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(11,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'. + + ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts (2 errors) ==== // Generic call with parameters of T and U, U extends T, no parameter of type U function foo(t: T) { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var u: U; return u; } @@ -13,5 +17,5 @@ var r3 = foo(new Object()); // {} var r4 = foo(1); // error ~ -!!! Argument of type 'number' is not assignable to parameter of type 'Date'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'. var r5 = foo(new Date()); // no error \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt b/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt index c92110911ab..48e615bdb3e 100644 --- a/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt +++ b/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(11,14): error TS2345: Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: any) => string; }'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(13,14): error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'. + + ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts (2 errors) ==== // Generic call with parameter of object type with member of function type of n args passed object whose associated member is call signature with n+1 args @@ -11,11 +15,11 @@ var arg2: { cb: new (x: T, y: T) => string }; var r2 = foo(arg2); // error ~~~~ -!!! Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: any) => string; }'. +!!! error TS2345: Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: any) => string; }'. var arg3: { cb: new (x: string, y: number) => string }; var r3 = foo(arg3); // error ~~~~ -!!! Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'. +!!! error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'. function foo2(arg: { cb: new(t: T, t2: T) => U }) { return new arg.cb(null, null); diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt new file mode 100644 index 00000000000..36a22868333 --- /dev/null +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -0,0 +1,58 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(26,18): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,15): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,15): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,16): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,23): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. + Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts (5 errors) ==== + // Generic functions used as arguments for function typed parameters are not used to make inferences from + // Using function arguments, no errors expected + + function foo(x: (a: T) => T) { + return x(null); + } + + var r = foo((x: U) => ''); // {} + var r2 = foo((x: U) => ''); // string + var r3 = foo(x => ''); // {} + + function foo2(x: T, cb: (a: T) => U) { + return cb(x); + } + + var r4 = foo2(1, function (a: Z) { return '' }); // string, contextual signature instantiation is applied to generic functions + var r5 = foo2(1, (a) => ''); // string + var r6 = foo2('', (a: Z) => 1); + + function foo3(x: T, cb: (a: T) => U, y: U) { + return cb(x); + } + + var r7 = foo3(1, (a: Z) => '', ''); // string + + var r8 = foo3(1, function (a) { return '' }, 1); // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + var r9 = foo3(1, (a) => '', ''); // string + + function other(t: T, u: U) { + var r10 = foo2(1, (x: T) => ''); // error + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r10 = foo2(1, (x) => ''); // string + + var r11 = foo3(1, (x: T) => '', ''); // error + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r11b = foo3(1, (x: T) => '', 1); // error + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r12 = foo3(1, function (a) { return '' }, 1); // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.js b/tests/baselines/reference/genericCallWithFunctionTypedArguments.js index 8e844cfbc5a..fed1d4ca990 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.js +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.js @@ -24,16 +24,16 @@ function foo3(x: T, cb: (a: T) => U, y: U) { var r7 = foo3(1, (a: Z) => '', ''); // string -var r8 = foo3(1, function (a) { return '' }, 1); // {} +var r8 = foo3(1, function (a) { return '' }, 1); // error var r9 = foo3(1, (a) => '', ''); // string function other(t: T, u: U) { - var r10 = foo2(1, (x: T) => ''); // string, non-generic signature allows inferences to be made + var r10 = foo2(1, (x: T) => ''); // error var r10 = foo2(1, (x) => ''); // string - var r11 = foo3(1, (x: T) => '', ''); // string - var r11b = foo3(1, (x: T) => '', 1); // {} - var r12 = foo3(1, function (a) { return '' }, 1); // {} + var r11 = foo3(1, (x: T) => '', ''); // error + var r11b = foo3(1, (x: T) => '', 1); // error + var r12 = foo3(1, function (a) { return '' }, 1); // error } //// [genericCallWithFunctionTypedArguments.js] @@ -59,14 +59,14 @@ function foo3(x, cb, y) { var r7 = foo3(1, function (a) { return ''; }, ''); // string var r8 = foo3(1, function (a) { return ''; -}, 1); // {} +}, 1); // error var r9 = foo3(1, function (a) { return ''; }, ''); // string function other(t, u) { - var r10 = foo2(1, function (x) { return ''; }); // string, non-generic signature allows inferences to be made + var r10 = foo2(1, function (x) { return ''; }); // error var r10 = foo2(1, function (x) { return ''; }); // string - var r11 = foo3(1, function (x) { return ''; }, ''); // string - var r11b = foo3(1, function (x) { return ''; }, 1); // {} + var r11 = foo3(1, function (x) { return ''; }, ''); // error + var r11b = foo3(1, function (x) { return ''; }, 1); // error var r12 = foo3(1, function (a) { return ''; - }, 1); // {} + }, 1); // error } diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.types b/tests/baselines/reference/genericCallWithFunctionTypedArguments.types deleted file mode 100644 index 2d3b234d0e1..00000000000 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.types +++ /dev/null @@ -1,173 +0,0 @@ -=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts === -// Generic functions used as arguments for function typed parameters are not used to make inferences from -// Using function arguments, no errors expected - -function foo(x: (a: T) => T) { ->foo : (x: (a: T) => T) => T ->T : T ->x : (a: T) => T ->a : T ->T : T ->T : T - - return x(null); ->x(null) : T ->x : (a: T) => T -} - -var r = foo((x: U) => ''); // {} ->r : {} ->foo((x: U) => '') : {} ->foo : (x: (a: T) => T) => T ->(x: U) => '' : (x: U) => string ->U : U ->x : U ->U : U - -var r2 = foo((x: U) => ''); // string ->r2 : string ->foo((x: U) => '') : string ->foo : (x: (a: T) => T) => T ->(x: U) => '' : (x: U) => string ->U : U ->x : U ->U : U - -var r3 = foo(x => ''); // {} ->r3 : {} ->foo(x => '') : {} ->foo : (x: (a: T) => T) => T ->x => '' : (x: {}) => string ->x : {} - -function foo2(x: T, cb: (a: T) => U) { ->foo2 : (x: T, cb: (a: T) => U) => U ->T : T ->U : U ->x : T ->T : T ->cb : (a: T) => U ->a : T ->T : T ->U : U - - return cb(x); ->cb(x) : U ->cb : (a: T) => U ->x : T -} - -var r4 = foo2(1, function (a: Z) { return '' }); // string, contextual signature instantiation is applied to generic functions ->r4 : string ->foo2(1, function (a: Z) { return '' }) : string ->foo2 : (x: T, cb: (a: T) => U) => U ->function (a: Z) { return '' } : (a: Z) => string ->Z : Z ->a : Z ->Z : Z - -var r5 = foo2(1, (a) => ''); // string ->r5 : string ->foo2(1, (a) => '') : string ->foo2 : (x: T, cb: (a: T) => U) => U ->(a) => '' : (a: number) => string ->a : number - -var r6 = foo2('', (a: Z) => 1); ->r6 : number ->foo2('', (a: Z) => 1) : number ->foo2 : (x: T, cb: (a: T) => U) => U ->(a: Z) => 1 : (a: Z) => number ->Z : Z ->a : Z ->Z : Z - -function foo3(x: T, cb: (a: T) => U, y: U) { ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->T : T ->U : U ->x : T ->T : T ->cb : (a: T) => U ->a : T ->T : T ->U : U ->y : U ->U : U - - return cb(x); ->cb(x) : U ->cb : (a: T) => U ->x : T -} - -var r7 = foo3(1, (a: Z) => '', ''); // string ->r7 : string ->foo3(1, (a: Z) => '', '') : string ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->(a: Z) => '' : (a: Z) => string ->Z : Z ->a : Z ->Z : Z - -var r8 = foo3(1, function (a) { return '' }, 1); // {} ->r8 : {} ->foo3(1, function (a) { return '' }, 1) : {} ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->function (a) { return '' } : (a: number) => string ->a : number - -var r9 = foo3(1, (a) => '', ''); // string ->r9 : string ->foo3(1, (a) => '', '') : string ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->(a) => '' : (a: number) => string ->a : number - -function other(t: T, u: U) { ->other : (t: T, u: U) => void ->T : T ->U : U ->t : T ->T : T ->u : U ->U : U - - var r10 = foo2(1, (x: T) => ''); // string, non-generic signature allows inferences to be made ->r10 : string ->foo2(1, (x: T) => '') : string ->foo2 : (x: T, cb: (a: T) => U) => U ->(x: T) => '' : (x: T) => string ->x : T ->T : T - - var r10 = foo2(1, (x) => ''); // string ->r10 : string ->foo2(1, (x) => '') : string ->foo2 : (x: T, cb: (a: T) => U) => U ->(x) => '' : (x: number) => string ->x : number - - var r11 = foo3(1, (x: T) => '', ''); // string ->r11 : string ->foo3(1, (x: T) => '', '') : string ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->(x: T) => '' : (x: T) => string ->x : T ->T : T - - var r11b = foo3(1, (x: T) => '', 1); // {} ->r11b : {} ->foo3(1, (x: T) => '', 1) : {} ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->(x: T) => '' : (x: T) => string ->x : T ->T : T - - var r12 = foo3(1, function (a) { return '' }, 1); // {} ->r12 : {} ->foo3(1, function (a) { return '' }, 1) : {} ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->function (a) { return '' } : (a: number) => string ->a : number -} diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt new file mode 100644 index 00000000000..083d197bbb4 --- /dev/null +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(29,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(40,10): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts (2 errors) ==== + // Generic functions used as arguments for function typed parameters are not used to make inferences from + // Using construct signature arguments, no errors expected + + function foo(x: new(a: T) => T) { + return new x(null); + } + + interface I { + new (x: T): T; + } + interface I2 { + new (x: T): T; + } + var i: I; + var i2: I2; + var a: { + new (x: T): T; + } + + var r = foo(i); // any + var r2 = foo(i); // string + var r3 = foo(i2); // string + var r3b = foo(a); // any + + function foo2(x: T, cb: new(a: T) => U) { + return new cb(x); + } + + var r4 = foo2(1, i2); // error + ~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r4b = foo2(1, a); // any + var r5 = foo2(1, i); // any + var r6 = foo2('', i2); // string + + function foo3(x: T, cb: new(a: T) => U, y: U) { + return new cb(x); + } + + var r7 = foo3(null, i, ''); // any + var r7b = foo3(null, a, ''); // any + var r8 = foo3(1, i2, 1); // error + ~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r9 = foo3('', i2, ''); // string \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.js b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.js index ca9b79c3507..7e9b7886fb4 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.js +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.js @@ -27,7 +27,7 @@ function foo2(x: T, cb: new(a: T) => U) { return new cb(x); } -var r4 = foo2(1, i2); // string, instantiated generic +var r4 = foo2(1, i2); // error var r4b = foo2(1, a); // any var r5 = foo2(1, i); // any var r6 = foo2('', i2); // string @@ -38,7 +38,7 @@ function foo3(x: T, cb: new(a: T) => U, y: U) { var r7 = foo3(null, i, ''); // any var r7b = foo3(null, a, ''); // any -var r8 = foo3(1, i2, 1); // {} +var r8 = foo3(1, i2, 1); // error var r9 = foo3('', i2, ''); // string //// [genericCallWithFunctionTypedArguments2.js] @@ -57,7 +57,7 @@ var r3b = foo(a); // any function foo2(x, cb) { return new cb(x); } -var r4 = foo2(1, i2); // string, instantiated generic +var r4 = foo2(1, i2); // error var r4b = foo2(1, a); // any var r5 = foo2(1, i); // any var r6 = foo2('', i2); // string @@ -66,5 +66,5 @@ function foo3(x, cb, y) { } var r7 = foo3(null, i, ''); // any var r7b = foo3(null, a, ''); // any -var r8 = foo3(1, i2, 1); // {} +var r8 = foo3(1, i2, 1); // error var r9 = foo3('', i2, ''); // string diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.types b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.types deleted file mode 100644 index 89d7afd94e2..00000000000 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.types +++ /dev/null @@ -1,161 +0,0 @@ -=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts === -// Generic functions used as arguments for function typed parameters are not used to make inferences from -// Using construct signature arguments, no errors expected - -function foo(x: new(a: T) => T) { ->foo : (x: new (a: T) => T) => T ->T : T ->x : new (a: T) => T ->a : T ->T : T ->T : T - - return new x(null); ->new x(null) : T ->x : new (a: T) => T -} - -interface I { ->I : I - - new (x: T): T; ->T : T ->x : T ->T : T ->T : T -} -interface I2 { ->I2 : I2 ->T : T - - new (x: T): T; ->x : T ->T : T ->T : T -} -var i: I; ->i : I ->I : I - -var i2: I2; ->i2 : I2 ->I2 : I2 - -var a: { ->a : new (x: T) => T - - new (x: T): T; ->T : T ->x : T ->T : T ->T : T -} - -var r = foo(i); // any ->r : any ->foo(i) : any ->foo : (x: new (a: T) => T) => T ->i : I - -var r2 = foo(i); // string ->r2 : string ->foo(i) : string ->foo : (x: new (a: T) => T) => T ->i : I - -var r3 = foo(i2); // string ->r3 : string ->foo(i2) : string ->foo : (x: new (a: T) => T) => T ->i2 : I2 - -var r3b = foo(a); // any ->r3b : any ->foo(a) : any ->foo : (x: new (a: T) => T) => T ->a : new (x: T) => T - -function foo2(x: T, cb: new(a: T) => U) { ->foo2 : (x: T, cb: new (a: T) => U) => U ->T : T ->U : U ->x : T ->T : T ->cb : new (a: T) => U ->a : T ->T : T ->U : U - - return new cb(x); ->new cb(x) : U ->cb : new (a: T) => U ->x : T -} - -var r4 = foo2(1, i2); // string, instantiated generic ->r4 : string ->foo2(1, i2) : string ->foo2 : (x: T, cb: new (a: T) => U) => U ->i2 : I2 - -var r4b = foo2(1, a); // any ->r4b : any ->foo2(1, a) : any ->foo2 : (x: T, cb: new (a: T) => U) => U ->a : new (x: T) => T - -var r5 = foo2(1, i); // any ->r5 : any ->foo2(1, i) : any ->foo2 : (x: T, cb: new (a: T) => U) => U ->i : I - -var r6 = foo2('', i2); // string ->r6 : string ->foo2('', i2) : string ->foo2 : (x: T, cb: new (a: T) => U) => U ->i2 : I2 - -function foo3(x: T, cb: new(a: T) => U, y: U) { ->foo3 : (x: T, cb: new (a: T) => U, y: U) => U ->T : T ->U : U ->x : T ->T : T ->cb : new (a: T) => U ->a : T ->T : T ->U : U ->y : U ->U : U - - return new cb(x); ->new cb(x) : U ->cb : new (a: T) => U ->x : T -} - -var r7 = foo3(null, i, ''); // any ->r7 : any ->foo3(null, i, '') : any ->foo3 : (x: T, cb: new (a: T) => U, y: U) => U ->i : I - -var r7b = foo3(null, a, ''); // any ->r7b : any ->foo3(null, a, '') : any ->foo3 : (x: T, cb: new (a: T) => U, y: U) => U ->a : new (x: T) => T - -var r8 = foo3(1, i2, 1); // {} ->r8 : {} ->foo3(1, i2, 1) : {} ->foo3 : (x: T, cb: new (a: T) => U, y: U) => U ->i2 : I2 - -var r9 = foo3('', i2, ''); // string ->r9 : string ->foo3('', i2, '') : string ->foo3 : (x: T, cb: new (a: T) => U, y: U) => U ->i2 : I2 - diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt index 8de5453e2af..d5084fbee40 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(10,14): error TS2345: Argument of type '{ cb: (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: (t: {}) => string; }'. + Types of property 'cb' are incompatible: + Type '(x: T, y: T) => string' is not assignable to type '(t: {}) => string'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(11,14): error TS2345: Argument of type '{ cb: (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: (t: string) => string; }'. + Types of property 'cb' are incompatible: + Type '(x: string, y: number) => string' is not assignable to type '(t: string) => string'. + + ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts (2 errors) ==== // Generic call with parameter of object type with member of function type of n args passed object whose associated member is call signature with n+1 args @@ -10,14 +18,14 @@ // more args not allowed var r2 = foo({ cb: (x: T, y: T) => '' }); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '{ cb: (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: (t: {}) => string; }'. -!!! Types of property 'cb' are incompatible: -!!! Type '(x: T, y: T) => string' is not assignable to type '(t: {}) => string'. +!!! error TS2345: Argument of type '{ cb: (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: (t: {}) => string; }'. +!!! error TS2345: Types of property 'cb' are incompatible: +!!! error TS2345: Type '(x: T, y: T) => string' is not assignable to type '(t: {}) => string'. var r3 = foo({ cb: (x: string, y: number) => '' }); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '{ cb: (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: (t: string) => string; }'. -!!! Types of property 'cb' are incompatible: -!!! Type '(x: string, y: number) => string' is not assignable to type '(t: string) => string'. +!!! error TS2345: Argument of type '{ cb: (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: (t: string) => string; }'. +!!! error TS2345: Types of property 'cb' are incompatible: +!!! error TS2345: Type '(x: string, y: number) => string' is not assignable to type '(t: string) => string'. function foo2(arg: { cb: (t: T, t2: T) => U }) { return arg.cb(null, null); diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index 9396e3f2de9..55318f268bd 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -1,45 +1,106 @@ -==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts (4 errors) ==== +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(10,29): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,36): error TS2345: Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(67,51): error TS2304: Cannot find name 'U'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(67,57): error TS2304: Cannot find name 'U'. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts (10 errors) ==== // When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, // the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. - function foo(a: (x: T) => T, b: (x: T) => T) { - var r: (x: T) => T; - return r; + module onlyT { + function foo(a: (x: T) => T, b: (x: T) => T) { + var r: (x: T) => T; + return r; + } + + var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => ''); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + + function other2(x: T) { + var r7 = foo((a: T) => a, (b: T) => b); // T => T + // BUG 835518 + var r9 = r7(new Date()); // should be ok + ~~~~~~~~~~ +!!! error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. + var r10 = r7(1); // error + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. + } + + function foo2(a: (x: T) => T, b: (x: T) => T) { + var r: (x: T) => T; + return r; + } + + function other3(x: T) { + var r7 = foo2((a: T) => a, (b: T) => b); // error + ~~~~~~~~~~~ +!!! error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. + var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date + } + + enum E { A } + enum F { A } + + function foo3(x: T, a: (x: T) => T, b: (x: T) => T) { + var r: (x: T) => T; + return r; + } + + var r7 = foo3(E.A, (x) => E.A, (x) => F.A); // error + ~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'. } - var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => ''); + module TU { + function foo(a: (x: T) => T, b: (x: U) => U) { + var r: (x: T) => T; + return r; + } - function other2(x: T) { - var r7 = foo((a: T) => a, (b: T) => b); // T => T - // BUG 835518 - var r9 = r7(new Date()); // should be ok - ~~~~~~~~~~ -!!! Argument of type 'Date' is not assignable to parameter of type 'T'. - var r10 = r7(1); // error - ~ -!!! Argument of type 'number' is not assignable to parameter of type 'T'. - } + var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => ''); - function foo2(a: (x: T) => T, b: (x: T) => T) { - var r: (x: T) => T; - return r; - } + function other2(x: T) { + var r7 = foo((a: T) => a, (b: T) => b); + var r9 = r7(new Date()); + ~~~~~~~~~~ +!!! error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. + var r10 = r7(1); + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. + } - function other3(x: T) { - var r7 = foo2((a: T) => a, (b: T) => b); // error - ~~~~~~~~~~~ -!!! Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. - var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date - } + function foo2(a: (x: T) => T, b: (x: U) => U) { + var r: (x: T) => T; + return r; + } - enum E { A } - enum F { A } + function other3(x: T) { + var r7 = foo2((a: T) => a, (b: T) => b); + ~~~~~~~~~~~ +!!! error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. + var r7b = foo2((a) => a, (b) => b); + } - function foo3(x: T, a: (x: T) => T, b: (x: T) => T) { - var r: (x: T) => T; - return r; - } + enum E { A } + enum F { A } - var r7 = foo3(E.A, (x) => E.A, (x) => F.A); // error - ~~~~~~~~~~ -!!! Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'. \ No newline at end of file + function foo3(x: T, a: (x: T) => T, b: (x: U) => U) { + ~ +!!! error TS2304: Cannot find name 'U'. + ~ +!!! error TS2304: Cannot find name 'U'. + var r: (x: T) => T; + return r; + } + + var r7 = foo3(E.A, (x) => E.A, (x) => F.A); + } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.js b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.js index 7dc955b6172..7acdcc32536 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.js +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.js @@ -2,72 +2,146 @@ // When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, // the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. -function foo(a: (x: T) => T, b: (x: T) => T) { - var r: (x: T) => T; - return r; +module onlyT { + function foo(a: (x: T) => T, b: (x: T) => T) { + var r: (x: T) => T; + return r; + } + + var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => ''); + + function other2(x: T) { + var r7 = foo((a: T) => a, (b: T) => b); // T => T + // BUG 835518 + var r9 = r7(new Date()); // should be ok + var r10 = r7(1); // error + } + + function foo2(a: (x: T) => T, b: (x: T) => T) { + var r: (x: T) => T; + return r; + } + + function other3(x: T) { + var r7 = foo2((a: T) => a, (b: T) => b); // error + var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date + } + + enum E { A } + enum F { A } + + function foo3(x: T, a: (x: T) => T, b: (x: T) => T) { + var r: (x: T) => T; + return r; + } + + var r7 = foo3(E.A, (x) => E.A, (x) => F.A); // error } -var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => ''); +module TU { + function foo(a: (x: T) => T, b: (x: U) => U) { + var r: (x: T) => T; + return r; + } -function other2(x: T) { - var r7 = foo((a: T) => a, (b: T) => b); // T => T - // BUG 835518 - var r9 = r7(new Date()); // should be ok - var r10 = r7(1); // error -} + var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => ''); -function foo2(a: (x: T) => T, b: (x: T) => T) { - var r: (x: T) => T; - return r; -} + function other2(x: T) { + var r7 = foo((a: T) => a, (b: T) => b); + var r9 = r7(new Date()); + var r10 = r7(1); + } -function other3(x: T) { - var r7 = foo2((a: T) => a, (b: T) => b); // error - var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date -} + function foo2(a: (x: T) => T, b: (x: U) => U) { + var r: (x: T) => T; + return r; + } -enum E { A } -enum F { A } + function other3(x: T) { + var r7 = foo2((a: T) => a, (b: T) => b); + var r7b = foo2((a) => a, (b) => b); + } -function foo3(x: T, a: (x: T) => T, b: (x: T) => T) { - var r: (x: T) => T; - return r; -} + enum E { A } + enum F { A } -var r7 = foo3(E.A, (x) => E.A, (x) => F.A); // error + function foo3(x: T, a: (x: T) => T, b: (x: U) => U) { + var r: (x: T) => T; + return r; + } + + var r7 = foo3(E.A, (x) => E.A, (x) => F.A); +} //// [genericCallWithGenericSignatureArguments2.js] // When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, // the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. -function foo(a, b) { - var r; - return r; -} -var r1 = foo(function (x) { return 1; }, function (x) { return ''; }); -function other2(x) { - var r7 = foo(function (a) { return a; }, function (b) { return b; }); // T => T - // BUG 835518 - var r9 = r7(new Date()); // should be ok - var r10 = r7(1); // error -} -function foo2(a, b) { - var r; - return r; -} -function other3(x) { - var r7 = foo2(function (a) { return a; }, function (b) { return b; }); // error - var r7b = foo2(function (a) { return a; }, function (b) { return b; }); // valid, T is inferred to be Date -} -var E; -(function (E) { - E[E["A"] = 0] = "A"; -})(E || (E = {})); -var F; -(function (F) { - F[F["A"] = 0] = "A"; -})(F || (F = {})); -function foo3(x, a, b) { - var r; - return r; -} -var r7 = foo3(0 /* A */, function (x) { return 0 /* A */; }, function (x) { return 0 /* A */; }); // error +var onlyT; +(function (onlyT) { + function foo(a, b) { + var r; + return r; + } + var r1 = foo(function (x) { return 1; }, function (x) { return ''; }); + function other2(x) { + var r7 = foo(function (a) { return a; }, function (b) { return b; }); // T => T + // BUG 835518 + var r9 = r7(new Date()); // should be ok + var r10 = r7(1); // error + } + function foo2(a, b) { + var r; + return r; + } + function other3(x) { + var r7 = foo2(function (a) { return a; }, function (b) { return b; }); // error + var r7b = foo2(function (a) { return a; }, function (b) { return b; }); // valid, T is inferred to be Date + } + var E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E || (E = {})); + var F; + (function (F) { + F[F["A"] = 0] = "A"; + })(F || (F = {})); + function foo3(x, a, b) { + var r; + return r; + } + var r7 = foo3(0 /* A */, function (x) { return 0 /* A */; }, function (x) { return 0 /* A */; }); // error +})(onlyT || (onlyT = {})); +var TU; +(function (TU) { + function foo(a, b) { + var r; + return r; + } + var r1 = foo(function (x) { return 1; }, function (x) { return ''; }); + function other2(x) { + var r7 = foo(function (a) { return a; }, function (b) { return b; }); + var r9 = r7(new Date()); + var r10 = r7(1); + } + function foo2(a, b) { + var r; + return r; + } + function other3(x) { + var r7 = foo2(function (a) { return a; }, function (b) { return b; }); + var r7b = foo2(function (a) { return a; }, function (b) { return b; }); + } + var E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E || (E = {})); + var F; + (function (F) { + F[F["A"] = 0] = "A"; + })(F || (F = {})); + function foo3(x, a, b) { + var r; + return r; + } + var r7 = foo3(0 /* A */, function (x) { return 0 /* A */; }, function (x) { return 0 /* A */; }); +})(TU || (TU = {})); diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt new file mode 100644 index 00000000000..0a42d940625 --- /dev/null +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt @@ -0,0 +1,42 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(32,11): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(33,11): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts (2 errors) ==== + // When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, + // the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. + + function foo(x: T, a: (x: T) => T, b: (x: T) => T) { + var r: (x: T) => T; + return r; + } + + var r1 = foo('', (x: string) => '', (x: Object) => null); // any => any + var r1ii = foo('', (x) => '', (x) => null); // string => string + var r2 = foo('', (x: string) => '', (x: Object) => ''); // string => string + var r3 = foo(null, (x: Object) => '', (x: string) => ''); // Object => Object + var r4 = foo(null, (x) => '', (x) => ''); // any => any + var r5 = foo(new Object(), (x) => '', (x) => ''); // Object => Object + + enum E { A } + enum F { A } + + var r6 = foo(E.A, (x: number) => E.A, (x: F) => F.A); // number => number + + + function foo2(x: T, a: (x: T) => U, b: (x: T) => U) { + var r: (x: T) => U; + return r; + } + + var r8 = foo2('', (x) => '', (x) => null); // string => string + var r9 = foo2(null, (x) => '', (x) => ''); // any => any + var r10 = foo2(null, (x: Object) => '', (x: string) => ''); // Object => Object + + var x: (a: string) => boolean; + var r11 = foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2); // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.js b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.js index 8ffb4f9970b..ca28878daa3 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.js +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.js @@ -30,8 +30,8 @@ var r9 = foo2(null, (x) => '', (x) => ''); // any => any var r10 = foo2(null, (x: Object) => '', (x: string) => ''); // Object => Object var x: (a: string) => boolean; -var r11 = foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2); // {} => {} -var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // (string => boolean) => {} +var r11 = foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2); // error +var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // error //// [genericCallWithGenericSignatureArguments3.js] // When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, @@ -63,5 +63,5 @@ var r8 = foo2('', function (x) { return ''; }, function (x) { return null; }); / var r9 = foo2(null, function (x) { return ''; }, function (x) { return ''; }); // any => any var r10 = foo2(null, function (x) { return ''; }, function (x) { return ''; }); // Object => Object var x; -var r11 = foo2(x, function (a1) { return function (n) { return 1; }; }, function (a2) { return 2; }); // {} => {} -var r12 = foo2(x, function (a1) { return function (n) { return 1; }; }, function (a2) { return 2; }); // (string => boolean) => {} +var r11 = foo2(x, function (a1) { return function (n) { return 1; }; }, function (a2) { return 2; }); // error +var r12 = foo2(x, function (a1) { return function (n) { return 1; }; }, function (a2) { return 2; }); // error diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.types b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.types deleted file mode 100644 index 2c0d21a5a07..00000000000 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.types +++ /dev/null @@ -1,202 +0,0 @@ -=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts === -// When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, -// the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. - -function foo(x: T, a: (x: T) => T, b: (x: T) => T) { ->foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->T : T ->x : T ->T : T ->a : (x: T) => T ->x : T ->T : T ->T : T ->b : (x: T) => T ->x : T ->T : T ->T : T - - var r: (x: T) => T; ->r : (x: T) => T ->x : T ->T : T ->T : T - - return r; ->r : (x: T) => T -} - -var r1 = foo('', (x: string) => '', (x: Object) => null); // any => any ->r1 : (x: any) => any ->foo('', (x: string) => '', (x: Object) => null) : (x: any) => any ->foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->(x: string) => '' : (x: string) => string ->x : string ->(x: Object) => null : (x: Object) => any ->x : Object ->Object : Object - -var r1ii = foo('', (x) => '', (x) => null); // string => string ->r1ii : (x: string) => string ->foo('', (x) => '', (x) => null) : (x: string) => string ->foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->(x) => '' : (x: string) => string ->x : string ->(x) => null : (x: string) => any ->x : string - -var r2 = foo('', (x: string) => '', (x: Object) => ''); // string => string ->r2 : (x: Object) => Object ->foo('', (x: string) => '', (x: Object) => '') : (x: Object) => Object ->foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->(x: string) => '' : (x: string) => string ->x : string ->(x: Object) => '' : (x: Object) => string ->x : Object ->Object : Object - -var r3 = foo(null, (x: Object) => '', (x: string) => ''); // Object => Object ->r3 : (x: Object) => Object ->foo(null, (x: Object) => '', (x: string) => '') : (x: Object) => Object ->foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->(x: Object) => '' : (x: Object) => string ->x : Object ->Object : Object ->(x: string) => '' : (x: string) => string ->x : string - -var r4 = foo(null, (x) => '', (x) => ''); // any => any ->r4 : (x: any) => any ->foo(null, (x) => '', (x) => '') : (x: any) => any ->foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->(x) => '' : (x: any) => string ->x : any ->(x) => '' : (x: any) => string ->x : any - -var r5 = foo(new Object(), (x) => '', (x) => ''); // Object => Object ->r5 : (x: Object) => Object ->foo(new Object(), (x) => '', (x) => '') : (x: Object) => Object ->foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->new Object() : Object ->Object : { (): any; (value: any): any; new (value?: any): Object; prototype: Object; getPrototypeOf(o: any): any; getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: any): any; freeze(o: any): any; preventExtensions(o: any): any; isSealed(o: any): boolean; isFrozen(o: any): boolean; isExtensible(o: any): boolean; keys(o: any): string[]; } ->(x) => '' : (x: Object) => string ->x : Object ->(x) => '' : (x: Object) => string ->x : Object - -enum E { A } ->E : E ->A : E - -enum F { A } ->F : F ->A : F - -var r6 = foo(E.A, (x: number) => E.A, (x: F) => F.A); // number => number ->r6 : (x: number) => number ->foo(E.A, (x: number) => E.A, (x: F) => F.A) : (x: number) => number ->foo : (x: T, a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->E.A : E ->E : typeof E ->A : E ->(x: number) => E.A : (x: number) => E ->x : number ->E.A : E ->E : typeof E ->A : E ->(x: F) => F.A : (x: F) => F ->x : F ->F : F ->F.A : F ->F : typeof F ->A : F - - -function foo2(x: T, a: (x: T) => U, b: (x: T) => U) { ->foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U ->T : T ->U : U ->x : T ->T : T ->a : (x: T) => U ->x : T ->T : T ->U : U ->b : (x: T) => U ->x : T ->T : T ->U : U - - var r: (x: T) => U; ->r : (x: T) => U ->x : T ->T : T ->U : U - - return r; ->r : (x: T) => U -} - -var r8 = foo2('', (x) => '', (x) => null); // string => string ->r8 : (x: string) => any ->foo2('', (x) => '', (x) => null) : (x: string) => any ->foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U ->(x) => '' : (x: string) => string ->x : string ->(x) => null : (x: string) => any ->x : string - -var r9 = foo2(null, (x) => '', (x) => ''); // any => any ->r9 : (x: any) => string ->foo2(null, (x) => '', (x) => '') : (x: any) => string ->foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U ->(x) => '' : (x: any) => string ->x : any ->(x) => '' : (x: any) => string ->x : any - -var r10 = foo2(null, (x: Object) => '', (x: string) => ''); // Object => Object ->r10 : (x: Object) => string ->foo2(null, (x: Object) => '', (x: string) => '') : (x: Object) => string ->foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U ->(x: Object) => '' : (x: Object) => string ->x : Object ->Object : Object ->(x: string) => '' : (x: string) => string ->x : string - -var x: (a: string) => boolean; ->x : (a: string) => boolean ->a : string - -var r11 = foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2); // {} => {} ->r11 : (x: {}) => {} ->foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2) : (x: {}) => {} ->foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U ->x : (a: string) => boolean ->(a1: (y: string) => string) => (n: Object) => 1 : (a1: (y: string) => string) => (n: Object) => number ->a1 : (y: string) => string ->y : string ->(n: Object) => 1 : (n: Object) => number ->n : Object ->Object : Object ->(a2: (z: string) => string) => 2 : (a2: (z: string) => string) => number ->a2 : (z: string) => string ->z : string - -var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // (string => boolean) => {} ->r12 : (x: (a: string) => boolean) => {} ->foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2) : (x: (a: string) => boolean) => {} ->foo2 : (x: T, a: (x: T) => U, b: (x: T) => U) => (x: T) => U ->x : (a: string) => boolean ->(a1: (y: string) => boolean) => (n: Object) => 1 : (a1: (y: string) => boolean) => (n: Object) => number ->a1 : (y: string) => boolean ->y : string ->(n: Object) => 1 : (n: Object) => number ->n : Object ->Object : Object ->(a2: (z: string) => boolean) => 2 : (a2: (z: string) => boolean) => number ->a2 : (z: string) => boolean ->z : string - diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt b/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt new file mode 100644 index 00000000000..856f35a57f6 --- /dev/null +++ b/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectLiteralArgs.ts(5,9): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectLiteralArgs.ts (1 errors) ==== + function foo(x: { bar: T; baz: T }) { + return x; + } + + var r = foo({ bar: 1, baz: '' }); // error + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r2 = foo({ bar: 1, baz: 1 }); // T = number + var r3 = foo({ bar: foo, baz: foo }); // T = typeof foo + var r4 = foo({ bar: 1, baz: '' }); // T = Object \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArgs.js b/tests/baselines/reference/genericCallWithObjectLiteralArgs.js index 84a630425be..2515bbef293 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArgs.js +++ b/tests/baselines/reference/genericCallWithObjectLiteralArgs.js @@ -3,7 +3,7 @@ function foo(x: { bar: T; baz: T }) { return x; } -var r = foo({ bar: 1, baz: '' }); // T = {} +var r = foo({ bar: 1, baz: '' }); // error var r2 = foo({ bar: 1, baz: 1 }); // T = number var r3 = foo({ bar: foo, baz: foo }); // T = typeof foo var r4 = foo({ bar: 1, baz: '' }); // T = Object @@ -12,7 +12,7 @@ var r4 = foo({ bar: 1, baz: '' }); // T = Object function foo(x) { return x; } -var r = foo({ bar: 1, baz: '' }); // T = {} +var r = foo({ bar: 1, baz: '' }); // error var r2 = foo({ bar: 1, baz: 1 }); // T = number var r3 = foo({ bar: foo, baz: foo }); // T = typeof foo var r4 = foo({ bar: 1, baz: '' }); // T = Object diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArgs.types b/tests/baselines/reference/genericCallWithObjectLiteralArgs.types deleted file mode 100644 index d23445ecbca..00000000000 --- a/tests/baselines/reference/genericCallWithObjectLiteralArgs.types +++ /dev/null @@ -1,49 +0,0 @@ -=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectLiteralArgs.ts === -function foo(x: { bar: T; baz: T }) { ->foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } ->T : T ->x : { bar: T; baz: T; } ->bar : T ->T : T ->baz : T ->T : T - - return x; ->x : { bar: T; baz: T; } -} - -var r = foo({ bar: 1, baz: '' }); // T = {} ->r : { bar: {}; baz: {}; } ->foo({ bar: 1, baz: '' }) : { bar: {}; baz: {}; } ->foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } ->{ bar: 1, baz: '' } : { bar: number; baz: string; } ->bar : number ->baz : string - -var r2 = foo({ bar: 1, baz: 1 }); // T = number ->r2 : { bar: number; baz: number; } ->foo({ bar: 1, baz: 1 }) : { bar: number; baz: number; } ->foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } ->{ bar: 1, baz: 1 } : { bar: number; baz: number; } ->bar : number ->baz : number - -var r3 = foo({ bar: foo, baz: foo }); // T = typeof foo ->r3 : { bar: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; baz: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; } ->foo({ bar: foo, baz: foo }) : { bar: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; baz: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; } ->foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } ->{ bar: foo, baz: foo } : { bar: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; baz: (x: { bar: T; baz: T; }) => { bar: T; baz: T; }; } ->bar : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } ->foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } ->baz : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } ->foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } - -var r4 = foo({ bar: 1, baz: '' }); // T = Object ->r4 : { bar: Object; baz: Object; } ->foo({ bar: 1, baz: '' }) : { bar: Object; baz: Object; } ->foo : (x: { bar: T; baz: T; }) => { bar: T; baz: T; } ->Object : Object ->{ bar: 1, baz: '' } : { bar: number; baz: string; } ->bar : number ->baz : string - diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt index 9551a712b75..4ac64500bd1 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt @@ -1,24 +1,41 @@ -==== tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts (4 errors) ==== +tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(2,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(4,22): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: number; y: number; }'. + Types of property 'y' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(5,22): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: string; y: string; }'. + Types of property 'x' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(6,22): error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: number; y: number; }'. + Types of property 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(7,22): error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: string; y: string; }'. + Types of property 'y' are incompatible: + Type 'number' is not assignable to type 'string'. + + +==== tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts (5 errors) ==== function foo(n: { x: T; y: T }, m: T) { return m; } var x = foo({ x: 3, y: "" }, 4); // no error, x is Object, the best common type + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. // these are all errors var x2 = foo({ x: 3, y: "" }, 4); ~~~~~~~~~~~~~~~ -!!! Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: number; y: number; }'. -!!! Types of property 'y' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: number; y: number; }'. +!!! error TS2345: Types of property 'y' are incompatible: +!!! error TS2345: Type 'string' is not assignable to type 'number'. var x3 = foo({ x: 3, y: "" }, 4); ~~~~~~~~~~~~~~~ -!!! Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: string; y: string; }'. -!!! Types of property 'x' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: string; y: string; }'. +!!! error TS2345: Types of property 'x' are incompatible: +!!! error TS2345: Type 'number' is not assignable to type 'string'. var x4 = foo({ x: "", y: 4 }, ""); ~~~~~~~~~~~~~~~ -!!! Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: number; y: number; }'. -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: number; y: number; }'. +!!! error TS2345: Types of property 'x' are incompatible: +!!! error TS2345: Type 'string' is not assignable to type 'number'. var x5 = foo({ x: "", y: 4 }, ""); ~~~~~~~~~~~~~~~ -!!! Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: string; y: string; }'. -!!! Types of property 'y' are incompatible: -!!! Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2345: Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: string; y: string; }'. +!!! error TS2345: Types of property 'y' are incompatible: +!!! error TS2345: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt new file mode 100644 index 00000000000..dce9562a8f5 --- /dev/null +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts(20,9): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts (1 errors) ==== + class C { + private x: string; + } + + class D { + private x: string; + } + + class X { + x: T; + } + + function foo(t: X, t2: X) { + var x: T; + return x; + } + + var c1 = new X(); + var d1 = new X(); + var r = foo(c1, d1); // error + ~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r2 = foo(c1, c1); // ok \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs.types b/tests/baselines/reference/genericCallWithObjectTypeArgs.types deleted file mode 100644 index ddbd7d83054..00000000000 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs.types +++ /dev/null @@ -1,68 +0,0 @@ -=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts === -class C { ->C : C - - private x: string; ->x : string -} - -class D { ->D : D - - private x: string; ->x : string -} - -class X { ->X : X ->T : T - - x: T; ->x : T ->T : T -} - -function foo(t: X, t2: X) { ->foo : (t: X, t2: X) => T ->T : T ->t : X ->X : X ->T : T ->t2 : X ->X : X ->T : T - - var x: T; ->x : T ->T : T - - return x; ->x : T -} - -var c1 = new X(); ->c1 : X ->new X() : X ->X : typeof X ->C : C - -var d1 = new X(); ->d1 : X ->new X() : X ->X : typeof X ->D : D - -var r = foo(c1, d1); // error ->r : {} ->foo(c1, d1) : {} ->foo : (t: X, t2: X) => T ->c1 : X ->d1 : X - -var r2 = foo(c1, c1); // ok ->r2 : C ->foo(c1, c1) : C ->foo : (t: X, t2: X) => T ->c1 : X ->c1 : X - diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.types b/tests/baselines/reference/genericCallWithObjectTypeArgs2.types index 0065811fdc1..aa1eeaf4670 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs2.types +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.types @@ -22,7 +22,7 @@ class Derived2 extends Base { // returns {}[] function f(a: { x: T; y: U }) { ->f : (a: { x: T; y: U; }) => {}[] +>f : (a: { x: T; y: U; }) => Array >T : T >Base : Base >U : U @@ -34,7 +34,7 @@ function f(a: { x: T; y: U }) { >U : U return [a.x, a.y]; ->[a.x, a.y] : {}[] +>[a.x, a.y] : Array >a.x : T >a : { x: T; y: U; } >x : T @@ -44,9 +44,9 @@ function f(a: { x: T; y: U }) { } var r = f({ x: new Derived(), y: new Derived2() }); // {}[] ->r : {}[] ->f({ x: new Derived(), y: new Derived2() }) : {}[] ->f : (a: { x: T; y: U; }) => {}[] +>r : Array +>f({ x: new Derived(), y: new Derived2() }) : Array +>f : (a: { x: T; y: U; }) => Array >{ x: new Derived(), y: new Derived2() } : { x: Derived; y: Derived2; } >x : Derived >new Derived() : Derived @@ -56,9 +56,9 @@ var r = f({ x: new Derived(), y: new Derived2() }); // {}[] >Derived2 : typeof Derived2 var r2 = f({ x: new Base(), y: new Derived2() }); // {}[] ->r2 : {}[] ->f({ x: new Base(), y: new Derived2() }) : {}[] ->f : (a: { x: T; y: U; }) => {}[] +>r2 : Base[] +>f({ x: new Base(), y: new Derived2() }) : Array +>f : (a: { x: T; y: U; }) => Array >{ x: new Base(), y: new Derived2() } : { x: Base; y: Derived2; } >x : Base >new Base() : Base diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt index 6ac5e2234ef..9cb190ddecd 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt @@ -1,4 +1,8 @@ -==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts (1 errors) ==== +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(18,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(20,29): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts (2 errors) ==== // Generic call with constraints infering type parameter from object member properties class Base { @@ -17,10 +21,12 @@ } var r1 = f({ x: new Derived(), y: new Derived2() }); // ok, both extend Base + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. function f2(a: U) { ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var r: T; return r; } diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt index 4d306264e7d..5f416bb8596 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts(12,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts(28,19): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts(30,24): error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. + + ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts (3 errors) ==== // Generic call with constraints infering type parameter from object member properties @@ -12,7 +17,7 @@ function foo(t: T, t2: U) { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. return (x: T) => t2; } @@ -30,11 +35,11 @@ function other() { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var r4 = foo(c, d); var r5 = foo(c, d); // error ~ -!!! Argument of type 'C' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt index 1b619f5ce7a..887abfaff63 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts(12,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts(21,19): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts(22,24): error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. + + ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts (3 errors) ==== // Generic call with constraints infering type parameter from object member properties @@ -12,7 +17,7 @@ function foo(t: T, t2: U) { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. return (x: T) => t2; } @@ -23,9 +28,9 @@ function other() { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var r5 = foo(c, d); // error ~ -!!! Argument of type 'C' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.errors.txt index 3df159e7ce0..ec1f654863f 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndIndexersErrors.ts(15,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndIndexersErrors.ts(18,9): error TS2413: Numeric index type 'T' is not assignable to string index type 'Object'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndIndexersErrors.ts(23,9): error TS2323: Type 'T' is not assignable to type 'U'. + + ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndIndexersErrors.ts (3 errors) ==== // Type inference infers from indexers in target type, error cases @@ -15,17 +20,17 @@ function other3(arg: T) { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var b: { [x: string]: Object; [x: number]: T; ~~~~~~~~~~~~~~~ -!!! Numeric index type 'T' is not assignable to string index type 'Object'. +!!! error TS2413: Numeric index type 'T' is not assignable to string index type 'Object'. }; var r2 = foo(b); var d = r2[1]; var e = r2['1']; var u: U = r2[1]; // ok ~ -!!! Type 'T' is not assignable to type 'U'. +!!! error TS2323: Type 'T' is not assignable to type 'U'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt index 880e0895c32..45a64e62e5e 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt @@ -1,3 +1,16 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2323: Type 'number' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(6,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(6,37): error TS2323: Type 'T' is not assignable to type 'U'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(7,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(7,37): error TS2323: Type 'U' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(8,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(8,31): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(8,56): error TS2323: Type 'U' is not assignable to type 'V'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(9,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(9,31): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(9,50): error TS2323: Type 'V' is not assignable to type 'U'. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts (11 errors) ==== // Generic typed parameters with initializers @@ -5,28 +18,28 @@ function foo2(x: T = undefined) { return x; } // ok function foo3(x: T = 1) { } // error ~~~~~~~~ -!!! Type 'number' is not assignable to type 'T'. +!!! error TS2323: Type 'number' is not assignable to type 'T'. function foo4(x: T, y: U = x) { } // error ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~ -!!! Type 'T' is not assignable to type 'U'. +!!! error TS2323: Type 'T' is not assignable to type 'U'. function foo5(x: U, y: T = x) { } // ok ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~ -!!! Type 'U' is not assignable to type 'T'. +!!! error TS2323: Type 'U' is not assignable to type 'T'. function foo6(x: T, y: U, z: V = y) { } // error ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~ -!!! Type 'U' is not assignable to type 'V'. +!!! error TS2323: Type 'U' is not assignable to type 'V'. function foo7(x: V, y: U = x) { } // should be ok ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~ -!!! Type 'V' is not assignable to type 'U'. \ No newline at end of file +!!! error TS2323: Type 'V' is not assignable to type 'U'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt new file mode 100644 index 00000000000..3ddb094970a --- /dev/null +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt @@ -0,0 +1,54 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments.ts(36,14): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments.ts (1 errors) ==== + // Function typed arguments with multiple signatures must be passed an implementation that matches all of them + // Inferences are made quadratic-pairwise to and from these overload sets + + module NonGenericParameter { + var a: { + new(x: boolean): boolean; + new(x: string): string; + } + + function foo4(cb: typeof a) { + return new cb(null); + } + + var r = foo4(a); + var b: { new (x: T): T }; + var r2 = foo4(b); + } + + module GenericParameter { + function foo5(cb: { new(x: T): string; new(x: number): T }) { + return cb; + } + + var a: { + new (x: boolean): string; + new (x: number): boolean; + } + var r5 = foo5(a); // new{} => string; new(x:number) => {} + var b: { new(x: T): string; new(x: number): T; } + var r7 = foo5(b); // new any => string; new(x:number) => any + + function foo6(cb: { new(x: T): string; new(x: T, y?: T): string }) { + return cb; + } + + var r8 = foo6(a); // error + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r9 = foo6(b); // new any => string; new(x:any, y?:any) => string + + function foo7(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) { + return cb; + } + + var r13 = foo7(1, b); // new any => string; new(x:any, y?:any) => string + var c: { new (x: T): string; (x: number): T; } + var c2: { new (x: T): string; new(x: number): T; } + var r14 = foo7(1, c); // new any => string; new(x:any, y?:any) => string + var r15 = foo7(1, c2); // new any => string; new(x:any, y?:any) => string + } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.js b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.js index 9da34ebad86..4f74b043bd9 100644 --- a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.js +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.js @@ -34,7 +34,7 @@ module GenericParameter { return cb; } - var r8 = foo6(a); // new{} => string; new(x:{}, y?:{}) => string + var r8 = foo6(a); // error var r9 = foo6(b); // new any => string; new(x:any, y?:any) => string function foo7(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) { @@ -73,7 +73,7 @@ var GenericParameter; function foo6(cb) { return cb; } - var r8 = foo6(a); // new{} => string; new(x:{}, y?:{}) => string + var r8 = foo6(a); // error var r9 = foo6(b); // new any => string; new(x:any, y?:any) => string function foo7(x, cb) { return cb; diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types deleted file mode 100644 index 6c16ad0259c..00000000000 --- a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types +++ /dev/null @@ -1,173 +0,0 @@ -=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments.ts === -// Function typed arguments with multiple signatures must be passed an implementation that matches all of them -// Inferences are made quadratic-pairwise to and from these overload sets - -module NonGenericParameter { ->NonGenericParameter : typeof NonGenericParameter - - var a: { ->a : { new (x: boolean): boolean; new (x: string): string; } - - new(x: boolean): boolean; ->x : boolean - - new(x: string): string; ->x : string - } - - function foo4(cb: typeof a) { ->foo4 : (cb: { new (x: boolean): boolean; new (x: string): string; }) => boolean ->cb : { new (x: boolean): boolean; new (x: string): string; } ->a : { new (x: boolean): boolean; new (x: string): string; } - - return new cb(null); ->new cb(null) : boolean ->cb : { new (x: boolean): boolean; new (x: string): string; } - } - - var r = foo4(a); ->r : boolean ->foo4(a) : boolean ->foo4 : (cb: { new (x: boolean): boolean; new (x: string): string; }) => boolean ->a : { new (x: boolean): boolean; new (x: string): string; } - - var b: { new (x: T): T }; ->b : new (x: T) => T ->T : T ->x : T ->T : T ->T : T - - var r2 = foo4(b); ->r2 : boolean ->foo4(b) : boolean ->foo4 : (cb: { new (x: boolean): boolean; new (x: string): string; }) => boolean ->b : new (x: T) => T -} - -module GenericParameter { ->GenericParameter : typeof GenericParameter - - function foo5(cb: { new(x: T): string; new(x: number): T }) { ->foo5 : (cb: { new (x: T): string; new (x: number): T; }) => { new (x: T): string; new (x: number): T; } ->T : T ->cb : { new (x: T): string; new (x: number): T; } ->x : T ->T : T ->x : number ->T : T - - return cb; ->cb : { new (x: T): string; new (x: number): T; } - } - - var a: { ->a : { new (x: boolean): string; new (x: number): boolean; } - - new (x: boolean): string; ->x : boolean - - new (x: number): boolean; ->x : number - } - var r5 = foo5(a); // new{} => string; new(x:number) => {} ->r5 : { new (x: boolean): string; new (x: number): boolean; } ->foo5(a) : { new (x: boolean): string; new (x: number): boolean; } ->foo5 : (cb: { new (x: T): string; new (x: number): T; }) => { new (x: T): string; new (x: number): T; } ->a : { new (x: boolean): string; new (x: number): boolean; } - - var b: { new(x: T): string; new(x: number): T; } ->b : { new (x: T): string; new (x: number): T; } ->T : T ->x : T ->T : T ->T : T ->x : number ->T : T - - var r7 = foo5(b); // new any => string; new(x:number) => any ->r7 : { new (x: any): string; new (x: number): any; } ->foo5(b) : { new (x: any): string; new (x: number): any; } ->foo5 : (cb: { new (x: T): string; new (x: number): T; }) => { new (x: T): string; new (x: number): T; } ->b : { new (x: T): string; new (x: number): T; } - - function foo6(cb: { new(x: T): string; new(x: T, y?: T): string }) { ->foo6 : (cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } ->T : T ->cb : { new (x: T): string; new (x: T, y?: T): string; } ->x : T ->T : T ->x : T ->T : T ->y : T ->T : T - - return cb; ->cb : { new (x: T): string; new (x: T, y?: T): string; } - } - - var r8 = foo6(a); // new{} => string; new(x:{}, y?:{}) => string ->r8 : { new (x: {}): string; new (x: {}, y?: {}): string; } ->foo6(a) : { new (x: {}): string; new (x: {}, y?: {}): string; } ->foo6 : (cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } ->a : { new (x: boolean): string; new (x: number): boolean; } - - var r9 = foo6(b); // new any => string; new(x:any, y?:any) => string ->r9 : { new (x: any): string; new (x: any, y?: any): string; } ->foo6(b) : { new (x: any): string; new (x: any, y?: any): string; } ->foo6 : (cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } ->b : { new (x: T): string; new (x: number): T; } - - function foo7(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) { ->foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } ->T : T ->x : T ->T : T ->cb : { new (x: T): string; new (x: T, y?: T): string; } ->x : T ->T : T ->x : T ->T : T ->y : T ->T : T - - return cb; ->cb : { new (x: T): string; new (x: T, y?: T): string; } - } - - var r13 = foo7(1, b); // new any => string; new(x:any, y?:any) => string ->r13 : { new (x: any): string; new (x: any, y?: any): string; } ->foo7(1, b) : { new (x: any): string; new (x: any, y?: any): string; } ->foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } ->b : { new (x: T): string; new (x: number): T; } - - var c: { new (x: T): string; (x: number): T; } ->c : { (x: number): T; new (x: T): string; } ->T : T ->x : T ->T : T ->T : T ->x : number ->T : T - - var c2: { new (x: T): string; new(x: number): T; } ->c2 : { new (x: T): string; new (x: number): T; } ->T : T ->x : T ->T : T ->T : T ->x : number ->T : T - - var r14 = foo7(1, c); // new any => string; new(x:any, y?:any) => string ->r14 : { new (x: any): string; new (x: any, y?: any): string; } ->foo7(1, c) : { new (x: any): string; new (x: any, y?: any): string; } ->foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } ->c : { (x: number): T; new (x: T): string; } - - var r15 = foo7(1, c2); // new any => string; new(x:any, y?:any) => string ->r15 : { new (x: any): string; new (x: any, y?: any): string; } ->foo7(1, c2) : { new (x: any): string; new (x: any, y?: any): string; } ->foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } ->c2 : { new (x: T): string; new (x: number): T; } -} diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt index 04756285abf..80bcf12494a 100644 --- a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments2.ts(31,20): error TS2345: Argument of type 'new (x: T, y: T) => string' is not assignable to parameter of type '{ new (x: any): string; new (x: any, y?: any): string; }'. + + ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments2.ts (1 errors) ==== // Function typed arguments with multiple signatures must be passed an implementation that matches all of them // Inferences are made quadratic-pairwise to and from these overload sets @@ -31,7 +34,7 @@ var b: { new (x: T, y: T): string }; var r10 = foo6(b); // error ~ -!!! Argument of type 'new (x: T, y: T) => string' is not assignable to parameter of type '{ new (x: any): string; new (x: any, y?: any): string; }'. +!!! error TS2345: Argument of type 'new (x: T, y: T) => string' is not assignable to parameter of type '{ new (x: any): string; new (x: any, y?: any): string; }'. function foo7(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) { return cb; diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt index 7028f0cf38e..32fe6a09344 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedFunctionTypedArguments2.ts(28,20): error TS2345: Argument of type '(x: T, y: T) => string' is not assignable to parameter of type '{ (x: any): string; (x: any, y?: any): string; }'. + + ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedFunctionTypedArguments2.ts (1 errors) ==== // Function typed arguments with multiple signatures must be passed an implementation that matches all of them // Inferences are made quadratic-pairwise to and from these overload sets @@ -28,7 +31,7 @@ var r10 = foo6((x: T, y: T) => ''); // error ~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '(x: T, y: T) => string' is not assignable to parameter of type '{ (x: any): string; (x: any, y?: any): string; }'. +!!! error TS2345: Argument of type '(x: T, y: T) => string' is not assignable to parameter of type '{ (x: any): string; (x: any, y?: any): string; }'. function foo7(x:T, cb: { (x: T): string; (x: T, y?: T): string }) { return cb; diff --git a/tests/baselines/reference/genericCallWithTupleType.errors.txt b/tests/baselines/reference/genericCallWithTupleType.errors.txt new file mode 100644 index 00000000000..abfe5087131 --- /dev/null +++ b/tests/baselines/reference/genericCallWithTupleType.errors.txt @@ -0,0 +1,65 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(12,1): error TS2322: Type '[string, number, boolean, boolean]' is not assignable to type '[string, number]': + Types of property 'pop' are incompatible: + Type '() => string | number | boolean' is not assignable to type '() => string | number': + Type 'string | number | boolean' is not assignable to type 'string | number': + Type 'boolean' is not assignable to type 'string | number': + Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(14,1): error TS2322: Type '{ a: string; }' is not assignable to type 'string | number': + Type '{ a: string; }' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,1): error TS2322: Type '[number, string]' is not assignable to type '[string, number]': + Types of property '0' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]': + Types of property '0' are incompatible: + Type '{}' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(24,1): error TS2322: Type '[{}]' is not assignable to type '[{}, {}]': + Property '1' is missing in type '[{}]'. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (5 errors) ==== + interface I { + tuple1: [T, U]; + } + + var i1: I; + var i2: I<{}, {}>; + + // no error + i1.tuple1 = ["foo", 5]; + var e1 = i1.tuple1[0]; // string + var e2 = i1.tuple1[1]; // number + i1.tuple1 = ["foo", 5, false, true]; + ~~~~~~~~~ +!!! error TS2322: Type '[string, number, boolean, boolean]' is not assignable to type '[string, number]': +!!! error TS2322: Types of property 'pop' are incompatible: +!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => string | number': +!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'string | number': +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number': +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. + var e3 = i1.tuple1[2]; // {} + i1.tuple1[3] = { a: "string" }; + ~~~~~~~~~~~~ +!!! error TS2322: Type '{ a: string; }' is not assignable to type 'string | number': +!!! error TS2322: Type '{ a: string; }' is not assignable to type 'number'. + var e4 = i1.tuple1[3]; // {} + i2.tuple1 = ["foo", 5]; + i2.tuple1 = ["foo", "bar"]; + i2.tuple1 = [5, "bar"]; + i2.tuple1 = [{}, {}]; + + // error + i1.tuple1 = [5, "foo"]; + ~~~~~~~~~ +!!! error TS2322: Type '[number, string]' is not assignable to type '[string, number]': +!!! error TS2322: Types of property '0' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. + i1.tuple1 = [{}, {}]; + ~~~~~~~~~ +!!! error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]': +!!! error TS2322: Types of property '0' are incompatible: +!!! error TS2322: Type '{}' is not assignable to type 'string'. + i2.tuple1 = [{}]; + ~~~~~~~~~ +!!! error TS2322: Type '[{}]' is not assignable to type '[{}, {}]': +!!! error TS2322: Property '1' is missing in type '[{}]'. + \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithTupleType.js b/tests/baselines/reference/genericCallWithTupleType.js new file mode 100644 index 00000000000..296a6dad63b --- /dev/null +++ b/tests/baselines/reference/genericCallWithTupleType.js @@ -0,0 +1,46 @@ +//// [genericCallWithTupleType.ts] +interface I { + tuple1: [T, U]; +} + +var i1: I; +var i2: I<{}, {}>; + +// no error +i1.tuple1 = ["foo", 5]; +var e1 = i1.tuple1[0]; // string +var e2 = i1.tuple1[1]; // number +i1.tuple1 = ["foo", 5, false, true]; +var e3 = i1.tuple1[2]; // {} +i1.tuple1[3] = { a: "string" }; +var e4 = i1.tuple1[3]; // {} +i2.tuple1 = ["foo", 5]; +i2.tuple1 = ["foo", "bar"]; +i2.tuple1 = [5, "bar"]; +i2.tuple1 = [{}, {}]; + +// error +i1.tuple1 = [5, "foo"]; +i1.tuple1 = [{}, {}]; +i2.tuple1 = [{}]; + + +//// [genericCallWithTupleType.js] +var i1; +var i2; +// no error +i1.tuple1 = ["foo", 5]; +var e1 = i1.tuple1[0]; // string +var e2 = i1.tuple1[1]; // number +i1.tuple1 = ["foo", 5, false, true]; +var e3 = i1.tuple1[2]; // {} +i1.tuple1[3] = { a: "string" }; +var e4 = i1.tuple1[3]; // {} +i2.tuple1 = ["foo", 5]; +i2.tuple1 = ["foo", "bar"]; +i2.tuple1 = [5, "bar"]; +i2.tuple1 = [{}, {}]; +// error +i1.tuple1 = [5, "foo"]; +i1.tuple1 = [{}, {}]; +i2.tuple1 = [{}]; diff --git a/tests/baselines/reference/genericCallWithoutArgs.errors.txt b/tests/baselines/reference/genericCallWithoutArgs.errors.txt index 5756cc000d2..390fad31389 100644 --- a/tests/baselines/reference/genericCallWithoutArgs.errors.txt +++ b/tests/baselines/reference/genericCallWithoutArgs.errors.txt @@ -1,13 +1,19 @@ +tests/cases/compiler/genericCallWithoutArgs.ts(4,17): error TS1109: Expression expected. +tests/cases/compiler/genericCallWithoutArgs.ts(4,18): error TS1003: Identifier expected. +tests/cases/compiler/genericCallWithoutArgs.ts(4,3): error TS2304: Cannot find name 'number'. +tests/cases/compiler/genericCallWithoutArgs.ts(4,10): error TS2304: Cannot find name 'string'. + + ==== tests/cases/compiler/genericCallWithoutArgs.ts (4 errors) ==== function f(x: X, y: Y) { } f. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. -!!! Identifier expected. +!!! error TS1003: Identifier expected. ~~~~~~ -!!! Cannot find name 'number'. +!!! error TS2304: Cannot find name 'number'. ~~~~~~ -!!! Cannot find name 'string'. \ No newline at end of file +!!! error TS2304: Cannot find name 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt index ca5fd616422..af5d92f4e3c 100644 --- a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt +++ b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt @@ -1,33 +1,43 @@ +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,14): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,14): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,15): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(9,15): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(12,17): error TS2345: Argument of type 'U' is not assignable to parameter of type 'T'. +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(13,15): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,15): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts (8 errors) ==== function foo(x:T, y:U, f: (v: T) => U) { var r1 = f(1); ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r2 = f(1); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. var r3 = f(null); ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r4 = f(null); var r11 = f(x); var r21 = f(x); ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r31 = f(null); ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r41 = f(null); var r12 = f(y); ~ -!!! Argument of type 'U' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type 'U' is not assignable to parameter of type 'T'. var r22 = f(y); ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r32 = f(null); ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r42 = f(null); } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallsWithoutParens.errors.txt b/tests/baselines/reference/genericCallsWithoutParens.errors.txt index bfce0d2bf22..aba66ed545f 100644 --- a/tests/baselines/reference/genericCallsWithoutParens.errors.txt +++ b/tests/baselines/reference/genericCallsWithoutParens.errors.txt @@ -1,18 +1,24 @@ +tests/cases/compiler/genericCallsWithoutParens.ts(2,18): error TS1109: Expression expected. +tests/cases/compiler/genericCallsWithoutParens.ts(7,22): error TS1109: Expression expected. +tests/cases/compiler/genericCallsWithoutParens.ts(2,11): error TS2304: Cannot find name 'number'. +tests/cases/compiler/genericCallsWithoutParens.ts(7,15): error TS2304: Cannot find name 'number'. + + ==== tests/cases/compiler/genericCallsWithoutParens.ts (4 errors) ==== function f() { } var r = f; // parse error ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~~ -!!! Cannot find name 'number'. +!!! error TS2304: Cannot find name 'number'. class C { foo: T; } var c = new C; // parse error ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~~ -!!! Cannot find name 'number'. +!!! error TS2304: Cannot find name 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericChainedCalls.errors.txt b/tests/baselines/reference/genericChainedCalls.errors.txt index 96ef5a3340f..6d8a3e6831c 100644 --- a/tests/baselines/reference/genericChainedCalls.errors.txt +++ b/tests/baselines/reference/genericChainedCalls.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/genericChainedCalls.ts(8,29): error TS2339: Property 'length' does not exist on type 'number'. +tests/cases/compiler/genericChainedCalls.ts(12,29): error TS2339: Property 'length' does not exist on type 'number'. + + ==== tests/cases/compiler/genericChainedCalls.ts (2 errors) ==== interface I1 { func(callback: (value: T) => U): I1; @@ -8,12 +12,12 @@ var r1 = v1.func(num => num.toString()) .func(str => str.length) // error, number doesn't have a length ~~~~~~ -!!! Property 'length' does not exist on type 'number'. +!!! error TS2339: Property 'length' does not exist on type 'number'. .func(num => num.toString()) var s1 = v1.func(num => num.toString()) var s2 = s1.func(str => str.length) // should also error ~~~~~~ -!!! Property 'length' does not exist on type 'number'. +!!! error TS2339: Property 'length' does not exist on type 'number'. var s3 = s2.func(num => num.toString()) \ No newline at end of file diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt new file mode 100644 index 00000000000..30ed4bc431f --- /dev/null +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -0,0 +1,81 @@ +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,19): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,19): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,20): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. + Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts (4 errors) ==== + // Generic functions used as arguments for function typed parameters are not used to make inferences from + // Using function arguments, no errors expected + + module ImmediatelyFix { + class C { + foo(x: (a: T) => T) { + return x(null); + } + } + + var c = new C(); + var r = c.foo((x: U) => ''); // {} + var r2 = c.foo((x: U) => ''); // string + var r3 = c.foo(x => ''); // {} + + class C2 { + foo(x: (a: T) => T) { + return x(null); + } + } + + var c2 = new C2(); + var ra = c2.foo((x: U) => 1); // number + var r3a = c2.foo(x => 1); // number + } + + module WithCandidates { + class C { + foo2(x: T, cb: (a: T) => U) { + return cb(x); + } + } + + var c: C; + var r4 = c.foo2(1, function (a: Z) { return '' }); // string, contextual signature instantiation is applied to generic functions + var r5 = c.foo2(1, (a) => ''); // string + var r6 = c.foo2('', (a: Z) => 1); // number + + class C2 { + foo3(x: T, cb: (a: T) => U, y: U) { + return cb(x); + } + } + + var c2: C2; + var r7 = c2.foo3(1, (a: Z) => '', ''); // string + var r8 = c2.foo3(1, function (a) { return '' }, ''); // string + + class C3 { + foo3(x: T, cb: (a: T) => U, y: U) { + return cb(x); + } + } + var c3: C3; + + function other(t: T, u: U) { + var r10 = c.foo2(1, (x: T) => ''); // error + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r10 = c.foo2(1, (x) => ''); // string + + var r11 = c3.foo3(1, (x: T) => '', ''); // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r11b = c3.foo3(1, (x: T) => '', 1); // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + var r12 = c3.foo3(1, function (a) { return '' }, 1); // error + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js index 1af5f0ea6e6..7ec25949534 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js @@ -55,12 +55,12 @@ module WithCandidates { var c3: C3; function other(t: T, u: U) { - var r10 = c.foo2(1, (x: T) => ''); // string, non-generic signature allows inferences to be made + var r10 = c.foo2(1, (x: T) => ''); // error var r10 = c.foo2(1, (x) => ''); // string - var r11 = c3.foo3(1, (x: T) => '', ''); // string - var r11b = c3.foo3(1, (x: T) => '', 1); // {} - var r12 = c3.foo3(1, function (a) { return '' }, 1); // {} + var r11 = c3.foo3(1, (x: T) => '', ''); // error + var r11b = c3.foo3(1, (x: T) => '', 1); // error + var r12 = c3.foo3(1, function (a) { return '' }, 1); // error } } @@ -132,12 +132,12 @@ var WithCandidates; })(); var c3; function other(t, u) { - var r10 = c.foo2(1, function (x) { return ''; }); // string, non-generic signature allows inferences to be made + var r10 = c.foo2(1, function (x) { return ''; }); // error var r10 = c.foo2(1, function (x) { return ''; }); // string - var r11 = c3.foo3(1, function (x) { return ''; }, ''); // string - var r11b = c3.foo3(1, function (x) { return ''; }, 1); // {} + var r11 = c3.foo3(1, function (x) { return ''; }, ''); // error + var r11b = c3.foo3(1, function (x) { return ''; }, 1); // error var r12 = c3.foo3(1, function (a) { return ''; - }, 1); // {} + }, 1); // error } })(WithCandidates || (WithCandidates = {})); diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types deleted file mode 100644 index 68b94d81d02..00000000000 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types +++ /dev/null @@ -1,297 +0,0 @@ -=== tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts === -// Generic functions used as arguments for function typed parameters are not used to make inferences from -// Using function arguments, no errors expected - -module ImmediatelyFix { ->ImmediatelyFix : typeof ImmediatelyFix - - class C { ->C : C ->T : T - - foo(x: (a: T) => T) { ->foo : (x: (a: T) => T) => T ->T : T ->x : (a: T) => T ->a : T ->T : T ->T : T - - return x(null); ->x(null) : T ->x : (a: T) => T - } - } - - var c = new C(); ->c : C ->new C() : C ->C : typeof C - - var r = c.foo((x: U) => ''); // {} ->r : {} ->c.foo((x: U) => '') : {} ->c.foo : (x: (a: T) => T) => T ->c : C ->foo : (x: (a: T) => T) => T ->(x: U) => '' : (x: U) => string ->U : U ->x : U ->U : U - - var r2 = c.foo((x: U) => ''); // string ->r2 : string ->c.foo((x: U) => '') : string ->c.foo : (x: (a: T) => T) => T ->c : C ->foo : (x: (a: T) => T) => T ->(x: U) => '' : (x: U) => string ->U : U ->x : U ->U : U - - var r3 = c.foo(x => ''); // {} ->r3 : {} ->c.foo(x => '') : {} ->c.foo : (x: (a: T) => T) => T ->c : C ->foo : (x: (a: T) => T) => T ->x => '' : (x: {}) => string ->x : {} - - class C2 { ->C2 : C2 ->T : T - - foo(x: (a: T) => T) { ->foo : (x: (a: T) => T) => T ->x : (a: T) => T ->a : T ->T : T ->T : T - - return x(null); ->x(null) : T ->x : (a: T) => T - } - } - - var c2 = new C2(); ->c2 : C2 ->new C2() : C2 ->C2 : typeof C2 - - var ra = c2.foo((x: U) => 1); // number ->ra : number ->c2.foo((x: U) => 1) : number ->c2.foo : (x: (a: number) => number) => number ->c2 : C2 ->foo : (x: (a: number) => number) => number ->(x: U) => 1 : (x: U) => number ->U : U ->x : U ->U : U - - var r3a = c2.foo(x => 1); // number ->r3a : number ->c2.foo(x => 1) : number ->c2.foo : (x: (a: number) => number) => number ->c2 : C2 ->foo : (x: (a: number) => number) => number ->x => 1 : (x: number) => number ->x : number -} - -module WithCandidates { ->WithCandidates : typeof WithCandidates - - class C { ->C : C ->T : T - - foo2(x: T, cb: (a: T) => U) { ->foo2 : (x: T, cb: (a: T) => U) => U ->T : T ->U : U ->x : T ->T : T ->cb : (a: T) => U ->a : T ->T : T ->U : U - - return cb(x); ->cb(x) : U ->cb : (a: T) => U ->x : T - } - } - - var c: C; ->c : C ->C : C - - var r4 = c.foo2(1, function (a: Z) { return '' }); // string, contextual signature instantiation is applied to generic functions ->r4 : string ->c.foo2(1, function (a: Z) { return '' }) : string ->c.foo2 : (x: T, cb: (a: T) => U) => U ->c : C ->foo2 : (x: T, cb: (a: T) => U) => U ->function (a: Z) { return '' } : (a: Z) => string ->Z : Z ->a : Z ->Z : Z - - var r5 = c.foo2(1, (a) => ''); // string ->r5 : string ->c.foo2(1, (a) => '') : string ->c.foo2 : (x: T, cb: (a: T) => U) => U ->c : C ->foo2 : (x: T, cb: (a: T) => U) => U ->(a) => '' : (a: number) => string ->a : number - - var r6 = c.foo2('', (a: Z) => 1); // number ->r6 : number ->c.foo2('', (a: Z) => 1) : number ->c.foo2 : (x: T, cb: (a: T) => U) => U ->c : C ->foo2 : (x: T, cb: (a: T) => U) => U ->(a: Z) => 1 : (a: Z) => number ->Z : Z ->a : Z ->Z : Z - - class C2 { ->C2 : C2 ->T : T ->U : U - - foo3(x: T, cb: (a: T) => U, y: U) { ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->x : T ->T : T ->cb : (a: T) => U ->a : T ->T : T ->U : U ->y : U ->U : U - - return cb(x); ->cb(x) : U ->cb : (a: T) => U ->x : T - } - } - - var c2: C2; ->c2 : C2 ->C2 : C2 - - var r7 = c2.foo3(1, (a: Z) => '', ''); // string ->r7 : string ->c2.foo3(1, (a: Z) => '', '') : string ->c2.foo3 : (x: number, cb: (a: number) => string, y: string) => string ->c2 : C2 ->foo3 : (x: number, cb: (a: number) => string, y: string) => string ->(a: Z) => '' : (a: Z) => string ->Z : Z ->a : Z ->Z : Z - - var r8 = c2.foo3(1, function (a) { return '' }, ''); // string ->r8 : string ->c2.foo3(1, function (a) { return '' }, '') : string ->c2.foo3 : (x: number, cb: (a: number) => string, y: string) => string ->c2 : C2 ->foo3 : (x: number, cb: (a: number) => string, y: string) => string ->function (a) { return '' } : (a: number) => string ->a : number - - class C3 { ->C3 : C3 ->T : T ->U : U - - foo3(x: T, cb: (a: T) => U, y: U) { ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->T : T ->U : U ->x : T ->T : T ->cb : (a: T) => U ->a : T ->T : T ->U : U ->y : U ->U : U - - return cb(x); ->cb(x) : U ->cb : (a: T) => U ->x : T - } - } - var c3: C3; ->c3 : C3 ->C3 : C3 - - function other(t: T, u: U) { ->other : (t: T, u: U) => void ->T : T ->U : U ->t : T ->T : T ->u : U ->U : U - - var r10 = c.foo2(1, (x: T) => ''); // string, non-generic signature allows inferences to be made ->r10 : string ->c.foo2(1, (x: T) => '') : string ->c.foo2 : (x: T, cb: (a: T) => U) => U ->c : C ->foo2 : (x: T, cb: (a: T) => U) => U ->(x: T) => '' : (x: T) => string ->x : T ->T : T - - var r10 = c.foo2(1, (x) => ''); // string ->r10 : string ->c.foo2(1, (x) => '') : string ->c.foo2 : (x: T, cb: (a: T) => U) => U ->c : C ->foo2 : (x: T, cb: (a: T) => U) => U ->(x) => '' : (x: number) => string ->x : number - - var r11 = c3.foo3(1, (x: T) => '', ''); // string ->r11 : string ->c3.foo3(1, (x: T) => '', '') : string ->c3.foo3 : (x: T, cb: (a: T) => U, y: U) => U ->c3 : C3 ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->(x: T) => '' : (x: T) => string ->x : T ->T : T - - var r11b = c3.foo3(1, (x: T) => '', 1); // {} ->r11b : {} ->c3.foo3(1, (x: T) => '', 1) : {} ->c3.foo3 : (x: T, cb: (a: T) => U, y: U) => U ->c3 : C3 ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->(x: T) => '' : (x: T) => string ->x : T ->T : T - - var r12 = c3.foo3(1, function (a) { return '' }, 1); // {} ->r12 : {} ->c3.foo3(1, function (a) { return '' }, 1) : {} ->c3.foo3 : (x: T, cb: (a: T) => U, y: U) => U ->c3 : C3 ->foo3 : (x: T, cb: (a: T) => U, y: U) => U ->function (a) { return '' } : (a: number) => string ->a : number - } -} diff --git a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.errors.txt b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.errors.txt index 588e70eb39e..076a5064bab 100644 --- a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.errors.txt @@ -1,31 +1,40 @@ +tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(3,20): error TS2302: Static members cannot reference class type parameters. +tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(5,15): error TS2302: Static members cannot reference class type parameters. +tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(7,15): error TS2302: Static members cannot reference class type parameters. +tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(9,30): error TS2302: Static members cannot reference class type parameters. +tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(11,29): error TS2302: Static members cannot reference class type parameters. +tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(13,18): error TS2302: Static members cannot reference class type parameters. +tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(13,24): error TS2302: Static members cannot reference class type parameters. + + ==== tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts (7 errors) ==== // Should be error to use 'T' in all declarations within Foo. class Foo { static a = (n: T) => { }; ~ -!!! Static members cannot reference class type parameters. +!!! error TS2302: Static members cannot reference class type parameters. static b: T; ~ -!!! Static members cannot reference class type parameters. +!!! error TS2302: Static members cannot reference class type parameters. static c: T[] = []; ~ -!!! Static members cannot reference class type parameters. +!!! error TS2302: Static members cannot reference class type parameters. static d = false || ((x: T) => x || undefined)(null) ~ -!!! Static members cannot reference class type parameters. +!!! error TS2302: Static members cannot reference class type parameters. static e = function (x: T) { return null; } ~ -!!! Static members cannot reference class type parameters. +!!! error TS2302: Static members cannot reference class type parameters. static f(xs: T[]): T[] { ~ -!!! Static members cannot reference class type parameters. +!!! error TS2302: Static members cannot reference class type parameters. ~ -!!! Static members cannot reference class type parameters. +!!! error TS2302: Static members cannot reference class type parameters. return xs.reverse(); } } diff --git a/tests/baselines/reference/genericClassesRedeclaration.errors.txt b/tests/baselines/reference/genericClassesRedeclaration.errors.txt index 63263f3d6a2..abdea2b052b 100644 --- a/tests/baselines/reference/genericClassesRedeclaration.errors.txt +++ b/tests/baselines/reference/genericClassesRedeclaration.errors.txt @@ -1,4 +1,11 @@ -==== tests/cases/compiler/genericClassesRedeclaration.ts (3 errors) ==== +tests/cases/compiler/genericClassesRedeclaration.ts(16,11): error TS2300: Duplicate identifier 'StringHashTable'. +tests/cases/compiler/genericClassesRedeclaration.ts(29,11): error TS2300: Duplicate identifier 'IdentiferNameHashTable'. +tests/cases/compiler/genericClassesRedeclaration.ts(42,9): error TS2374: Duplicate string index signature. +tests/cases/compiler/genericClassesRedeclaration.ts(55,11): error TS2300: Duplicate identifier 'StringHashTable'. +tests/cases/compiler/genericClassesRedeclaration.ts(68,11): error TS2300: Duplicate identifier 'IdentiferNameHashTable'. + + +==== tests/cases/compiler/genericClassesRedeclaration.ts (5 errors) ==== declare module TypeScript { interface IIndexable { [s: string]: T; @@ -14,50 +21,9 @@ count(): number; lookup(key: string): T; } - class StringHashTable implements IHashTable { - private itemCount; - private table; - public getAllKeys(): string[]; - public add(key: string, data: T): boolean; - public addOrUpdate(key: string, data: T): boolean; - public map(fn: (k: string, value: T, context: any) => void, context: any): void; - public every(fn: (k: string, value: T, context: any) => void, context: any): boolean; - public some(fn: (k: string, value: T, context: any) => void, context: any): boolean; - public count(): number; - public lookup(key: string): T; - public remove(key: string): void; - } - class IdentiferNameHashTable extends StringHashTable { - public getAllKeys(): string[]; - public add(key: string, data: T): boolean; - public addOrUpdate(key: string, data: T): boolean; - public map(fn: (k: string, value: T, context: any) => void, context: any): void; - public every(fn: (k: string, value: T, context: any) => void, context: any): boolean; - public some(fn: (k: string, value: any, context: any) => void, context: any): boolean; - public lookup(key: string): T; - } - } - - declare module TypeScript { - interface IIndexable { - [s: string]: T; - ~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. - } - function createIntrinsicsObject(): IIndexable; - interface IHashTable { - getAllKeys(): string[]; - add(key: string, data: T): boolean; - addOrUpdate(key: string, data: T): boolean; - map(fn: (k: string, value: T, context: any) => void, context: any): void; - every(fn: (k: string, value: T, context: any) => void, context: any): boolean; - some(fn: (k: string, value: T, context: any) => void, context: any): boolean; - count(): number; - lookup(key: string): T; - } class StringHashTable implements IHashTable { ~~~~~~~~~~~~~~~ -!!! Duplicate identifier 'StringHashTable'. +!!! error TS2300: Duplicate identifier 'StringHashTable'. private itemCount; private table; public getAllKeys(): string[]; @@ -72,7 +38,52 @@ } class IdentiferNameHashTable extends StringHashTable { ~~~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate identifier 'IdentiferNameHashTable'. +!!! error TS2300: Duplicate identifier 'IdentiferNameHashTable'. + public getAllKeys(): string[]; + public add(key: string, data: T): boolean; + public addOrUpdate(key: string, data: T): boolean; + public map(fn: (k: string, value: T, context: any) => void, context: any): void; + public every(fn: (k: string, value: T, context: any) => void, context: any): boolean; + public some(fn: (k: string, value: any, context: any) => void, context: any): boolean; + public lookup(key: string): T; + } + } + + declare module TypeScript { + interface IIndexable { + [s: string]: T; + ~~~~~~~~~~~~~~~ +!!! error TS2374: Duplicate string index signature. + } + function createIntrinsicsObject(): IIndexable; + interface IHashTable { + getAllKeys(): string[]; + add(key: string, data: T): boolean; + addOrUpdate(key: string, data: T): boolean; + map(fn: (k: string, value: T, context: any) => void, context: any): void; + every(fn: (k: string, value: T, context: any) => void, context: any): boolean; + some(fn: (k: string, value: T, context: any) => void, context: any): boolean; + count(): number; + lookup(key: string): T; + } + class StringHashTable implements IHashTable { + ~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'StringHashTable'. + private itemCount; + private table; + public getAllKeys(): string[]; + public add(key: string, data: T): boolean; + public addOrUpdate(key: string, data: T): boolean; + public map(fn: (k: string, value: T, context: any) => void, context: any): void; + public every(fn: (k: string, value: T, context: any) => void, context: any): boolean; + public some(fn: (k: string, value: T, context: any) => void, context: any): boolean; + public count(): number; + public lookup(key: string): T; + public remove(key: string): void; + } + class IdentiferNameHashTable extends StringHashTable { + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'IdentiferNameHashTable'. public getAllKeys(): string[]; public add(key: string, data: T): boolean; public addOrUpdate(key: string, data: T): boolean; diff --git a/tests/baselines/reference/genericCloduleInModule2.errors.txt b/tests/baselines/reference/genericCloduleInModule2.errors.txt index 38202cd40e7..6b8ec9012f0 100644 --- a/tests/baselines/reference/genericCloduleInModule2.errors.txt +++ b/tests/baselines/reference/genericCloduleInModule2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/genericCloduleInModule2.ts(14,8): error TS2314: Generic type 'B' requires 1 type argument(s). + + ==== tests/cases/compiler/genericCloduleInModule2.ts (1 errors) ==== module A { export class B { @@ -14,5 +17,5 @@ var b: A.B; ~~~ -!!! Generic type 'B' requires 1 type argument(s). +!!! error TS2314: Generic type 'B' requires 1 type argument(s). b.foo(); \ No newline at end of file diff --git a/tests/baselines/reference/genericCloneReturnTypes.errors.txt b/tests/baselines/reference/genericCloneReturnTypes.errors.txt index f2ba42e0168..37de816704c 100644 --- a/tests/baselines/reference/genericCloneReturnTypes.errors.txt +++ b/tests/baselines/reference/genericCloneReturnTypes.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/genericCloneReturnTypes.ts(25,1): error TS2322: Type 'Bar' is not assignable to type 'Bar': + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/genericCloneReturnTypes.ts (1 errors) ==== class Bar { @@ -25,5 +29,5 @@ b = b2; b = b3; ~ -!!! Type 'Bar' is not assignable to type 'Bar': -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'Bar' is not assignable to type 'Bar': +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCloneReturnTypes2.errors.txt b/tests/baselines/reference/genericCloneReturnTypes2.errors.txt index 06966c7eb23..0d8131871fe 100644 --- a/tests/baselines/reference/genericCloneReturnTypes2.errors.txt +++ b/tests/baselines/reference/genericCloneReturnTypes2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/genericCloneReturnTypes2.ts(15,5): error TS2322: Type 'MyList' is not assignable to type 'MyList': + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/genericCloneReturnTypes2.ts (1 errors) ==== class MyList { public size: number; @@ -15,5 +19,5 @@ var c: MyList = a.clone(); // bug was there was an error on this line var d: MyList = a.clone(); // error ~ -!!! Type 'MyList' is not assignable to type 'MyList': -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'MyList' is not assignable to type 'MyList': +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCombinators2.errors.txt b/tests/baselines/reference/genericCombinators2.errors.txt index aad1732547a..c09ef79b29b 100644 --- a/tests/baselines/reference/genericCombinators2.errors.txt +++ b/tests/baselines/reference/genericCombinators2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/genericCombinators2.ts(15,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. +tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. + + ==== tests/cases/compiler/genericCombinators2.ts (2 errors) ==== interface Collection { length: number; @@ -15,7 +19,7 @@ var rf1 = (x: number, y: string) => { return x.toFixed() }; var r5a = _.map(c2, (x, y) => { return x.toFixed() }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. +!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. var r5b = _.map(c2, rf1); ~~~ -!!! Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. \ No newline at end of file +!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. \ No newline at end of file diff --git a/tests/baselines/reference/genericConstraint1.errors.txt b/tests/baselines/reference/genericConstraint1.errors.txt index fb61d930f8a..1f3f611a866 100644 --- a/tests/baselines/reference/genericConstraint1.errors.txt +++ b/tests/baselines/reference/genericConstraint1.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/genericConstraint1.ts(8,8): error TS2344: Type 'string' does not satisfy the constraint 'number'. + + ==== tests/cases/compiler/genericConstraint1.ts (1 errors) ==== class C { public bar2(x: T, y: U): T { @@ -8,4 +11,4 @@ var x = new C(); x.bar2(2, ""); ~~~~~~ -!!! Type 'string' does not satisfy the constraint 'number'. \ No newline at end of file +!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericConstraint2.errors.txt b/tests/baselines/reference/genericConstraint2.errors.txt index cce6068827d..e8635f24cee 100644 --- a/tests/baselines/reference/genericConstraint2.errors.txt +++ b/tests/baselines/reference/genericConstraint2.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/genericConstraint2.ts(5,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/genericConstraint2.ts(11,7): error TS2421: Class 'ComparableString' incorrectly implements interface 'Comparable': + Property 'comparer' is missing in type 'ComparableString'. +tests/cases/compiler/genericConstraint2.ts(21,17): error TS2343: Type 'ComparableString' does not satisfy the constraint 'Comparable': + Property 'comparer' is missing in type 'ComparableString'. + + ==== tests/cases/compiler/genericConstraint2.ts (3 errors) ==== interface Comparable { comparer(other: T): number; @@ -5,7 +12,7 @@ function compare>(x: T, y: T): number { ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. if (x == null) return y == null ? 0 : -1; if (y == null) return 1; return x.comparer(y); @@ -13,8 +20,8 @@ class ComparableString implements Comparable{ ~~~~~~~~~~~~~~~~ -!!! Class 'ComparableString' incorrectly implements interface 'Comparable': -!!! Property 'comparer' is missing in type 'ComparableString'. +!!! error TS2421: Class 'ComparableString' incorrectly implements interface 'Comparable': +!!! error TS2421: Property 'comparer' is missing in type 'ComparableString'. constructor(public currentValue: string) { } localeCompare(other) { @@ -26,5 +33,5 @@ var b = new ComparableString("b"); var c = compare(a, b); ~~~~~~~~~~~~~~~~ -!!! Type 'ComparableString' does not satisfy the constraint 'Comparable': -!!! Property 'comparer' is missing in type 'ComparableString'. \ No newline at end of file +!!! error TS2343: Type 'ComparableString' does not satisfy the constraint 'Comparable': +!!! error TS2343: Property 'comparer' is missing in type 'ComparableString'. \ No newline at end of file diff --git a/tests/baselines/reference/genericConstraint3.errors.txt b/tests/baselines/reference/genericConstraint3.errors.txt index d7d76b7de6f..525b11504fb 100644 --- a/tests/baselines/reference/genericConstraint3.errors.txt +++ b/tests/baselines/reference/genericConstraint3.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/genericConstraint3.ts(2,16): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/genericConstraint3.ts (1 errors) ==== interface C

{ x: P; } interface A> { x: U; } ~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. interface B extends A<{}, { x: {} }> { } // Should not produce an error \ No newline at end of file diff --git a/tests/baselines/reference/genericConstraintSatisfaction1.errors.txt b/tests/baselines/reference/genericConstraintSatisfaction1.errors.txt index 8b3673de74b..4602e5eb494 100644 --- a/tests/baselines/reference/genericConstraintSatisfaction1.errors.txt +++ b/tests/baselines/reference/genericConstraintSatisfaction1.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/genericConstraintSatisfaction1.ts(6,5): error TS2345: Argument of type '{ s: number; }' is not assignable to parameter of type '{ s: string; }'. + Types of property 's' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/genericConstraintSatisfaction1.ts (1 errors) ==== interface I { f: (x: T) => void @@ -6,7 +11,7 @@ var x: I<{s: string}> x.f({s: 1}) ~~~~~~ -!!! Argument of type '{ s: number; }' is not assignable to parameter of type '{ s: string; }'. -!!! Types of property 's' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2345: Argument of type '{ s: number; }' is not assignable to parameter of type '{ s: string; }'. +!!! error TS2345: Types of property 's' are incompatible: +!!! error TS2345: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericConstructExpressionWithoutArgs.errors.txt b/tests/baselines/reference/genericConstructExpressionWithoutArgs.errors.txt index e1ff11eee92..e89bf106ff4 100644 --- a/tests/baselines/reference/genericConstructExpressionWithoutArgs.errors.txt +++ b/tests/baselines/reference/genericConstructExpressionWithoutArgs.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/genericConstructExpressionWithoutArgs.ts(10,1): error TS1109: Expression expected. +tests/cases/compiler/genericConstructExpressionWithoutArgs.ts(9,16): error TS2304: Cannot find name 'number'. + + ==== tests/cases/compiler/genericConstructExpressionWithoutArgs.ts (2 errors) ==== class B { } var b = new B; // no error @@ -9,7 +13,7 @@ var c = new C // C var c2 = new C // error, type params are actually part of the arg list so you need both ~~~~~~ -!!! Cannot find name 'number'. +!!! error TS2304: Cannot find name 'number'. -!!! Expression expected. \ No newline at end of file +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/genericConstructInvocationWithNoTypeArg.errors.txt b/tests/baselines/reference/genericConstructInvocationWithNoTypeArg.errors.txt index cee2b8583ed..f155140f4dc 100644 --- a/tests/baselines/reference/genericConstructInvocationWithNoTypeArg.errors.txt +++ b/tests/baselines/reference/genericConstructInvocationWithNoTypeArg.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/genericConstructInvocationWithNoTypeArg.ts(4,27): error TS2304: Cannot find name 'Foo'. + + ==== tests/cases/compiler/genericConstructInvocationWithNoTypeArg.ts (1 errors) ==== interface Foo { new (x: number): Foo; } var f2: Foo = new Foo(3); ~~~ -!!! Cannot find name 'Foo'. +!!! error TS2304: Cannot find name 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/genericConstructorFunction1.errors.txt b/tests/baselines/reference/genericConstructorFunction1.errors.txt index 14ac7d99b31..6f821e863f9 100644 --- a/tests/baselines/reference/genericConstructorFunction1.errors.txt +++ b/tests/baselines/reference/genericConstructorFunction1.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/genericConstructorFunction1.ts(4,5): error TS2348: Value of type 'new (arg: T) => Date' is not callable. Did you mean to include 'new'? +tests/cases/compiler/genericConstructorFunction1.ts(13,13): error TS2348: Value of type 'I1' is not callable. Did you mean to include 'new'? + + ==== tests/cases/compiler/genericConstructorFunction1.ts (2 errors) ==== function f1(args: T) { var v1: { [index: string]: new (arg: T) => Date }; var v2 = v1['test']; v2(args); ~~~~~~~~ -!!! Value of type 'new (arg: T) => Date' is not callable. Did you mean to include 'new'? +!!! error TS2348: Value of type 'new (arg: T) => Date' is not callable. Did you mean to include 'new'? return new v2(args); // used to give error } @@ -15,6 +19,6 @@ var v2 = v1['test']; var y = v2(args); ~~~~~~~~ -!!! Value of type 'I1' is not callable. Did you mean to include 'new'? +!!! error TS2348: Value of type 'I1' is not callable. Did you mean to include 'new'? return new v2(args); // used to give error } \ No newline at end of file diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.errors.txt b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.errors.txt index 97da05bd69b..e08cc405426 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.errors.txt +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/genericDerivedTypeWithSpecializedBase.ts(11,1): error TS2322: Type 'B' is not assignable to type 'A': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/genericDerivedTypeWithSpecializedBase.ts (1 errors) ==== class A { x: T; @@ -11,7 +16,7 @@ var y: B; x = y; // error ~ -!!! Type 'B' is not assignable to type 'A': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'B' is not assignable to type 'A': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.errors.txt b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.errors.txt index 74cb9d29c11..bcb406447a4 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.errors.txt +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/genericDerivedTypeWithSpecializedBase2.ts(11,1): error TS2322: Type 'B' is not assignable to type 'A<{ length: number; foo: number; }>': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type '{ length: number; foo: number; }': + Property 'foo' is missing in type 'String'. + + ==== tests/cases/compiler/genericDerivedTypeWithSpecializedBase2.ts (1 errors) ==== class A { x: T; @@ -11,8 +17,8 @@ var y: B; x = y; // error ~ -!!! Type 'B' is not assignable to type 'A<{ length: number; foo: number; }>': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type '{ length: number; foo: number; }': -!!! Property 'foo' is missing in type 'String'. +!!! error TS2322: Type 'B' is not assignable to type 'A<{ length: number; foo: number; }>': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type '{ length: number; foo: number; }': +!!! error TS2322: Property 'foo' is missing in type 'String'. \ No newline at end of file diff --git a/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt b/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt index 19c27783c17..a1051e0b020 100644 --- a/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt +++ b/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts(10,1): error TS2304: Cannot find name 'console'. + + ==== tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts (1 errors) ==== interface Array {} @@ -10,5 +13,5 @@ console.log(s); ~~~~~~~ -!!! Cannot find name 'console'. +!!! error TS2304: Cannot find name 'console'. \ No newline at end of file diff --git a/tests/baselines/reference/genericFunctionTypedArgumentsAreFixed.errors.txt b/tests/baselines/reference/genericFunctionTypedArgumentsAreFixed.errors.txt index 0948a26e76b..6884dd7eeb4 100644 --- a/tests/baselines/reference/genericFunctionTypedArgumentsAreFixed.errors.txt +++ b/tests/baselines/reference/genericFunctionTypedArgumentsAreFixed.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/genericFunctionTypedArgumentsAreFixed.ts(2,14): error TS2339: Property 'length' does not exist on type 'number'. + + ==== tests/cases/compiler/genericFunctionTypedArgumentsAreFixed.ts (1 errors) ==== declare function map(f: (x: T) => U, xs: T[]): U[]; map((a) => a.length, [1]); ~~~~~~ -!!! Property 'length' does not exist on type 'number'. \ No newline at end of file +!!! error TS2339: Property 'length' does not exist on type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt b/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt index 8cc016566d9..5b9ed348583 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts (1 errors) ==== interface Utils { fold(c: Array, folder?: (s: S, t: T) => T, init?: S): T; @@ -7,7 +10,7 @@ utils.fold(); // error ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. utils.fold(null); // no error utils.fold(null, null); // no error utils.fold(null, null, null); // error: Unable to invoke type with no call signatures diff --git a/tests/baselines/reference/genericFunduleInModule.errors.txt b/tests/baselines/reference/genericFunduleInModule.errors.txt index 1bc72726712..ca82f7d2425 100644 --- a/tests/baselines/reference/genericFunduleInModule.errors.txt +++ b/tests/baselines/reference/genericFunduleInModule.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/genericFunduleInModule.ts(8,8): error TS2305: Module 'A' has no exported member 'B'. + + ==== tests/cases/compiler/genericFunduleInModule.ts (1 errors) ==== module A { export function B(x: T) { return x; } @@ -8,5 +11,5 @@ var b: A.B; ~~~ -!!! Module 'A' has no exported member 'B'. +!!! error TS2305: Module 'A' has no exported member 'B'. A.B(1); \ No newline at end of file diff --git a/tests/baselines/reference/genericFunduleInModule2.errors.txt b/tests/baselines/reference/genericFunduleInModule2.errors.txt index 306dd66d519..b92b314ece7 100644 --- a/tests/baselines/reference/genericFunduleInModule2.errors.txt +++ b/tests/baselines/reference/genericFunduleInModule2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/genericFunduleInModule2.ts(11,8): error TS2305: Module 'A' has no exported member 'B'. + + ==== tests/cases/compiler/genericFunduleInModule2.ts (1 errors) ==== module A { export function B(x: T) { return x; } @@ -11,5 +14,5 @@ var b: A.B; ~~~ -!!! Module 'A' has no exported member 'B'. +!!! error TS2305: Module 'A' has no exported member 'B'. A.B(1); \ No newline at end of file diff --git a/tests/baselines/reference/genericGetter.errors.txt b/tests/baselines/reference/genericGetter.errors.txt index 84b2a320580..0b39758ad6c 100644 --- a/tests/baselines/reference/genericGetter.errors.txt +++ b/tests/baselines/reference/genericGetter.errors.txt @@ -1,9 +1,13 @@ +tests/cases/compiler/genericGetter.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/genericGetter.ts(9,5): error TS2323: Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/genericGetter.ts (2 errors) ==== class C { data: T; get x(): T { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return this.data; } } @@ -11,4 +15,4 @@ var c = new C(); var r: string = c.x; ~ -!!! Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2323: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericGetter2.errors.txt b/tests/baselines/reference/genericGetter2.errors.txt index 5c30fe0da97..586ae56f606 100644 --- a/tests/baselines/reference/genericGetter2.errors.txt +++ b/tests/baselines/reference/genericGetter2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/genericGetter2.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/genericGetter2.ts(5,14): error TS2314: Generic type 'A' requires 1 type argument(s). + + ==== tests/cases/compiler/genericGetter2.ts (2 errors) ==== class A { } @@ -5,9 +9,9 @@ data: A; get x(): A { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Generic type 'A' requires 1 type argument(s). +!!! error TS2314: Generic type 'A' requires 1 type argument(s). return this.data; } } \ No newline at end of file diff --git a/tests/baselines/reference/genericGetter3.errors.txt b/tests/baselines/reference/genericGetter3.errors.txt index ff1e7d5a1f9..a96a3cf8f5d 100644 --- a/tests/baselines/reference/genericGetter3.errors.txt +++ b/tests/baselines/reference/genericGetter3.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/genericGetter3.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/genericGetter3.ts(11,5): error TS2323: Type 'A' is not assignable to type 'string'. + + ==== tests/cases/compiler/genericGetter3.ts (2 errors) ==== class A { } @@ -5,7 +9,7 @@ data: A; get x(): A { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return this.data; } } @@ -13,4 +17,4 @@ var c = new C(); var r: string = c.x; ~ -!!! Type 'A' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2323: Type 'A' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericInterfacesWithoutTypeArguments.errors.txt b/tests/baselines/reference/genericInterfacesWithoutTypeArguments.errors.txt index 59b4d33a38e..b81230b440d 100644 --- a/tests/baselines/reference/genericInterfacesWithoutTypeArguments.errors.txt +++ b/tests/baselines/reference/genericInterfacesWithoutTypeArguments.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/genericInterfacesWithoutTypeArguments.ts(3,8): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/genericInterfacesWithoutTypeArguments.ts(4,10): error TS2314: Generic type 'I' requires 1 type argument(s). + + ==== tests/cases/compiler/genericInterfacesWithoutTypeArguments.ts (2 errors) ==== interface I { } class C { } var i: I; ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). var c: C; ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/genericLambaArgWithoutTypeArguments.errors.txt b/tests/baselines/reference/genericLambaArgWithoutTypeArguments.errors.txt index 27623b6ebab..4348c1cf9c4 100644 --- a/tests/baselines/reference/genericLambaArgWithoutTypeArguments.errors.txt +++ b/tests/baselines/reference/genericLambaArgWithoutTypeArguments.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/genericLambaArgWithoutTypeArguments.ts(7,11): error TS2314: Generic type 'Foo' requires 1 type argument(s). + + ==== tests/cases/compiler/genericLambaArgWithoutTypeArguments.ts (1 errors) ==== interface Foo { x: T; @@ -7,5 +10,5 @@ } foo((arg: Foo) => { return arg.x; }); ~~~ -!!! Generic type 'Foo' requires 1 type argument(s). +!!! error TS2314: Generic type 'Foo' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/genericMemberFunction.errors.txt b/tests/baselines/reference/genericMemberFunction.errors.txt index 4e9e6a0b0d2..2199966ea56 100644 --- a/tests/baselines/reference/genericMemberFunction.errors.txt +++ b/tests/baselines/reference/genericMemberFunction.errors.txt @@ -1,38 +1,48 @@ +tests/cases/compiler/genericMemberFunction.ts(2,20): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/genericMemberFunction.ts(7,20): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/genericMemberFunction.ts(10,20): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/genericMemberFunction.ts(15,19): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/genericMemberFunction.ts(16,5): error TS2304: Cannot find name 'a'. +tests/cases/compiler/genericMemberFunction.ts(17,5): error TS2304: Cannot find name 'removedFiles'. +tests/cases/compiler/genericMemberFunction.ts(17,30): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/genericMemberFunction.ts(18,12): error TS2339: Property 'removeFile' does not exist on type 'BuildResult'. + + ==== tests/cases/compiler/genericMemberFunction.ts (8 errors) ==== export class BuildError{ public parent(): FileWithErrors { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. return undefined; } } export class FileWithErrors{ public errors(): BuildError[] { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. return undefined; } public parent(): BuildResult { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. return undefined; } } export class BuildResult{ public merge(other: BuildResult): void { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. a.b.c.d.e.f.g = 0; ~ -!!! Cannot find name 'a'. +!!! error TS2304: Cannot find name 'a'. removedFiles.forEach((each: FileWithErrors) => { ~~~~~~~~~~~~ -!!! Cannot find name 'removedFiles'. +!!! error TS2304: Cannot find name 'removedFiles'. ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. this.removeFile(each); ~~~~~~~~~~ -!!! Property 'removeFile' does not exist on type 'BuildResult'. +!!! error TS2339: Property 'removeFile' does not exist on type 'BuildResult'. }); } } diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.errors.txt b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.errors.txt index 5368c5b832a..43a73e76a3e 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.errors.txt +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.errors.txt @@ -1,13 +1,18 @@ +tests/cases/compiler/genericMergedDeclarationUsingTypeParameter.ts(1,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/genericMergedDeclarationUsingTypeParameter.ts(3,19): error TS2304: Cannot find name 'T'. +tests/cases/compiler/genericMergedDeclarationUsingTypeParameter.ts(4,14): error TS2304: Cannot find name 'T'. + + ==== tests/cases/compiler/genericMergedDeclarationUsingTypeParameter.ts (3 errors) ==== function foo(y: T, z: U) { return y; } ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. module foo { export var x: T; ~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. var y = 1; ~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.errors.txt b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.errors.txt index d6d1f1ae44d..7ab8ac4c0f1 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.errors.txt +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/genericMergedDeclarationUsingTypeParameter2.ts(3,19): error TS2304: Cannot find name 'T'. +tests/cases/compiler/genericMergedDeclarationUsingTypeParameter2.ts(4,14): error TS2304: Cannot find name 'T'. + + ==== tests/cases/compiler/genericMergedDeclarationUsingTypeParameter2.ts (2 errors) ==== class foo { constructor(x: T) { } } module foo { export var x: T; ~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. var y = 1; ~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericNewInterface.errors.txt b/tests/baselines/reference/genericNewInterface.errors.txt index a8574f19eb5..f489b72c1b6 100644 --- a/tests/baselines/reference/genericNewInterface.errors.txt +++ b/tests/baselines/reference/genericNewInterface.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/genericNewInterface.ts(2,21): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/genericNewInterface.ts(10,21): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/genericNewInterface.ts (2 errors) ==== function createInstance(ctor: new (s: string) => T): T { return new ctor(42); //should be an error ~~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. } interface INewable { @@ -12,5 +16,5 @@ function createInstance2(ctor: INewable): T { return new ctor(1024); //should be an error ~~~~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.errors.txt b/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.errors.txt index 2d6230b4563..3224d577fd2 100644 --- a/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.errors.txt +++ b/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/genericObjectCreationWithoutTypeArgs.ts(6,26): error TS1109: Expression expected. +tests/cases/compiler/genericObjectCreationWithoutTypeArgs.ts(6,19): error TS2304: Cannot find name 'number'. + + ==== tests/cases/compiler/genericObjectCreationWithoutTypeArgs.ts (2 errors) ==== class SS{ @@ -6,9 +10,9 @@ var x1 = new SS(); // OK var x2 = new SS < number>; // Correctly give error ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~~ -!!! Cannot find name 'number'. +!!! error TS2304: Cannot find name 'number'. var x3 = new SS(); // OK var x4 = new SS; // Should be allowed, but currently give error ('supplied parameters do not match any signature of the call target') \ No newline at end of file diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors1.errors.txt b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors1.errors.txt index bce0417d81b..a76eb9d233d 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors1.errors.txt +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors1.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/genericRecursiveImplicitConstructorErrors1.ts(9,49): error TS2314: Generic type 'PullTypeSymbol' requires 3 type argument(s). + + ==== tests/cases/compiler/genericRecursiveImplicitConstructorErrors1.ts (1 errors) ==== export declare module TypeScript { class PullSymbol { } @@ -9,7 +12,7 @@ } class PullTypeParameterSymbol extends PullTypeSymbol { ~~~~~~~~~~~~~~ -!!! Generic type 'PullTypeSymbol' requires 3 type argument(s). +!!! error TS2314: Generic type 'PullTypeSymbol' requires 3 type argument(s). } } diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.errors.txt b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.errors.txt index ee9aadfdf93..760d1561113 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.errors.txt +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.errors.txt @@ -1,11 +1,21 @@ +tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(3,66): error TS2314: Generic type 'MemberName' requires 3 type argument(s). +tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(3,66): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(10,22): error TS2314: Generic type 'PullTypeSymbol' requires 3 type argument(s). +tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(12,48): error TS2314: Generic type 'PullSymbol' requires 3 type argument(s). +tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(13,31): error TS2314: Generic type 'PullTypeSymbol' requires 3 type argument(s). +tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(14,46): error TS2314: Generic type 'PullSymbol' requires 3 type argument(s). +tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(18,53): error TS2314: Generic type 'PullSymbol' requires 3 type argument(s). +tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts(19,22): error TS2339: Property 'isArray' does not exist on type 'PullTypeSymbol'. + + ==== tests/cases/compiler/genericRecursiveImplicitConstructorErrors3.ts (8 errors) ==== module TypeScript { export class MemberName { static create(arg1: any, arg2?: any, arg3?: any): MemberName { ~~~~~~~~~~ -!!! Generic type 'MemberName' requires 3 type argument(s). +!!! error TS2314: Generic type 'MemberName' requires 3 type argument(s). ~~~~~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. } } } @@ -14,26 +24,26 @@ export class PullSymbol { public type: PullTypeSymbol = null; ~~~~~~~~~~~~~~ -!!! Generic type 'PullTypeSymbol' requires 3 type argument(s). +!!! error TS2314: Generic type 'PullTypeSymbol' requires 3 type argument(s). } export class PullTypeSymbol extends PullSymbol { ~~~~~~~~~~ -!!! Generic type 'PullSymbol' requires 3 type argument(s). +!!! error TS2314: Generic type 'PullSymbol' requires 3 type argument(s). private _elementType: PullTypeSymbol = null; ~~~~~~~~~~~~~~ -!!! Generic type 'PullTypeSymbol' requires 3 type argument(s). +!!! error TS2314: Generic type 'PullTypeSymbol' requires 3 type argument(s). public toString(scopeSymbol?: PullSymbol, useConstraintInName?: boolean) { ~~~~~~~~~~ -!!! Generic type 'PullSymbol' requires 3 type argument(s). +!!! error TS2314: Generic type 'PullSymbol' requires 3 type argument(s). var s = this.getScopedNameEx(scopeSymbol, useConstraintInName).toString(); return s; } public getScopedNameEx(scopeSymbol?: PullSymbol, useConstraintInName?: boolean, getPrettyTypeName?: boolean, getTypeParamMarkerInfo?: boolean) { ~~~~~~~~~~ -!!! Generic type 'PullSymbol' requires 3 type argument(s). +!!! error TS2314: Generic type 'PullSymbol' requires 3 type argument(s). if (this.isArray()) { ~~~~~~~ -!!! Property 'isArray' does not exist on type 'PullTypeSymbol'. +!!! error TS2339: Property 'isArray' does not exist on type 'PullTypeSymbol'. var elementMemberName = this._elementType ? (this._elementType.isArray() || this._elementType.isNamedTypeSymbol() ? this._elementType.getScopedNameEx(scopeSymbol, false, getPrettyTypeName, getTypeParamMarkerInfo) : diff --git a/tests/baselines/reference/genericReduce.errors.txt b/tests/baselines/reference/genericReduce.errors.txt index 4008fddb919..26e106dba1c 100644 --- a/tests/baselines/reference/genericReduce.errors.txt +++ b/tests/baselines/reference/genericReduce.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/genericReduce.ts(6,4): error TS2339: Property 'x' does not exist on type 'number'. +tests/cases/compiler/genericReduce.ts(8,4): error TS2339: Property 'x' does not exist on type 'number'. +tests/cases/compiler/genericReduce.ts(12,4): error TS2339: Property 'toExponential' does not exist on type 'string'. + + ==== tests/cases/compiler/genericReduce.ts (3 errors) ==== var a = ["An", "array", "of", "strings"]; var b = a.map(s => s.length); @@ -6,15 +11,15 @@ n1.x = "fail"; // should error, as 'n1' should be type 'number', not 'any'. ~ -!!! Property 'x' does not exist on type 'number'. +!!! error TS2339: Property 'x' does not exist on type 'number'. n1.toExponential(2); // should not error if 'n1' is correctly number. n2.x = "fail"; // should error, as 'n2' should be type 'number', not 'any'. ~ -!!! Property 'x' does not exist on type 'number'. +!!! error TS2339: Property 'x' does not exist on type 'number'. n2.toExponential(2); // should not error if 'n2' is correctly number. var n3 = b.reduce( (x, y) => x + y, ""); // Initial value is of type string n3.toExponential(2); // should error if 'n3' is correctly type 'string' ~~~~~~~~~~~~~ -!!! Property 'toExponential' does not exist on type 'string'. +!!! error TS2339: Property 'toExponential' does not exist on type 'string'. n3.charAt(0); // should not error if 'n3' is correctly type 'string' \ No newline at end of file diff --git a/tests/baselines/reference/genericRestArgs.errors.txt b/tests/baselines/reference/genericRestArgs.errors.txt index a23bec39f0e..49f61de325f 100644 --- a/tests/baselines/reference/genericRestArgs.errors.txt +++ b/tests/baselines/reference/genericRestArgs.errors.txt @@ -1,17 +1,27 @@ -==== tests/cases/compiler/genericRestArgs.ts (2 errors) ==== +tests/cases/compiler/genericRestArgs.ts(2,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/compiler/genericRestArgs.ts(10,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. + + +==== tests/cases/compiler/genericRestArgs.ts (4 errors) ==== function makeArrayG(...items: T[]): T[] { return items; } var a1Ga = makeArrayG(1, ""); // no error + ~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. var a1Gb = makeArrayG(1, ""); var a1Gc = makeArrayG(1, ""); var a1Gd = makeArrayG(1, ""); // error ~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. function makeArrayGOpt(item1?: T, item2?: T, item3?: T) { return [item1, item2, item3]; } var a2Ga = makeArrayGOpt(1, ""); + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. var a2Gb = makeArrayG(1, ""); var a2Gc = makeArrayG(1, ""); // error ~ -!!! Argument of type 'number' is not assignable to parameter of type 'any[]'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. \ No newline at end of file diff --git a/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt b/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt index 939cf38cb03..8215d687443 100644 --- a/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt +++ b/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/genericReturnTypeFromGetter1.ts(6,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/genericReturnTypeFromGetter1.ts(5,18): error TS2314: Generic type 'A' requires 1 type argument(s). + + ==== tests/cases/compiler/genericReturnTypeFromGetter1.ts (2 errors) ==== export interface A { new (dbSet: DbSet): T; @@ -5,9 +9,9 @@ export class DbSet { _entityType: A; ~ -!!! Generic type 'A' requires 1 type argument(s). +!!! error TS2314: Generic type 'A' requires 1 type argument(s). get entityType() { return this._entityType; } // used to ICE without return type annotation ~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/genericSpecializations2.errors.txt b/tests/baselines/reference/genericSpecializations2.errors.txt index 038c65e0e47..49729ca1d8c 100644 --- a/tests/baselines/reference/genericSpecializations2.errors.txt +++ b/tests/baselines/reference/genericSpecializations2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/genericSpecializations2.ts(8,9): error TS2368: Type parameter name cannot be 'string' +tests/cases/compiler/genericSpecializations2.ts(12,9): error TS2368: Type parameter name cannot be 'string' + + ==== tests/cases/compiler/genericSpecializations2.ts (2 errors) ==== class IFoo { foo(x: T): T { // no error on implementors because IFoo's T is different from foo's T @@ -8,13 +12,13 @@ class IntFooBad implements IFoo { foo(x: string): string { return null; } ~~~~~~ -!!! Type parameter name cannot be 'string' +!!! error TS2368: Type parameter name cannot be 'string' } class StringFoo2 implements IFoo { foo(x: string): string { return null; } ~~~~~~ -!!! Type parameter name cannot be 'string' +!!! error TS2368: Type parameter name cannot be 'string' } class StringFoo3 implements IFoo { diff --git a/tests/baselines/reference/genericSpecializations3.errors.txt b/tests/baselines/reference/genericSpecializations3.errors.txt index b4bf9f64bfb..0011be255f1 100644 --- a/tests/baselines/reference/genericSpecializations3.errors.txt +++ b/tests/baselines/reference/genericSpecializations3.errors.txt @@ -1,3 +1,20 @@ +tests/cases/compiler/genericSpecializations3.ts(8,7): error TS2421: Class 'IntFooBad' incorrectly implements interface 'IFoo': + Types of property 'foo' are incompatible: + Type '(x: string) => string' is not assignable to type '(x: number) => number': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/genericSpecializations3.ts(28,1): error TS2322: Type 'StringFoo2' is not assignable to type 'IntFoo': + Types of property 'foo' are incompatible: + Type '(x: string) => string' is not assignable to type '(x: number) => number': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/genericSpecializations3.ts(29,1): error TS2322: Type 'IntFoo' is not assignable to type 'StringFoo2': + Types of property 'foo' are incompatible: + Type '(x: number) => number' is not assignable to type '(x: string) => string': + Types of parameters 'x' and 'x' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/genericSpecializations3.ts (3 errors) ==== interface IFoo { foo(x: T): T; @@ -8,11 +25,11 @@ class IntFooBad implements IFoo { // error ~~~~~~~~~ -!!! Class 'IntFooBad' incorrectly implements interface 'IFoo': -!!! Types of property 'foo' are incompatible: -!!! Type '(x: string) => string' is not assignable to type '(x: number) => number': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2421: Class 'IntFooBad' incorrectly implements interface 'IFoo': +!!! error TS2421: Types of property 'foo' are incompatible: +!!! error TS2421: Type '(x: string) => string' is not assignable to type '(x: number) => number': +!!! error TS2421: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2421: Type 'string' is not assignable to type 'number'. foo(x: string): string { return null; } } @@ -34,18 +51,18 @@ intFoo = stringFoo2; // error ~~~~~~ -!!! Type 'StringFoo2' is not assignable to type 'IntFoo': -!!! Types of property 'foo' are incompatible: -!!! Type '(x: string) => string' is not assignable to type '(x: number) => number': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'StringFoo2' is not assignable to type 'IntFoo': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => number': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. stringFoo2 = intFoo; // error ~~~~~~~~~~ -!!! Type 'IntFoo' is not assignable to type 'StringFoo2': -!!! Types of property 'foo' are incompatible: -!!! Type '(x: number) => number' is not assignable to type '(x: string) => string': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'IntFoo' is not assignable to type 'StringFoo2': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: string) => string': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. class StringFoo3 implements IFoo { // error diff --git a/tests/baselines/reference/genericTypeArgumentInference1.types b/tests/baselines/reference/genericTypeArgumentInference1.types index 20a9a0ca8f9..be7a3e9226d 100644 --- a/tests/baselines/reference/genericTypeArgumentInference1.types +++ b/tests/baselines/reference/genericTypeArgumentInference1.types @@ -42,12 +42,12 @@ declare var _: Underscore.Static; >Static : Underscore.Static var r = _.all([true, 1, null, 'yes'], _.identity); ->r : {} ->_.all([true, 1, null, 'yes'], _.identity) : {} +>r : string | number | boolean +>_.all([true, 1, null, 'yes'], _.identity) : string | number | boolean >_.all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T >_ : Underscore.Static >all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T ->[true, 1, null, 'yes'] : {}[] +>[true, 1, null, 'yes'] : Array >_.identity : (value: T) => T >_ : Underscore.Static >identity : (value: T) => T @@ -69,7 +69,7 @@ var r3 = _.all([], _.identity); >_.all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T >_ : Underscore.Static >all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T ->[] : any[] +>[] : undefined[] >_.identity : (value: T) => T >_ : Underscore.Static >identity : (value: T) => T diff --git a/tests/baselines/reference/genericTypeAssertions1.errors.txt b/tests/baselines/reference/genericTypeAssertions1.errors.txt index 7ab9e056611..9e0492a8474 100644 --- a/tests/baselines/reference/genericTypeAssertions1.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions1.errors.txt @@ -1,15 +1,24 @@ +tests/cases/compiler/genericTypeAssertions1.ts(3,5): error TS2322: Type 'A' is not assignable to type 'A': + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/genericTypeAssertions1.ts(4,5): error TS2322: Type 'A>' is not assignable to type 'A': + Type 'A' is not assignable to type 'number'. +tests/cases/compiler/genericTypeAssertions1.ts(4,21): error TS2353: Neither type 'A' nor type 'A>' is assignable to the other: + Type 'number' is not assignable to type 'A': + Property 'foo' is missing in type 'Number'. + + ==== tests/cases/compiler/genericTypeAssertions1.ts (3 errors) ==== class A { foo(x: T) { }} var foo = new A(); var r: A = >new A(); // error ~ -!!! Type 'A' is not assignable to type 'A': -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'A' is not assignable to type 'A': +!!! error TS2322: Type 'number' is not assignable to type 'string'. var r2: A = >>foo; // error ~~ -!!! Type 'A>' is not assignable to type 'A': -!!! Type 'A' is not assignable to type 'number'. +!!! error TS2322: Type 'A>' is not assignable to type 'A': +!!! error TS2322: Type 'A' is not assignable to type 'number'. ~~~~~~~~~~~~~~~~~ -!!! Neither type 'A' nor type 'A>' is assignable to the other: -!!! Type 'number' is not assignable to type 'A': -!!! Property 'foo' is missing in type 'Number'. \ No newline at end of file +!!! error TS2353: Neither type 'A' nor type 'A>' is assignable to the other: +!!! error TS2353: Type 'number' is not assignable to type 'A': +!!! error TS2353: Property 'foo' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions2.errors.txt b/tests/baselines/reference/genericTypeAssertions2.errors.txt index 886031edaaf..887e66a532f 100644 --- a/tests/baselines/reference/genericTypeAssertions2.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions2.errors.txt @@ -1,3 +1,14 @@ +tests/cases/compiler/genericTypeAssertions2.ts(10,5): error TS2322: Type 'B' is not assignable to type 'A': + Types of property 'foo' are incompatible: + Type '(x: string) => void' is not assignable to type '(x: number) => void': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/genericTypeAssertions2.ts(11,5): error TS2322: Type 'A' is not assignable to type 'B': + Property 'bar' is missing in type 'A'. +tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2353: Neither type 'undefined[]' nor type 'A' is assignable to the other: + Property 'foo' is missing in type 'undefined[]'. + + ==== tests/cases/compiler/genericTypeAssertions2.ts (3 errors) ==== class A { foo(x: T) { } } class B extends A { @@ -10,17 +21,17 @@ var r: A = >new B(); var r2: A = >new B(); // error ~~ -!!! Type 'B' is not assignable to type 'A': -!!! Types of property 'foo' are incompatible: -!!! Type '(x: string) => void' is not assignable to type '(x: number) => void': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'B' is not assignable to type 'A': +!!! error TS2322: Types of property 'foo' are incompatible: +!!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void': +!!! error TS2322: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. var r3: B = >new B(); // error ~~ -!!! Type 'A' is not assignable to type 'B': -!!! Property 'bar' is missing in type 'A'. +!!! error TS2322: Type 'A' is not assignable to type 'B': +!!! error TS2322: Property 'bar' is missing in type 'A'. var r4: A = >new A(); var r5: A = >[]; // error ~~~~~~~~~~~~~ -!!! Neither type 'undefined[]' nor type 'A' is assignable to the other: -!!! Property 'foo' is missing in type 'undefined[]'. \ No newline at end of file +!!! error TS2353: Neither type 'undefined[]' nor type 'A' is assignable to the other: +!!! error TS2353: Property 'foo' is missing in type 'undefined[]'. \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions4.errors.txt b/tests/baselines/reference/genericTypeAssertions4.errors.txt index c109b6988e9..2a29eac6220 100644 --- a/tests/baselines/reference/genericTypeAssertions4.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions4.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/genericTypeAssertions4.ts(19,5): error TS2323: Type 'A' is not assignable to type 'T'. +tests/cases/compiler/genericTypeAssertions4.ts(20,5): error TS2323: Type 'B' is not assignable to type 'T'. +tests/cases/compiler/genericTypeAssertions4.ts(21,5): error TS2323: Type 'C' is not assignable to type 'T'. +tests/cases/compiler/genericTypeAssertions4.ts(23,9): error TS2352: Neither type 'B' nor type 'T' is assignable to the other. +tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Neither type 'C' nor type 'T' is assignable to the other. + + ==== tests/cases/compiler/genericTypeAssertions4.ts (5 errors) ==== class A { foo() { return ""; } @@ -19,18 +26,18 @@ var y = x; y = a; // error: cannot convert A to T ~ -!!! Type 'A' is not assignable to type 'T'. +!!! error TS2323: Type 'A' is not assignable to type 'T'. y = b; // error: cannot convert B to T ~ -!!! Type 'B' is not assignable to type 'T'. +!!! error TS2323: Type 'B' is not assignable to type 'T'. y = c; // error: cannot convert C to T ~ -!!! Type 'C' is not assignable to type 'T'. +!!! error TS2323: Type 'C' is not assignable to type 'T'. y = a; y = b; // error: cannot convert B to T ~~~~ -!!! Neither type 'B' nor type 'T' is assignable to the other. +!!! error TS2352: Neither type 'B' nor type 'T' is assignable to the other. y = c; // error: cannot convert C to T ~~~~ -!!! Neither type 'C' nor type 'T' is assignable to the other. +!!! error TS2352: Neither type 'C' nor type 'T' is assignable to the other. } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions5.errors.txt b/tests/baselines/reference/genericTypeAssertions5.errors.txt index 7fe23527273..3c53a791b9b 100644 --- a/tests/baselines/reference/genericTypeAssertions5.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions5.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/genericTypeAssertions5.ts(19,5): error TS2323: Type 'A' is not assignable to type 'T'. +tests/cases/compiler/genericTypeAssertions5.ts(20,5): error TS2323: Type 'B' is not assignable to type 'T'. +tests/cases/compiler/genericTypeAssertions5.ts(21,5): error TS2323: Type 'C' is not assignable to type 'T'. +tests/cases/compiler/genericTypeAssertions5.ts(23,9): error TS2352: Neither type 'B' nor type 'T' is assignable to the other. +tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Neither type 'C' nor type 'T' is assignable to the other. + + ==== tests/cases/compiler/genericTypeAssertions5.ts (5 errors) ==== interface A { foo(): string; @@ -19,18 +26,18 @@ var y = x; y = a; // error: cannot convert A to T ~ -!!! Type 'A' is not assignable to type 'T'. +!!! error TS2323: Type 'A' is not assignable to type 'T'. y = b; // error: cannot convert B to T ~ -!!! Type 'B' is not assignable to type 'T'. +!!! error TS2323: Type 'B' is not assignable to type 'T'. y = c; // error: cannot convert C to T ~ -!!! Type 'C' is not assignable to type 'T'. +!!! error TS2323: Type 'C' is not assignable to type 'T'. y = a; y = b; // error: cannot convert B to T ~~~~ -!!! Neither type 'B' nor type 'T' is assignable to the other. +!!! error TS2352: Neither type 'B' nor type 'T' is assignable to the other. y = c; // error: cannot convert C to T ~~~~ -!!! Neither type 'C' nor type 'T' is assignable to the other. +!!! error TS2352: Neither type 'C' nor type 'T' is assignable to the other. } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions6.errors.txt b/tests/baselines/reference/genericTypeAssertions6.errors.txt index 99d7f6b8509..93677b9ab84 100644 --- a/tests/baselines/reference/genericTypeAssertions6.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions6.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/genericTypeAssertions6.ts(8,13): error TS2352: Neither type 'U' nor type 'T' is assignable to the other. +tests/cases/compiler/genericTypeAssertions6.ts(9,13): error TS2352: Neither type 'T' nor type 'U' is assignable to the other. +tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Neither type 'U' nor type 'T' is assignable to the other. + + ==== tests/cases/compiler/genericTypeAssertions6.ts (3 errors) ==== class A { constructor(x) { @@ -8,10 +13,10 @@ f(x: T, y: U) { x = y; ~~~~ -!!! Neither type 'U' nor type 'T' is assignable to the other. +!!! error TS2352: Neither type 'U' nor type 'T' is assignable to the other. y = x; ~~~~ -!!! Neither type 'T' nor type 'U' is assignable to the other. +!!! error TS2352: Neither type 'T' nor type 'U' is assignable to the other. } } @@ -23,7 +28,7 @@ var d = new Date(); var e = new Date(); ~~~~~~~~~~~~~~~~ -!!! Neither type 'U' nor type 'T' is assignable to the other. +!!! error TS2352: Neither type 'U' nor type 'T' is assignable to the other. } } diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt index b3fdd2a93af..f646ac4725e 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt @@ -1,3 +1,19 @@ +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(8,16): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(14,27): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(16,25): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(22,26): error TS2305: Module 'M' has no exported member 'C'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(23,28): error TS2314: Generic type 'E' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(25,30): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(26,30): error TS2314: Generic type 'E' requires 1 type argument(s). + + ==== tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts (14 errors) ==== // it is an error to use a generic type without type arguments // all of these are errors @@ -8,33 +24,33 @@ declare var c: C; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var a: { x: C }; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var b: { (x: C): C }; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var d: { [x: C]: C }; ~ -!!! An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare function f(x: C): C; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare class D extends C {} ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare module M { export class E { foo: T } @@ -42,14 +58,14 @@ declare class D2 extends M.C { } ~~~ -!!! Module 'M' has no exported member 'C'. +!!! error TS2305: Module 'M' has no exported member 'C'. declare class D3 { } ~~~ -!!! Generic type 'E' requires 1 type argument(s). +!!! error TS2314: Generic type 'E' requires 1 type argument(s). declare function h(x: T); ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare function i(x: T); ~~~ -!!! Generic type 'E' requires 1 type argument(s). \ No newline at end of file +!!! error TS2314: Generic type 'E' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt index e8fee6f002b..a8627f3f18e 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt @@ -1,3 +1,29 @@ +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(8,8): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(10,13): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,14): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,18): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,14): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,18): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(14,13): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(14,28): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(16,15): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(16,19): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(16,30): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(18,23): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(18,27): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(18,38): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(20,17): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(23,21): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(29,18): error TS2314: Generic type 'E' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(30,20): error TS2314: Generic type 'E' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(31,22): error TS2314: Generic type 'E' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(33,22): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(34,22): error TS2314: Generic type 'E' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(36,10): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(37,10): error TS2314: Generic type 'E' requires 1 type argument(s). + + ==== tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts (24 errors) ==== // it is an error to use a generic type without type arguments // all of these are errors @@ -8,54 +34,54 @@ var c: C; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var a: { x: C }; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var b: { (x: C): C }; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var d: { [x: C]: C }; ~ -!!! An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var e = (x: C) => { var y: C; return y; } ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). function f(x: C): C { var y: C; return y; } ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var g = function f(x: C): C { var y: C; return y; } ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). class D extends C { ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). } interface I extends C {} ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). module M { export class E { foo: T } @@ -63,24 +89,24 @@ class D2 extends M.E { } ~~~ -!!! Generic type 'E' requires 1 type argument(s). +!!! error TS2314: Generic type 'E' requires 1 type argument(s). class D3 { } ~~~ -!!! Generic type 'E' requires 1 type argument(s). +!!! error TS2314: Generic type 'E' requires 1 type argument(s). interface I2 extends M.E { } ~~~ -!!! Generic type 'E' requires 1 type argument(s). +!!! error TS2314: Generic type 'E' requires 1 type argument(s). function h(x: T) { } ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). function i(x: T) { } ~~~ -!!! Generic type 'E' requires 1 type argument(s). +!!! error TS2314: Generic type 'E' requires 1 type argument(s). var j = null; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var k = null; ~~~ -!!! Generic type 'E' requires 1 type argument(s). \ No newline at end of file +!!! error TS2314: Generic type 'E' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt index 0513aaff05c..1802d0385c4 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt @@ -1,3 +1,29 @@ +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(8,8): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(10,13): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,14): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,18): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,14): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,18): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(14,13): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(14,28): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(16,15): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(16,19): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(16,30): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(18,23): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(18,27): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(18,38): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(20,17): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(23,21): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(29,18): error TS2305: Module 'M' has no exported member 'C'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(30,24): error TS2314: Generic type 'E' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(31,22): error TS2305: Module 'M' has no exported member 'C'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(33,22): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(34,22): error TS2314: Generic type 'E' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(36,10): error TS2304: Cannot find name 'C'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(37,10): error TS2314: Generic type 'E' requires 1 type argument(s). + + ==== tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts (24 errors) ==== // it is an error to use a generic type without type arguments // all of these are errors @@ -8,54 +34,54 @@ var c: I; ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). var a: { x: I }; ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). var b: { (x: I): I }; ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). var d: { [x: I]: I }; ~ -!!! An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). var e = (x: I) => { var y: I; return y; } ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). function f(x: I): I { var y: I; return y; } ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). var g = function f(x: I): I { var y: I; return y; } ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). class D extends I { ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). } interface U extends I {} ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). module M { export interface E { foo: T } @@ -63,24 +89,24 @@ class D2 extends M.C { } ~~~ -!!! Module 'M' has no exported member 'C'. +!!! error TS2305: Module 'M' has no exported member 'C'. interface D3 { } ~~~ -!!! Generic type 'E' requires 1 type argument(s). +!!! error TS2314: Generic type 'E' requires 1 type argument(s). interface I2 extends M.C { } ~~~ -!!! Module 'M' has no exported member 'C'. +!!! error TS2305: Module 'M' has no exported member 'C'. function h(x: T) { } ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). function i(x: T) { } ~~~ -!!! Generic type 'E' requires 1 type argument(s). +!!! error TS2314: Generic type 'E' requires 1 type argument(s). var j = null; ~ -!!! Cannot find name 'C'. +!!! error TS2304: Cannot find name 'C'. var k = null; ~~~ -!!! Generic type 'E' requires 1 type argument(s). \ No newline at end of file +!!! error TS2314: Generic type 'E' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt index 7b0e4ba6fbe..41774da0d00 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt @@ -1,3 +1,19 @@ +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(8,16): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(14,27): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(16,25): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(22,26): error TS2305: Module 'M' has no exported member 'C'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(23,28): error TS2314: Generic type 'E' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(25,30): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(26,30): error TS2314: Generic type 'E' requires 1 type argument(s). + + ==== tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts (14 errors) ==== // it is an error to use a generic type without type arguments // all of these are errors @@ -8,33 +24,33 @@ declare var c: C; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var a: { x: C }; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var b: { (x: C): C }; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var d: { [x: C]: C }; ~ -!!! An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare function f(x: C): C; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare class D extends C {} ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare module M { export class E { foo: T } @@ -42,14 +58,14 @@ declare class D2 extends M.C { } ~~~ -!!! Module 'M' has no exported member 'C'. +!!! error TS2305: Module 'M' has no exported member 'C'. declare class D3 { } ~~~ -!!! Generic type 'E' requires 1 type argument(s). +!!! error TS2314: Generic type 'E' requires 1 type argument(s). declare function h(x: T); ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). declare function i(x: T); ~~~ -!!! Generic type 'E' requires 1 type argument(s). \ No newline at end of file +!!! error TS2314: Generic type 'E' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.errors.txt b/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.errors.txt index 6f464ab0eab..224e5e038da 100644 --- a/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.errors.txt +++ b/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/genericTypeReferencesRequireTypeArgs.ts(7,9): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/compiler/genericTypeReferencesRequireTypeArgs.ts(8,9): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/genericTypeReferencesRequireTypeArgs.ts(9,11): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/genericTypeReferencesRequireTypeArgs.ts(10,11): error TS2314: Generic type 'C' requires 1 type argument(s). + + ==== tests/cases/compiler/genericTypeReferencesRequireTypeArgs.ts (4 errors) ==== class C { foo(): T { return null } @@ -7,14 +13,14 @@ } var c1: C; // error ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var i1: I; // error ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). var c2: C; // should be an error ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). var i2: I; // should be an error ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeUsedWithoutTypeArguments1.errors.txt b/tests/baselines/reference/genericTypeUsedWithoutTypeArguments1.errors.txt index 8f923d6bdb7..836f250f5fc 100644 --- a/tests/baselines/reference/genericTypeUsedWithoutTypeArguments1.errors.txt +++ b/tests/baselines/reference/genericTypeUsedWithoutTypeArguments1.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/genericTypeUsedWithoutTypeArguments1.ts(2,25): error TS2314: Generic type 'Foo' requires 1 type argument(s). + + ==== tests/cases/compiler/genericTypeUsedWithoutTypeArguments1.ts (1 errors) ==== interface Foo { } class Bar implements Foo { } ~~~ -!!! Generic type 'Foo' requires 1 type argument(s). +!!! error TS2314: Generic type 'Foo' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeUsedWithoutTypeArguments3.errors.txt b/tests/baselines/reference/genericTypeUsedWithoutTypeArguments3.errors.txt index b6f9510b525..c76133014f0 100644 --- a/tests/baselines/reference/genericTypeUsedWithoutTypeArguments3.errors.txt +++ b/tests/baselines/reference/genericTypeUsedWithoutTypeArguments3.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/genericTypeUsedWithoutTypeArguments3.ts(2,26): error TS2314: Generic type 'Foo' requires 1 type argument(s). + + ==== tests/cases/compiler/genericTypeUsedWithoutTypeArguments3.ts (1 errors) ==== interface Foo { } interface Bar extends Foo { } ~~~ -!!! Generic type 'Foo' requires 1 type argument(s). +!!! error TS2314: Generic type 'Foo' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt b/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt index 2b755e16db2..a1efb4a4e87 100644 --- a/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt +++ b/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt @@ -1,26 +1,42 @@ +tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(4,7): error TS2421: Class 'X' incorrectly implements interface 'I': + Types of property 'f' are incompatible: + Type '(a: T) => void' is not assignable to type '(a: { a: number; }) => void': + Types of parameters 'a' and 'a' are incompatible: + Type 'T' is not assignable to type '{ a: number; }': + Types of property 'a' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(8,5): error TS2322: Type 'X<{ a: string; }>' is not assignable to type 'I': + Types of property 'f' are incompatible: + Type '(a: { a: string; }) => void' is not assignable to type '(a: { a: number; }) => void': + Types of parameters 'a' and 'a' are incompatible: + Type '{ a: string; }' is not assignable to type '{ a: number; }': + Types of property 'a' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts (2 errors) ==== interface I { f: (a: { a: number }) => void } class X implements I { ~ -!!! Class 'X' incorrectly implements interface 'I': -!!! Types of property 'f' are incompatible: -!!! Type '(a: T) => void' is not assignable to type '(a: { a: number; }) => void': -!!! Types of parameters 'a' and 'a' are incompatible: -!!! Type 'T' is not assignable to type '{ a: number; }': -!!! Types of property 'a' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2421: Class 'X' incorrectly implements interface 'I': +!!! error TS2421: Types of property 'f' are incompatible: +!!! error TS2421: Type '(a: T) => void' is not assignable to type '(a: { a: number; }) => void': +!!! error TS2421: Types of parameters 'a' and 'a' are incompatible: +!!! error TS2421: Type 'T' is not assignable to type '{ a: number; }': +!!! error TS2421: Types of property 'a' are incompatible: +!!! error TS2421: Type 'string' is not assignable to type 'number'. f(a: T): void { } } var x = new X<{ a: string }>(); var i: I = x; // Should not be allowed -- type of 'f' is incompatible with 'I' ~ -!!! Type 'X<{ a: string; }>' is not assignable to type 'I': -!!! Types of property 'f' are incompatible: -!!! Type '(a: { a: string; }) => void' is not assignable to type '(a: { a: number; }) => void': -!!! Types of parameters 'a' and 'a' are incompatible: -!!! Type '{ a: string; }' is not assignable to type '{ a: number; }': -!!! Types of property 'a' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'X<{ a: string; }>' is not assignable to type 'I': +!!! error TS2322: Types of property 'f' are incompatible: +!!! error TS2322: Type '(a: { a: string; }) => void' is not assignable to type '(a: { a: number; }) => void': +!!! error TS2322: Types of parameters 'a' and 'a' are incompatible: +!!! error TS2322: Type '{ a: string; }' is not assignable to type '{ a: number; }': +!!! error TS2322: Types of property 'a' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types b/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types index 05697f1e1f9..f0cab6e7467 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType1.types @@ -8,7 +8,7 @@ class LazyArray { ><{ [objectId: string]: T; }>{} : { [x: string]: T; } >objectId : string >T : T ->{} : { [x: string]: T; } +>{} : { [x: string]: undefined; } array() { >array : () => { [x: string]: T; } diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt index 98b077e1a77..98db4282244 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,35): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,35): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/genericWithOpenTypeParameters1.ts (3 errors) ==== class B { foo(x: T): T { return null; } @@ -7,12 +12,12 @@ x.foo(1); // no error var f = (x: B) => { return x.foo(1); } // error ~ -!!! Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. var f2 = (x: B) => { return x.foo(1); } // error ~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var f3 = (x: B) => { return x.foo(1); } // error ~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var f4 = (x: B) => { return x.foo(1); } // no error \ No newline at end of file diff --git a/tests/baselines/reference/generics1.errors.txt b/tests/baselines/reference/generics1.errors.txt index 030a820e6c9..4d378d0b7d6 100644 --- a/tests/baselines/reference/generics1.errors.txt +++ b/tests/baselines/reference/generics1.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/generics1.ts(10,9): error TS2343: Type 'A' does not satisfy the constraint 'B': + Property 'b' is missing in type 'A'. +tests/cases/compiler/generics1.ts(13,9): error TS2314: Generic type 'G' requires 2 type argument(s). +tests/cases/compiler/generics1.ts(14,9): error TS2314: Generic type 'G' requires 2 type argument(s). + + ==== tests/cases/compiler/generics1.ts (3 errors) ==== interface A { a: string; } interface B extends A { b: string; } @@ -10,14 +16,14 @@ var v2: G<{ a: string }, C>; // Ok, equivalent to G var v3: G; // Error, A not valid argument for U ~~~~~~~ -!!! Type 'A' does not satisfy the constraint 'B': -!!! Property 'b' is missing in type 'A'. +!!! error TS2343: Type 'A' does not satisfy the constraint 'B': +!!! error TS2343: Property 'b' is missing in type 'A'. var v4: G, C>; // Ok var v5: G; // Error, any does not satisfy constraint B var v6: G; // Error, wrong number of arguments ~~~~~~ -!!! Generic type 'G' requires 2 type argument(s). +!!! error TS2314: Generic type 'G' requires 2 type argument(s). var v7: G; // Error, no type arguments ~ -!!! Generic type 'G' requires 2 type argument(s). +!!! error TS2314: Generic type 'G' requires 2 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/generics2.errors.txt b/tests/baselines/reference/generics2.errors.txt index 0d4742bc0e8..dfe58f07f23 100644 --- a/tests/baselines/reference/generics2.errors.txt +++ b/tests/baselines/reference/generics2.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/generics2.ts(17,9): error TS2343: Type 'A' does not satisfy the constraint 'B': + Property 'b' is missing in type 'A'. +tests/cases/compiler/generics2.ts(20,9): error TS2314: Generic type 'G' requires 2 type argument(s). +tests/cases/compiler/generics2.ts(21,9): error TS2314: Generic type 'G' requires 2 type argument(s). + + ==== tests/cases/compiler/generics2.ts (3 errors) ==== interface A { a: string; } interface B extends A { b: string; } @@ -17,14 +23,14 @@ var v2: G<{ a: string }, C>; // Ok, equivalent to G var v3: G; // Error, A not valid argument for U ~~~~~~~ -!!! Type 'A' does not satisfy the constraint 'B': -!!! Property 'b' is missing in type 'A'. +!!! error TS2343: Type 'A' does not satisfy the constraint 'B': +!!! error TS2343: Property 'b' is missing in type 'A'. var v4: G, C>; // Ok var v5: G; // Error, any does not satisfy constraint B var v6: G; // Error, wrong number of arguments ~~~~~~ -!!! Generic type 'G' requires 2 type argument(s). +!!! error TS2314: Generic type 'G' requires 2 type argument(s). var v7: G; // Error, no type arguments ~ -!!! Generic type 'G' requires 2 type argument(s). +!!! error TS2314: Generic type 'G' requires 2 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/generics4.errors.txt b/tests/baselines/reference/generics4.errors.txt index 9e2f1a5ccda..dcf210a53cf 100644 --- a/tests/baselines/reference/generics4.errors.txt +++ b/tests/baselines/reference/generics4.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/generics4.ts(7,1): error TS2322: Type 'C' is not assignable to type 'C': + Type 'Y' is not assignable to type 'X': + Types of property 'f' are incompatible: + Type '() => boolean' is not assignable to type '() => string': + Type 'boolean' is not assignable to type 'string'. + + ==== tests/cases/compiler/generics4.ts (1 errors) ==== class C { private x: T; } interface X { f(): string; } @@ -7,8 +14,8 @@ a = b; // Not ok - return types of "f" are different ~ -!!! Type 'C' is not assignable to type 'C': -!!! Type 'Y' is not assignable to type 'X': -!!! Types of property 'f' are incompatible: -!!! Type '() => boolean' is not assignable to type '() => string': -!!! Type 'boolean' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'C' is not assignable to type 'C': +!!! error TS2322: Type 'Y' is not assignable to type 'X': +!!! error TS2322: Types of property 'f' are incompatible: +!!! error TS2322: Type '() => boolean' is not assignable to type '() => string': +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/generics5.errors.txt b/tests/baselines/reference/generics5.errors.txt index 74f5d0e6e2c..fa279b92a5d 100644 --- a/tests/baselines/reference/generics5.errors.txt +++ b/tests/baselines/reference/generics5.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/generics5.ts(10,9): error TS2343: Type 'A' does not satisfy the constraint 'B': + Property 'b' is missing in type 'A'. + + ==== tests/cases/compiler/generics5.ts (1 errors) ==== interface A { a: string; } interface B extends A { b: string; } @@ -10,7 +14,7 @@ var v3: G; // Error, A not valid argument for U ~~~~~~~ -!!! Type 'A' does not satisfy the constraint 'B': -!!! Property 'b' is missing in type 'A'. +!!! error TS2343: Type 'A' does not satisfy the constraint 'B': +!!! error TS2343: Property 'b' is missing in type 'A'. \ No newline at end of file diff --git a/tests/baselines/reference/genericsManyTypeParameters.types b/tests/baselines/reference/genericsManyTypeParameters.types index 65f9a7c115e..df2144de866 100644 --- a/tests/baselines/reference/genericsManyTypeParameters.types +++ b/tests/baselines/reference/genericsManyTypeParameters.types @@ -1,6 +1,6 @@ === tests/cases/compiler/genericsManyTypeParameters.ts === function Foo< ->Foo : (x1: a1, y1: a21, z1: a31, a1: a41, b1: a51, c1: a61, x2: a119, y2: a22, z2: a32, a2: a42, b2: a52, c2: a62, x3: a219, y3: a23, z3: a33, a3: a43, b3: a53, c3: a63, x4: a319, y4: a24, z4: a34, a4: a44, b4: a54, c4: a64, x5: a419, y5: a25, z5: a35, a5: a45, b5: a55, c5: a65, x6: a519, y6: a26, z6: a36, a6: a46, b6: a56, c6: a66, x7: a619, y7: a27, z7: a37, a7: a47, b7: a57, c7: a67, x8: a71, y8: a28, z8: a38, a8: a48, b8: a58, c8: a68, x9: a81, y9: a29, z9: a39, a9: a49, b9: a59, c9: a69, x10: a91, y12: a210, z10: a310, a10: a410, b10: a510, c10: a610, x11: a111, y13: a211, z11: a311, a11: a411, b11: a511, c11: a611, x12: a112, y14: a212, z12: a312, a12: a412, b12: a512, c12: a612, x13: a113, y15: a213, z13: a313, a13: a413, b13: a513, c13: a613, x14: a114, y16: a214, z14: a314, a14: a414, b14: a514, c14: a614, x15: a115, y17: a215, z15: a315, a15: a415, b15: a515, c15: a615, x16: a116, y18: a216, z16: a316, a16: a416, b16: a516, c16: a616, x17: a117, y19: a217, z17: a317, a17: a417, b17: a517, c17: a617, x18: a118, y10: a218, z18: a318, a18: a418, b18: a518, c18: a618) => {}[] +>Foo : (x1: a1, y1: a21, z1: a31, a1: a41, b1: a51, c1: a61, x2: a119, y2: a22, z2: a32, a2: a42, b2: a52, c2: a62, x3: a219, y3: a23, z3: a33, a3: a43, b3: a53, c3: a63, x4: a319, y4: a24, z4: a34, a4: a44, b4: a54, c4: a64, x5: a419, y5: a25, z5: a35, a5: a45, b5: a55, c5: a65, x6: a519, y6: a26, z6: a36, a6: a46, b6: a56, c6: a66, x7: a619, y7: a27, z7: a37, a7: a47, b7: a57, c7: a67, x8: a71, y8: a28, z8: a38, a8: a48, b8: a58, c8: a68, x9: a81, y9: a29, z9: a39, a9: a49, b9: a59, c9: a69, x10: a91, y12: a210, z10: a310, a10: a410, b10: a510, c10: a610, x11: a111, y13: a211, z11: a311, a11: a411, b11: a511, c11: a611, x12: a112, y14: a212, z12: a312, a12: a412, b12: a512, c12: a612, x13: a113, y15: a213, z13: a313, a13: a413, b13: a513, c13: a613, x14: a114, y16: a214, z14: a314, a14: a414, b14: a514, c14: a614, x15: a115, y17: a215, z15: a315, a15: a415, b15: a515, c15: a615, x16: a116, y18: a216, z16: a316, a16: a416, b16: a516, c16: a616, x17: a117, y19: a217, z17: a317, a17: a417, b17: a517, c17: a617, x18: a118, y10: a218, z18: a318, a18: a418, b18: a518, c18: a618) => Array a1, a21, a31, a41, a51, a61, >a1 : a1 @@ -402,7 +402,7 @@ function Foo< ) { return [x1 , y1 , z1 , a1 , b1 , c1, ->[x1 , y1 , z1 , a1 , b1 , c1, x2 , y2 , z2 , a2 , b2 , c2, x3 , y3 , z3 , a3 , b3 , c3, x4 , y4 , z4 , a4 , b4 , c4, x5 , y5 , z5 , a5 , b5 , c5, x6 , y6 , z6 , a6 , b6 , c6, x7 , y7 , z7 , a7 , b7 , c7, x8 , y8 , z8 , a8 , b8 , c8, x9 , y9 , z9 , a9 , b9 , c9, x10 , y12 , z10 , a10 , b10 , c10, x11 , y13 , z11 , a11 , b11 , c11, x12 , y14 , z12 , a12 , b12 , c12, x13 , y15 , z13 , a13 , b13 , c13, x14 , y16 , z14 , a14 , b14 , c14, x15 , y17 , z15 , a15 , b15 , c15, x16 , y18 , z16 , a16 , b16 , c16, x17 , y19 , z17 , a17 , b17 , c17, x18 , y10 , z18 , a18 , b18 , c18] : {}[] +>[x1 , y1 , z1 , a1 , b1 , c1, x2 , y2 , z2 , a2 , b2 , c2, x3 , y3 , z3 , a3 , b3 , c3, x4 , y4 , z4 , a4 , b4 , c4, x5 , y5 , z5 , a5 , b5 , c5, x6 , y6 , z6 , a6 , b6 , c6, x7 , y7 , z7 , a7 , b7 , c7, x8 , y8 , z8 , a8 , b8 , c8, x9 , y9 , z9 , a9 , b9 , c9, x10 , y12 , z10 , a10 , b10 , c10, x11 , y13 , z11 , a11 , b11 , c11, x12 , y14 , z12 , a12 , b12 , c12, x13 , y15 , z13 , a13 , b13 , c13, x14 , y16 , z14 , a14 , b14 , c14, x15 , y17 , z15 , a15 , b15 , c15, x16 , y18 , z16 , a16 , b16 , c16, x17 , y19 , z17 , a17 , b17 , c17, x18 , y10 , z18 , a18 , b18 , c18] : Array >x1 : a1 >y1 : a21 >z1 : a31 diff --git a/tests/baselines/reference/genericsWithDuplicateTypeParameters1.errors.txt b/tests/baselines/reference/genericsWithDuplicateTypeParameters1.errors.txt index 052822f1bad..879a1b52d3b 100644 --- a/tests/baselines/reference/genericsWithDuplicateTypeParameters1.errors.txt +++ b/tests/baselines/reference/genericsWithDuplicateTypeParameters1.errors.txt @@ -1,37 +1,49 @@ +tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts(1,15): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts(2,16): error TS2300: Duplicate identifier 'X'. +tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts(3,12): error TS2300: Duplicate identifier 'X'. +tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts(4,17): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts(5,18): error TS2300: Duplicate identifier 'X'. +tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts(8,16): error TS2300: Duplicate identifier 'X'. +tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts(9,10): error TS2300: Duplicate identifier 'X'. +tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts(10,11): error TS2300: Duplicate identifier 'X'. +tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts(14,22): error TS2300: Duplicate identifier 'X'. +tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts(15,23): error TS2300: Duplicate identifier 'X'. + + ==== tests/cases/compiler/genericsWithDuplicateTypeParameters1.ts (10 errors) ==== function f() { } ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. function f2(a: X, b: X): X { return null; } ~ -!!! Duplicate identifier 'X'. +!!! error TS2300: Duplicate identifier 'X'. class C { ~ -!!! Duplicate identifier 'X'. +!!! error TS2300: Duplicate identifier 'X'. public f() {} ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. public f2(a: X, b: X): X { return null; } ~ -!!! Duplicate identifier 'X'. +!!! error TS2300: Duplicate identifier 'X'. } interface I { ~ -!!! Duplicate identifier 'X'. +!!! error TS2300: Duplicate identifier 'X'. f(); ~ -!!! Duplicate identifier 'X'. +!!! error TS2300: Duplicate identifier 'X'. f2(a: X, b: X): X; ~ -!!! Duplicate identifier 'X'. +!!! error TS2300: Duplicate identifier 'X'. } var m = { a: function f() {}, ~ -!!! Duplicate identifier 'X'. +!!! error TS2300: Duplicate identifier 'X'. b: function f2(a: X, b: X): X { return null; } ~ -!!! Duplicate identifier 'X'. +!!! error TS2300: Duplicate identifier 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericsWithoutTypeParameters1.errors.txt b/tests/baselines/reference/genericsWithoutTypeParameters1.errors.txt index eb0aac2035f..c1382788beb 100644 --- a/tests/baselines/reference/genericsWithoutTypeParameters1.errors.txt +++ b/tests/baselines/reference/genericsWithoutTypeParameters1.errors.txt @@ -1,3 +1,20 @@ +tests/cases/compiler/genericsWithoutTypeParameters1.ts(9,9): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(10,9): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(11,11): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(12,11): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(14,17): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(14,23): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(15,20): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(15,29): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(17,13): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(18,14): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(21,8): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(22,8): error TS2314: Generic type 'D' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(26,8): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(27,8): error TS2314: Generic type 'J' requires 1 type argument(s). +tests/cases/compiler/genericsWithoutTypeParameters1.ts(31,22): error TS2314: Generic type 'A' requires 1 type argument(s). + + ==== tests/cases/compiler/genericsWithoutTypeParameters1.ts (15 errors) ==== class C { foo(): T { return null } @@ -9,56 +26,56 @@ var c1: C; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var i1: I; ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). var c2: C; ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). var i2: I; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). function foo(x: C, y: I) { } ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). function foo2(x: C, y: I) { } ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var x: { a: C } = { a: new C() }; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). var x2: { a: I } = { a: { bar() { return 1 } } }; ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). class D { x: C; ~ -!!! Generic type 'C' requires 1 type argument(s). +!!! error TS2314: Generic type 'C' requires 1 type argument(s). y: D; ~ -!!! Generic type 'D' requires 1 type argument(s). +!!! error TS2314: Generic type 'D' requires 1 type argument(s). } interface J { x: I; ~ -!!! Generic type 'I' requires 1 type argument(s). +!!! error TS2314: Generic type 'I' requires 1 type argument(s). y: J; ~ -!!! Generic type 'J' requires 1 type argument(s). +!!! error TS2314: Generic type 'J' requires 1 type argument(s). } class A { } function f(x: T): A { ~ -!!! Generic type 'A' requires 1 type argument(s). +!!! error TS2314: Generic type 'A' requires 1 type argument(s). return null; } \ No newline at end of file diff --git a/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt b/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt index 2a3e67203c9..a7e8155c220 100644 --- a/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt +++ b/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt @@ -1,12 +1,27 @@ -==== tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts (4 errors) ==== +tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(21,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(1,18): error TS2300: Duplicate identifier '_'. +tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(1,41): error TS2304: Cannot find name '_'. +tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(2,18): error TS2300: Duplicate identifier '_'. +tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(2,34): error TS2304: Cannot find name '_'. +tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(4,16): error TS2300: Duplicate identifier '_'. +tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(15,15): error TS2300: Duplicate identifier '_'. + + +==== tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts (7 errors) ==== declare function _(value: Array): _; + ~ +!!! error TS2300: Duplicate identifier '_'. ~~~~ -!!! Cannot find name '_'. +!!! error TS2304: Cannot find name '_'. declare function _(value: T): _; + ~ +!!! error TS2300: Duplicate identifier '_'. ~~~~ -!!! Cannot find name '_'. +!!! error TS2304: Cannot find name '_'. declare module _ { + ~ +!!! error TS2300: Duplicate identifier '_'. export function each( //list: List, //iterator: ListIterator, @@ -19,7 +34,7 @@ declare class _ { ~ -!!! Duplicate identifier '_'. +!!! error TS2300: Duplicate identifier '_'. each(iterator: _.ListIterator, context?: any): void; } @@ -27,7 +42,7 @@ export class MyClass { public get myGetter() { ~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var obj:any = {}; return obj; diff --git a/tests/baselines/reference/getAndSetAsMemberNames.errors.txt b/tests/baselines/reference/getAndSetAsMemberNames.errors.txt index ca92470e011..a83c4ba118c 100644 --- a/tests/baselines/reference/getAndSetAsMemberNames.errors.txt +++ b/tests/baselines/reference/getAndSetAsMemberNames.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/getAndSetAsMemberNames.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/getAndSetAsMemberNames.ts (1 errors) ==== class C1 { set: boolean; @@ -19,6 +22,6 @@ get (): boolean { return true; } set t(x) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt index dbb4e935f2b..5fe2e7ae321 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt @@ -1,17 +1,23 @@ +tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getAndSetNotIdenticalType.ts(2,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. + + ==== tests/cases/compiler/getAndSetNotIdenticalType.ts (4 errors) ==== class C { get x(): number { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~ return 1; ~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! 'get' and 'set' accessor must have the same type. +!!! error TS2380: 'get' and 'set' accessor must have the same type. set x(v: string) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~~~~ -!!! 'get' and 'set' accessor must have the same type. +!!! error TS2380: 'get' and 'set' accessor must have the same type. } \ No newline at end of file diff --git a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt index 4589f529603..b4843deb9c2 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A': + Type 'string' is not assignable to type 'T'. + + ==== tests/cases/compiler/getAndSetNotIdenticalType2.ts (5 errors) ==== class A { foo: T; } @@ -5,25 +13,25 @@ data: A; get x(): A { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~ return this.data; ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! 'get' and 'set' accessor must have the same type. +!!! error TS2380: 'get' and 'set' accessor must have the same type. set x(v: A) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~~~~~ this.data = v; ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ -!!! Type 'A' is not assignable to type 'A': -!!! Type 'string' is not assignable to type 'T'. +!!! error TS2322: Type 'A' is not assignable to type 'A': +!!! error TS2322: Type 'string' is not assignable to type 'T'. } ~~~~~ -!!! 'get' and 'set' accessor must have the same type. +!!! error TS2380: 'get' and 'set' accessor must have the same type. } var x = new C(); diff --git a/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt index 193f7613202..637c140a1f3 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A': + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/getAndSetNotIdenticalType3.ts (5 errors) ==== class A { foo: T; } @@ -5,25 +13,25 @@ data: A; get x(): A { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~~~~ return this.data; ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! 'get' and 'set' accessor must have the same type. +!!! error TS2380: 'get' and 'set' accessor must have the same type. set x(v: A) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~~~~~ this.data = v; ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ -!!! Type 'A' is not assignable to type 'A': -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'A' is not assignable to type 'A': +!!! error TS2322: Type 'string' is not assignable to type 'number'. } ~~~~~ -!!! 'get' and 'set' accessor must have the same type. +!!! error TS2380: 'get' and 'set' accessor must have the same type. } var x = new C(); diff --git a/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline b/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline new file mode 100644 index 00000000000..4b89414059c --- /dev/null +++ b/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline @@ -0,0 +1,30 @@ +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile1.js +var x = 5; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +Filename : tests/cases/fourslash/inputFile1.d.ts +declare var x: number; +declare class Bar { + x: string; + y: number; +} + +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile2.js +var x1 = "hello world"; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +Filename : tests/cases/fourslash/inputFile2.d.ts +declare var x1: string; +declare class Foo { + x: string; + y: number; +} + diff --git a/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline b/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline new file mode 100644 index 00000000000..545c37a0728 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline @@ -0,0 +1,26 @@ +EmitOutputStatus : Succeeded +Filename : declSingleFile.js +var x = 5; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +var x1 = "hello world"; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +Filename : declSingleFile.d.ts +declare var x: number; +declare class Bar { + x: string; + y: number; +} +declare var x1: string; +declare class Foo { + x: string; + y: number; +} + diff --git a/tests/baselines/reference/getEmitOutputExternalModule.baseline b/tests/baselines/reference/getEmitOutputExternalModule.baseline new file mode 100644 index 00000000000..33360cbed61 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputExternalModule.baseline @@ -0,0 +1,9 @@ +EmitOutputStatus : Succeeded +Filename : declSingleFile.js +var x = 5; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); + diff --git a/tests/baselines/reference/getEmitOutputExternalModule2.baseline b/tests/baselines/reference/getEmitOutputExternalModule2.baseline new file mode 100644 index 00000000000..ede5474d8cc --- /dev/null +++ b/tests/baselines/reference/getEmitOutputExternalModule2.baseline @@ -0,0 +1,15 @@ +EmitOutputStatus : JSGeneratedWithSemanticErrors +Filename : declSingleFile.js +var x = 5; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +var x = "world"; +var Bar2 = (function () { + function Bar2() { + } + return Bar2; +})(); + diff --git a/tests/baselines/reference/getEmitOutputMapRoots.baseline b/tests/baselines/reference/getEmitOutputMapRoots.baseline new file mode 100644 index 00000000000..93dab28e6fc --- /dev/null +++ b/tests/baselines/reference/getEmitOutputMapRoots.baseline @@ -0,0 +1,11 @@ +EmitOutputStatus : Succeeded +Filename : declSingleFile.js.map +{"version":3,"file":"declSingleFile.js","sourceRoot":"","sources":["../tests/cases/fourslash/inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : declSingleFile.js +var x = 109; +var foo = "hello world"; +var M = (function () { + function M() { + } + return M; +})(); +//# sourceMappingURL=mapRootDir/declSingleFile.js.map diff --git a/tests/baselines/reference/getEmitOutputNoErrors.baseline b/tests/baselines/reference/getEmitOutputNoErrors.baseline new file mode 100644 index 00000000000..47ba1435319 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputNoErrors.baseline @@ -0,0 +1,9 @@ +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile.js +var x; +var M = (function () { + function M() { + } + return M; +})(); + diff --git a/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline b/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline new file mode 100644 index 00000000000..1f61d57c81e --- /dev/null +++ b/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline @@ -0,0 +1,9 @@ +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile2.js +var x; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); + diff --git a/tests/baselines/reference/getEmitOutputSingleFile.baseline b/tests/baselines/reference/getEmitOutputSingleFile.baseline new file mode 100644 index 00000000000..dd8f2be8079 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputSingleFile.baseline @@ -0,0 +1,15 @@ +EmitOutputStatus : Succeeded +Filename : outputDir/singleFile.js +var x; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +var x; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); + diff --git a/tests/baselines/reference/getEmitOutputSingleFile2.baseline b/tests/baselines/reference/getEmitOutputSingleFile2.baseline new file mode 100644 index 00000000000..2f5dbe3daf8 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputSingleFile2.baseline @@ -0,0 +1,8 @@ +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile3.js +exports.foo = 10; +exports.bar = "hello world"; +Filename : tests/cases/fourslash/inputFile3.d.ts +export declare var foo: number; +export declare var bar: string; + diff --git a/tests/baselines/reference/getEmitOutputSourceMap.baseline b/tests/baselines/reference/getEmitOutputSourceMap.baseline new file mode 100644 index 00000000000..75ee2a26617 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputSourceMap.baseline @@ -0,0 +1,11 @@ +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile.js.map +{"version":3,"file":"inputFile.js","sourceRoot":"","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile.js +var x = 109; +var foo = "hello world"; +var M = (function () { + function M() { + } + return M; +})(); +//# sourceMappingURL=inputFile.js.map diff --git a/tests/baselines/reference/getEmitOutputSourceMap2.baseline b/tests/baselines/reference/getEmitOutputSourceMap2.baseline new file mode 100644 index 00000000000..2c132d8cd66 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputSourceMap2.baseline @@ -0,0 +1,19 @@ +EmitOutputStatus : Succeeded +Filename : sample/outDir/inputFile1.js.map +{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : sample/outDir/inputFile1.js +var x = 109; +var foo = "hello world"; +var M = (function () { + function M() { + } + return M; +})(); +//# sourceMappingURL=inputFile1.js.map +EmitOutputStatus : Succeeded +Filename : sample/outDir/inputFile2.js.map +{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile2.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,aAAa,CAAC;AAC1B,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,GAAG,EAAE,CAAC;AACd,CAAC"}Filename : sample/outDir/inputFile2.js +var intro = "hello world"; +if (intro !== undefined) { + var k = 10; +} +//# sourceMappingURL=inputFile2.js.map diff --git a/tests/baselines/reference/getEmitOutputSourceRoot.baseline b/tests/baselines/reference/getEmitOutputSourceRoot.baseline new file mode 100644 index 00000000000..9252163165b --- /dev/null +++ b/tests/baselines/reference/getEmitOutputSourceRoot.baseline @@ -0,0 +1,11 @@ +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile.js.map +{"version":3,"file":"inputFile.js","sourceRoot":"sourceRootDir/","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile.js +var x = 109; +var foo = "hello world"; +var M = (function () { + function M() { + } + return M; +})(); +//# sourceMappingURL=inputFile.js.map diff --git a/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline b/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline new file mode 100644 index 00000000000..5c26a1920f9 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline @@ -0,0 +1,21 @@ +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile1.js.map +{"version":3,"file":"inputFile1.js","sourceRoot":"sourceRootDir/","sources":["inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile1.js +var x = 109; +var foo = "hello world"; +var M = (function () { + function M() { + } + return M; +})(); +//# sourceMappingURL=inputFile1.js.map +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile2.js.map +{"version":3,"file":"inputFile2.js","sourceRoot":"sourceRootDir/","sources":["inputFile2.ts"],"names":["C","C.constructor"],"mappings":"AAAA,IAAI,GAAG,GAAG,wBAAwB,CAAC;AACnC,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile2.js +var bar = "hello world Typescript"; +var C = (function () { + function C() { + } + return C; +})(); +//# sourceMappingURL=inputFile2.js.map diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline new file mode 100644 index 00000000000..be0ac935601 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline @@ -0,0 +1,11 @@ +EmitOutputStatus : Succeeded + +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile2.js +var x1 = "hello world"; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); + diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline new file mode 100644 index 00000000000..92a1ea1fe7a --- /dev/null +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline @@ -0,0 +1,15 @@ +EmitOutputStatus : Succeeded + +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile2.js +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +exports.Foo = Foo; + +EmitOutputStatus : Succeeded +Filename : tests/cases/fourslash/inputFile3.js +var x = "hello"; + diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline new file mode 100644 index 00000000000..f960a05f151 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline @@ -0,0 +1,5 @@ +EmitOutputStatus : Succeeded +Filename : declSingle.js +var x = "hello"; +var x1 = 1000; + diff --git a/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline b/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline new file mode 100644 index 00000000000..f16e3810592 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline @@ -0,0 +1,12 @@ +EmitOutputStatus : EmitErrorsEncountered +Filename : tests/cases/fourslash/inputFile.js +var M; +(function (M) { + var C = (function () { + function C() { + } + return C; + })(); + M.foo = new C(); +})(M || (M = {})); + diff --git a/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline b/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline new file mode 100644 index 00000000000..4befff0466c --- /dev/null +++ b/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline @@ -0,0 +1,14 @@ +EmitOutputStatus : EmitErrorsEncountered +Filename : tests/cases/fourslash/inputFile.js +define(["require", "exports"], function (require, exports) { + var C = (function () { + function C() { + } + return C; + })(); + var M; + (function (M) { + M.foo = new C(); + })(M = exports.M || (exports.M = {})); +}); + diff --git a/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline b/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline new file mode 100644 index 00000000000..fed9a4d2089 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline @@ -0,0 +1,4 @@ +EmitOutputStatus : JSGeneratedWithSemanticErrors +Filename : tests/cases/fourslash/inputFile.js +var x = "hello world"; + diff --git a/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline b/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline new file mode 100644 index 00000000000..a2e296b85e2 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline @@ -0,0 +1,4 @@ +EmitOutputStatus : DeclarationGenerationSkipped +Filename : tests/cases/fourslash/inputFile.js +var x = "hello world"; + diff --git a/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline b/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline new file mode 100644 index 00000000000..a5d5d2eb9d7 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline @@ -0,0 +1,2 @@ +EmitOutputStatus : AllOutputGenerationSkipped + diff --git a/tests/baselines/reference/getsetReturnTypes.errors.txt b/tests/baselines/reference/getsetReturnTypes.errors.txt index 8b9b68e87cc..2a69548c7aa 100644 --- a/tests/baselines/reference/getsetReturnTypes.errors.txt +++ b/tests/baselines/reference/getsetReturnTypes.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/getsetReturnTypes.ts(3,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/getsetReturnTypes.ts (1 errors) ==== function makePoint(x: number) { return { get x() { return x; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } }; var x = makePoint(2).x; diff --git a/tests/baselines/reference/getterMissingReturnError.errors.txt b/tests/baselines/reference/getterMissingReturnError.errors.txt index ae560c5de87..8900cc5e78f 100644 --- a/tests/baselines/reference/getterMissingReturnError.errors.txt +++ b/tests/baselines/reference/getterMissingReturnError.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/getterMissingReturnError.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/getterMissingReturnError.ts(2,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + + ==== tests/cases/compiler/getterMissingReturnError.ts (2 errors) ==== class test { public get p2(){ ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. } } diff --git a/tests/baselines/reference/getterThatThrowsShouldNotNeedReturn.errors.txt b/tests/baselines/reference/getterThatThrowsShouldNotNeedReturn.errors.txt index 8b1a7a10a3a..563f30a201c 100644 --- a/tests/baselines/reference/getterThatThrowsShouldNotNeedReturn.errors.txt +++ b/tests/baselines/reference/getterThatThrowsShouldNotNeedReturn.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/getterThatThrowsShouldNotNeedReturn.ts(2,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/getterThatThrowsShouldNotNeedReturn.ts (1 errors) ==== class Greeter { public get greet(): string { ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. throw ''; // should not raise an error } public greeting(): string { diff --git a/tests/baselines/reference/gettersAndSetters.errors.txt b/tests/baselines/reference/gettersAndSetters.errors.txt index c17653545fa..2c287f30497 100644 --- a/tests/baselines/reference/gettersAndSetters.errors.txt +++ b/tests/baselines/reference/gettersAndSetters.errors.txt @@ -1,3 +1,13 @@ +tests/cases/compiler/gettersAndSetters.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSetters.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSetters.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSetters.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSetters.ts(29,30): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSetters.ts(29,53): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSetters.ts(25,13): error TS2339: Property 'Baz' does not exist on type 'C'. +tests/cases/compiler/gettersAndSetters.ts(26,3): error TS2339: Property 'Baz' does not exist on type 'C'. + + ==== tests/cases/compiler/gettersAndSetters.ts (8 errors) ==== // classes class C { @@ -7,17 +17,17 @@ public get Foo() { return this.fooBack;} // ok ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set Foo(foo:string) {this.fooBack = foo;} // ok ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static get Bar() {return C.barBack;} // ok ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. static set Bar(bar:string) {C.barBack = bar;} // ok ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get = function() {} // ok public set = function() {} // ok @@ -33,17 +43,17 @@ var baz = c.Baz; ~~~ -!!! Property 'Baz' does not exist on type 'C'. +!!! error TS2339: Property 'Baz' does not exist on type 'C'. c.Baz = "bazv"; ~~~ -!!! Property 'Baz' does not exist on type 'C'. +!!! error TS2339: Property 'Baz' does not exist on type 'C'. // The Foo accessors' return and param types should be contextually typed to the Foo field var o : {Foo:number;} = {get Foo() {return 0;}, set Foo(val:number){val}}; // o ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var ofg = o.Foo; o.Foo = 0; diff --git a/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt b/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt index df23e0da362..ddb8e95e5eb 100644 --- a/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt +++ b/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt @@ -1,14 +1,20 @@ +tests/cases/compiler/gettersAndSettersAccessibility.ts(2,14): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersAccessibility.ts(2,14): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS2379: Getter and setter accessors do not agree in visibility. + + ==== tests/cases/compiler/gettersAndSettersAccessibility.ts (4 errors) ==== class C99 { private get Baz():number { return 0; } ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Getter and setter accessors do not agree in visibility. +!!! error TS2379: Getter and setter accessors do not agree in visibility. public set Baz(n:number) {} // error - accessors do not agree in visibility ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Getter and setter accessors do not agree in visibility. +!!! error TS2379: Getter and setter accessors do not agree in visibility. } \ No newline at end of file diff --git a/tests/baselines/reference/gettersAndSettersErrors.errors.txt b/tests/baselines/reference/gettersAndSettersErrors.errors.txt index 1cfefea5202..95fb571d9b8 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.errors.txt +++ b/tests/baselines/reference/gettersAndSettersErrors.errors.txt @@ -1,34 +1,51 @@ -==== tests/cases/compiler/gettersAndSettersErrors.ts (9 errors) ==== +tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersErrors.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersErrors.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and setter accessors do not agree in visibility. + + +==== tests/cases/compiler/gettersAndSettersErrors.ts (11 errors) ==== class C { public get Foo() { return "foo";} // ok ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'Foo'. public set Foo(foo:string) {} // ok ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'Foo'. public Foo = 0; // error - duplicate identifier Foo - confirmed ~~~ -!!! Duplicate identifier 'Foo'. +!!! error TS2300: Duplicate identifier 'Foo'. public get Goo(v:string):string {return null;} // error - getters must not have a parameter ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set Goo(v:string):string {} // error - setters must not specify a return type ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } class E { private get Baz():number { return 0; } ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Getter and setter accessors do not agree in visibility. +!!! error TS2379: Getter and setter accessors do not agree in visibility. public set Baz(n:number) {} // error - accessors do not agree in visibility ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Getter and setter accessors do not agree in visibility. +!!! error TS2379: Getter and setter accessors do not agree in visibility. } diff --git a/tests/baselines/reference/gettersAndSettersTypesAgree.errors.txt b/tests/baselines/reference/gettersAndSettersTypesAgree.errors.txt index 5b869132a70..7412b56e576 100644 --- a/tests/baselines/reference/gettersAndSettersTypesAgree.errors.txt +++ b/tests/baselines/reference/gettersAndSettersTypesAgree.errors.txt @@ -1,27 +1,37 @@ +tests/cases/compiler/gettersAndSettersTypesAgree.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersTypesAgree.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersTypesAgree.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersTypesAgree.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersTypesAgree.ts(9,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersTypesAgree.ts(9,37): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersTypesAgree.ts(10,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersTypesAgree.ts(10,37): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/gettersAndSettersTypesAgree.ts (8 errors) ==== class C { public get Foo() { return "foo";} // ok ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set Foo(foo) {} // ok - type inferred from getter return statement ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get Bar() { return "foo";} // ok ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set Bar(bar:string) {} // ok - type must be declared ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } var o1 = {get Foo(){return 0;}, set Foo(val){}}; // ok - types agree (inference) ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var o2 = {get Foo(){return 0;}, set Foo(val:number){}}; // ok - types agree ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. \ No newline at end of file +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index 9f15a5061a3..5ef1393915d 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -1,4 +1,287 @@ -==== tests/cases/compiler/giant.ts (227 errors) ==== +tests/cases/compiler/giant.ts(25,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(27,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(29,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(31,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(35,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(37,1): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(61,6): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(89,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(91,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(93,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(95,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(99,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(101,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(125,10): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(154,39): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(168,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(170,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(172,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(174,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(178,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(180,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(204,10): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(233,39): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(238,35): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(240,24): error TS1111: A constructor implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(243,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(244,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(245,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(246,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(247,31): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(248,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(249,23): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(250,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(251,32): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(252,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(254,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(255,31): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(256,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(257,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(258,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(262,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(262,25): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(267,30): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(267,33): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(283,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(285,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(287,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(289,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(293,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(295,1): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(319,6): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(347,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(349,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(351,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(353,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(357,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(359,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(383,10): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(412,39): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(426,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(428,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(430,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(432,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(436,9): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(438,5): error TS1005: '{' expected. +tests/cases/compiler/giant.ts(462,10): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(491,39): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(496,35): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(498,24): error TS1111: A constructor implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(501,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(502,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(503,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(504,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(505,31): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(506,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(507,23): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(508,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(509,32): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(510,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(512,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(513,31): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(514,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(515,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(516,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(520,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(520,25): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(525,30): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(525,33): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(532,31): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(534,20): error TS1111: A constructor implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(537,17): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(538,18): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(539,18): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(540,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(541,27): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(542,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(543,19): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(544,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(545,28): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(546,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(548,17): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(549,27): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(550,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(551,18): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(552,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(556,18): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(558,24): error TS1111: A constructor implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(561,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(563,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(587,10): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(606,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(606,25): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(611,30): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(611,33): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(615,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. +tests/cases/compiler/giant.ts(616,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. +tests/cases/compiler/giant.ts(616,39): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(616,42): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(617,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. +tests/cases/compiler/giant.ts(618,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. +tests/cases/compiler/giant.ts(621,26): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(621,29): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(623,24): error TS1111: A constructor implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(626,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(628,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(653,10): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(672,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(672,25): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(676,30): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(676,33): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(23,12): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(24,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(24,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(25,12): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(26,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(27,13): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(28,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(28,17): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(29,13): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(30,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(33,12): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(36,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(76,5): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/giant.ts(87,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(88,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(88,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(89,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(90,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(91,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(92,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(92,21): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(93,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(94,21): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(97,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(100,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(140,9): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/giant.ts(166,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(167,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(167,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(168,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(169,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(170,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(171,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(171,21): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(172,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(173,21): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(176,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(179,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(219,9): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/giant.ts(245,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(246,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(247,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(248,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(249,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(250,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(251,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(252,21): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(255,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(256,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(257,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(258,20): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(281,12): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(282,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(282,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(283,12): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(284,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(285,13): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(286,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(286,17): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(287,13): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(288,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(291,12): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(294,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(334,5): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/giant.ts(345,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(346,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(346,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(347,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(348,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(349,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(350,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(350,21): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(351,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(352,21): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(355,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(358,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(398,9): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/giant.ts(424,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(425,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(425,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(426,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(427,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(428,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(429,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(429,21): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(430,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(431,21): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(434,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(437,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/giant.ts(477,9): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/giant.ts(503,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(504,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(505,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(506,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(507,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(508,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(509,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(510,21): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(513,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(514,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(515,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(516,20): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(539,12): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(540,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(541,12): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(542,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(543,13): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(544,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(545,13): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(546,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(549,12): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(550,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(551,12): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(552,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required. + + +==== tests/cases/compiler/giant.ts (281 errors) ==== /* Prefixes @@ -22,50 +305,62 @@ public pF() { } private rF() { } public pgF() { } + ~~~ +!!! error TS2300: Duplicate identifier 'pgF'. public get pgF() ~~~ -!!! Duplicate identifier 'pgF'. +!!! error TS2300: Duplicate identifier 'pgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. public psF(param:any) { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'psF'. public set psF(param:any) ~~~ -!!! Duplicate identifier 'psF'. +!!! error TS2300: Duplicate identifier 'psF'. private rgF() { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rgF'. private get rgF() ~~~ -!!! Duplicate identifier 'rgF'. +!!! error TS2300: Duplicate identifier 'rgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. private rsF(param:any) { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rsF'. private set rsF(param:any) ~~~ -!!! Duplicate identifier 'rsF'. +!!! error TS2300: Duplicate identifier 'rsF'. static tV; ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. static tF() { } static tsF(param:any) { } + ~~~ +!!! error TS2300: Duplicate identifier 'tsF'. static set tsF(param:any) ~~~ -!!! Duplicate identifier 'tsF'. +!!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'tgF'. static get tgF() ~~~ -!!! Duplicate identifier 'tgF'. +!!! error TS2300: Duplicate identifier 'tgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. } ~ -!!! '{' expected. +!!! error TS1005: '{' expected. interface I { //Call Signature (); @@ -91,13 +386,13 @@ //Index Signature [p]; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [p1: string]; ~~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [p2: string, p3: number]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. //Property Signature p; @@ -112,7 +407,7 @@ p7(pa1, pa2): void; p7? (pa1, pa2): void; ~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. } module M { var V; @@ -124,50 +419,62 @@ public pF() { } private rF() { } public pgF() { } + ~~~ +!!! error TS2300: Duplicate identifier 'pgF'. public get pgF() ~~~ -!!! Duplicate identifier 'pgF'. +!!! error TS2300: Duplicate identifier 'pgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. public psF(param:any) { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'psF'. public set psF(param:any) ~~~ -!!! Duplicate identifier 'psF'. +!!! error TS2300: Duplicate identifier 'psF'. private rgF() { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rgF'. private get rgF() ~~~ -!!! Duplicate identifier 'rgF'. +!!! error TS2300: Duplicate identifier 'rgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. private rsF(param:any) { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rsF'. private set rsF(param:any) ~~~ -!!! Duplicate identifier 'rsF'. +!!! error TS2300: Duplicate identifier 'rsF'. static tV; ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. static tF() { } static tsF(param:any) { } + ~~~ +!!! error TS2300: Duplicate identifier 'tsF'. static set tsF(param:any) ~~~ -!!! Duplicate identifier 'tsF'. +!!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'tgF'. static get tgF() ~~~ -!!! Duplicate identifier 'tgF'. +!!! error TS2300: Duplicate identifier 'tgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. } ~ -!!! '{' expected. +!!! error TS1005: '{' expected. interface I { //Call Signature (); @@ -193,13 +500,13 @@ //Index Signature [p]; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [p1: string]; ~~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [p2: string, p3: number]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. //Property Signature p; @@ -214,7 +521,7 @@ p7(pa1, pa2): void; p7? (pa1, pa2): void; ~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. } module M { var V; @@ -230,7 +537,7 @@ export declare var eaV; export declare function eaF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. export declare class eaC { }; export declare module eaM { }; } @@ -243,50 +550,62 @@ public pF() { } private rF() { } public pgF() { } + ~~~ +!!! error TS2300: Duplicate identifier 'pgF'. public get pgF() ~~~ -!!! Duplicate identifier 'pgF'. +!!! error TS2300: Duplicate identifier 'pgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. public psF(param:any) { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'psF'. public set psF(param:any) ~~~ -!!! Duplicate identifier 'psF'. +!!! error TS2300: Duplicate identifier 'psF'. private rgF() { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rgF'. private get rgF() ~~~ -!!! Duplicate identifier 'rgF'. +!!! error TS2300: Duplicate identifier 'rgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. private rsF(param:any) { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rsF'. private set rsF(param:any) ~~~ -!!! Duplicate identifier 'rsF'. +!!! error TS2300: Duplicate identifier 'rsF'. static tV; ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. static tF() { } static tsF(param:any) { } + ~~~ +!!! error TS2300: Duplicate identifier 'tsF'. static set tsF(param:any) ~~~ -!!! Duplicate identifier 'tsF'. +!!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'tgF'. static get tgF() ~~~ -!!! Duplicate identifier 'tgF'. +!!! error TS2300: Duplicate identifier 'tgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. } ~ -!!! '{' expected. +!!! error TS1005: '{' expected. export interface eI { //Call Signature (); @@ -312,13 +631,13 @@ //Index Signature [p]; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [p1: string]; ~~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [p2: string, p3: number]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. //Property Signature p; @@ -333,7 +652,7 @@ p7(pa1, pa2): void; p7? (pa1, pa2): void; ~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. } export module eM { var V; @@ -349,95 +668,107 @@ export declare var eaV; export declare function eaF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. export declare class eaC { }; export declare module eaM { }; } export declare var eaV; export declare function eaF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. export declare class eaC { constructor () { } ~ -!!! A constructor implementation cannot be declared in an ambient context. +!!! error TS1111: A constructor implementation cannot be declared in an ambient context. public pV; private rV; public pF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. private rF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. public pgF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'pgF'. public get pgF() ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'pgF'. +!!! error TS2300: Duplicate identifier 'pgF'. public psF(param:any) { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'psF'. public set psF(param:any) ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'psF'. +!!! error TS2300: Duplicate identifier 'psF'. private rgF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'rgF'. private get rgF() ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'rgF'. +!!! error TS2300: Duplicate identifier 'rgF'. private rsF(param:any) { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'rsF'. private set rsF(param:any) ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'rsF'. +!!! error TS2300: Duplicate identifier 'rsF'. static tV; static tF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. static tsF(param:any) { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'tsF'. static set tsF(param:any) ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'tsF'. +!!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'tgF'. static get tgF() ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'tgF'. +!!! error TS2300: Duplicate identifier 'tgF'. } export declare module eaM { var V; function F() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. class C { } interface I { } module M { } export var eV; export function eF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. export class eC { } export interface eI { } export module eM { } @@ -452,50 +783,62 @@ public pF() { } private rF() { } public pgF() { } + ~~~ +!!! error TS2300: Duplicate identifier 'pgF'. public get pgF() ~~~ -!!! Duplicate identifier 'pgF'. +!!! error TS2300: Duplicate identifier 'pgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. public psF(param:any) { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'psF'. public set psF(param:any) ~~~ -!!! Duplicate identifier 'psF'. +!!! error TS2300: Duplicate identifier 'psF'. private rgF() { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rgF'. private get rgF() ~~~ -!!! Duplicate identifier 'rgF'. +!!! error TS2300: Duplicate identifier 'rgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. private rsF(param:any) { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rsF'. private set rsF(param:any) ~~~ -!!! Duplicate identifier 'rsF'. +!!! error TS2300: Duplicate identifier 'rsF'. static tV; ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. static tF() { } static tsF(param:any) { } + ~~~ +!!! error TS2300: Duplicate identifier 'tsF'. static set tsF(param:any) ~~~ -!!! Duplicate identifier 'tsF'. +!!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'tgF'. static get tgF() ~~~ -!!! Duplicate identifier 'tgF'. +!!! error TS2300: Duplicate identifier 'tgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. } ~ -!!! '{' expected. +!!! error TS1005: '{' expected. export interface eI { //Call Signature (); @@ -521,13 +864,13 @@ //Index Signature [p]; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [p1: string]; ~~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [p2: string, p3: number]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. //Property Signature p; @@ -542,7 +885,7 @@ p7(pa1, pa2): void; p7? (pa1, pa2): void; ~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. } export module eM { var V; @@ -554,50 +897,62 @@ public pF() { } private rF() { } public pgF() { } + ~~~ +!!! error TS2300: Duplicate identifier 'pgF'. public get pgF() ~~~ -!!! Duplicate identifier 'pgF'. +!!! error TS2300: Duplicate identifier 'pgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. public psF(param:any) { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'psF'. public set psF(param:any) ~~~ -!!! Duplicate identifier 'psF'. +!!! error TS2300: Duplicate identifier 'psF'. private rgF() { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rgF'. private get rgF() ~~~ -!!! Duplicate identifier 'rgF'. +!!! error TS2300: Duplicate identifier 'rgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. private rsF(param:any) { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rsF'. private set rsF(param:any) ~~~ -!!! Duplicate identifier 'rsF'. +!!! error TS2300: Duplicate identifier 'rsF'. static tV; ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. static tF() { } static tsF(param:any) { } + ~~~ +!!! error TS2300: Duplicate identifier 'tsF'. static set tsF(param:any) ~~~ -!!! Duplicate identifier 'tsF'. +!!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'tgF'. static get tgF() ~~~ -!!! Duplicate identifier 'tgF'. +!!! error TS2300: Duplicate identifier 'tgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. } ~ -!!! '{' expected. +!!! error TS1005: '{' expected. interface I { //Call Signature (); @@ -623,13 +978,13 @@ //Index Signature [p]; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [p1: string]; ~~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [p2: string, p3: number]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. //Property Signature p; @@ -644,7 +999,7 @@ p7(pa1, pa2): void; p7? (pa1, pa2): void; ~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. } module M { var V; @@ -660,7 +1015,7 @@ export declare var eaV; export declare function eaF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. export declare class eaC { }; export declare module eaM { }; } @@ -673,50 +1028,62 @@ public pF() { } private rF() { } public pgF() { } + ~~~ +!!! error TS2300: Duplicate identifier 'pgF'. public get pgF() ~~~ -!!! Duplicate identifier 'pgF'. +!!! error TS2300: Duplicate identifier 'pgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. public psF(param:any) { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'psF'. public set psF(param:any) ~~~ -!!! Duplicate identifier 'psF'. +!!! error TS2300: Duplicate identifier 'psF'. private rgF() { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rgF'. private get rgF() ~~~ -!!! Duplicate identifier 'rgF'. +!!! error TS2300: Duplicate identifier 'rgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. private rsF(param:any) { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'rsF'. private set rsF(param:any) ~~~ -!!! Duplicate identifier 'rsF'. +!!! error TS2300: Duplicate identifier 'rsF'. static tV; ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. static tF() { } static tsF(param:any) { } + ~~~ +!!! error TS2300: Duplicate identifier 'tsF'. static set tsF(param:any) ~~~ -!!! Duplicate identifier 'tsF'. +!!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } ~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. + ~~~ +!!! error TS2300: Duplicate identifier 'tgF'. static get tgF() ~~~ -!!! Duplicate identifier 'tgF'. +!!! error TS2300: Duplicate identifier 'tgF'. ~~~ -!!! A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. } ~ -!!! '{' expected. +!!! error TS1005: '{' expected. export interface eI { //Call Signature (); @@ -742,13 +1109,13 @@ //Index Signature [p]; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [p1: string]; ~~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [p2: string, p3: number]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. //Property Signature p; @@ -763,7 +1130,7 @@ p7(pa1, pa2): void; p7? (pa1, pa2): void; ~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. } export module eM { var V; @@ -779,95 +1146,107 @@ export declare var eaV; export declare function eaF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. export declare class eaC { }; export declare module eaM { }; } export declare var eaV; export declare function eaF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. export declare class eaC { constructor () { } ~ -!!! A constructor implementation cannot be declared in an ambient context. +!!! error TS1111: A constructor implementation cannot be declared in an ambient context. public pV; private rV; public pF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. private rF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. public pgF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'pgF'. public get pgF() ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'pgF'. +!!! error TS2300: Duplicate identifier 'pgF'. public psF(param:any) { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'psF'. public set psF(param:any) ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'psF'. +!!! error TS2300: Duplicate identifier 'psF'. private rgF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'rgF'. private get rgF() ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'rgF'. +!!! error TS2300: Duplicate identifier 'rgF'. private rsF(param:any) { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'rsF'. private set rsF(param:any) ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'rsF'. +!!! error TS2300: Duplicate identifier 'rsF'. static tV; static tF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. static tsF(param:any) { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'tsF'. static set tsF(param:any) ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'tsF'. +!!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'tgF'. static get tgF() ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'tgF'. +!!! error TS2300: Duplicate identifier 'tgF'. } export declare module eaM { var V; function F() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. class C { } interface I { } module M { } export var eV; export function eF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. export class eC { } export interface eI { } export module eM { } @@ -876,92 +1255,104 @@ export declare var eaV; export declare function eaF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. export declare class eaC { constructor () { } ~ -!!! A constructor implementation cannot be declared in an ambient context. +!!! error TS1111: A constructor implementation cannot be declared in an ambient context. public pV; private rV; public pF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. private rF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. public pgF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'pgF'. public get pgF() ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'pgF'. +!!! error TS2300: Duplicate identifier 'pgF'. public psF(param:any) { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'psF'. public set psF(param:any) ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'psF'. +!!! error TS2300: Duplicate identifier 'psF'. private rgF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'rgF'. private get rgF() ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'rgF'. +!!! error TS2300: Duplicate identifier 'rgF'. private rsF(param:any) { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'rsF'. private set rsF(param:any) ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'rsF'. +!!! error TS2300: Duplicate identifier 'rsF'. static tV; static tF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. static tsF(param:any) { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'tsF'. static set tsF(param:any) ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'tsF'. +!!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. + ~~~ +!!! error TS2300: Duplicate identifier 'tgF'. static get tgF() ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! Duplicate identifier 'tgF'. +!!! error TS2300: Duplicate identifier 'tgF'. } export declare module eaM { var V; function F() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. class C { constructor () { } ~ -!!! A constructor implementation cannot be declared in an ambient context. +!!! error TS1111: A constructor implementation cannot be declared in an ambient context. public pV; private rV; public pF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. static tV; static tF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. } interface I { //Call Signature @@ -987,13 +1378,13 @@ //Index Signature [p]; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [p1: string]; ~~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [p2: string, p3: number]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. //Property Signature p; @@ -1008,63 +1399,63 @@ p7(pa1, pa2): void; p7? (pa1, pa2): void; ~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. } module M { var V; function F() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. class C { } interface I { } module M { } export var eV; export function eF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. export class eC { } export interface eI { } export module eM { } export declare var eaV ~~~~~~~ -!!! A 'declare' modifier cannot be used in an already ambient context. +!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. export declare function eaF() { }; ~~~~~~~ -!!! A 'declare' modifier cannot be used in an already ambient context. +!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. export declare class eaC { } ~~~~~~~ -!!! A 'declare' modifier cannot be used in an already ambient context. +!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. export declare module eaM { } ~~~~~~~ -!!! A 'declare' modifier cannot be used in an already ambient context. +!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. } export var eV; export function eF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. export class eC { constructor () { } ~ -!!! A constructor implementation cannot be declared in an ambient context. +!!! error TS1111: A constructor implementation cannot be declared in an ambient context. public pV; private rV; public pF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. static tV static tF() { } ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. } export interface eI { //Call Signature @@ -1091,13 +1482,13 @@ //Index Signature [p]; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [p1: string]; ~~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [p2: string, p3: number]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. //Property Signature p; @@ -1112,23 +1503,23 @@ p7(pa1, pa2): void; p7? (pa1, pa2): void; ~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. } export module eM { var V; function F() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. class C { } module M { } export var eV; export function eF() { }; ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. export class eC { } export interface eI { } export module eM { } diff --git a/tests/baselines/reference/grammarAmbiguities.errors.txt b/tests/baselines/reference/grammarAmbiguities.errors.txt index ac6cadc92e4..3d21f10de7b 100644 --- a/tests/baselines/reference/grammarAmbiguities.errors.txt +++ b/tests/baselines/reference/grammarAmbiguities.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/expressions/functionCalls/grammarAmbiguities.ts(8,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/expressions/functionCalls/grammarAmbiguities.ts(9,1): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/conformance/expressions/functionCalls/grammarAmbiguities.ts (2 errors) ==== function f(n: any) { return null; } function g(x: any) { return null; } @@ -8,9 +12,9 @@ f(g(7)); f(g < A, B > 7); // Should error ~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. f(g < A, B > +(7)); // Should error ~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/grammarAmbiguities1.errors.txt b/tests/baselines/reference/grammarAmbiguities1.errors.txt index 0c52ec2c98a..12df5f3c1e0 100644 --- a/tests/baselines/reference/grammarAmbiguities1.errors.txt +++ b/tests/baselines/reference/grammarAmbiguities1.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/grammarAmbiguities1.ts(8,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/grammarAmbiguities1.ts(8,3): error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. +tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. +tests/cases/compiler/grammarAmbiguities1.ts(9,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/grammarAmbiguities1.ts(9,3): error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. +tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. + + ==== tests/cases/compiler/grammarAmbiguities1.ts (6 errors) ==== class A { foo() { } } class B { bar() { }} @@ -8,16 +16,16 @@ f(g(7)); f(g < A, B > 7); ~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. ~~~~~ -!!! Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. +!!! error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. ~~~~~ -!!! Operator '>' cannot be applied to types 'typeof B' and 'number'. +!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. f(g < A, B > +(7)); ~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. ~~~~~ -!!! Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. +!!! error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. ~~~~~~~~ -!!! Operator '>' cannot be applied to types 'typeof B' and 'number'. +!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt index 0eaf7593c56..985aaa7948c 100644 --- a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt +++ b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,19): error TS2345: Argument of type 'Array' is not assignable to parameter of type 'string[]'. + Type 'string | number' is not assignable to type 'string': + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/heterogeneousArrayAndOverloads.ts (1 errors) ==== class arrTest { test(arg1: number[]); @@ -9,7 +14,8 @@ this.test([]); this.test([1, 2, "hi", 5]); // Error ~~~~~~~~~~~~~~~ -!!! Argument of type '{}[]' is not assignable to parameter of type 'string[]'. -!!! Type '{}' is not assignable to type 'string'. +!!! error TS2345: Argument of type 'Array' is not assignable to parameter of type 'string[]'. +!!! error TS2345: Type 'string | number' is not assignable to type 'string': +!!! error TS2345: Type 'number' is not assignable to type 'string'. } } \ No newline at end of file diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.types b/tests/baselines/reference/heterogeneousArrayLiterals.types index 81770731633..c236fe7ff6d 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.types +++ b/tests/baselines/reference/heterogeneousArrayLiterals.types @@ -2,16 +2,16 @@ // type of an array is the best common type of its elements (plus its contextual type if it exists) var a = [1, '']; // {}[] ->a : {}[] ->[1, ''] : {}[] +>a : Array +>[1, ''] : Array var b = [1, null]; // number[] >b : number[] >[1, null] : number[] var c = [1, '', null]; // {}[] ->c : {}[] ->[1, '', null] : {}[] +>c : Array +>[1, '', null] : Array var d = [{}, 1]; // {}[] >d : {}[] @@ -31,8 +31,8 @@ var f = [[], [1]]; // number[][] >[1] : number[] var g = [[1], ['']]; // {}[] ->g : {}[] ->[[1], ['']] : {}[] +>g : Array +>[[1], ['']] : Array >[1] : number[] >[''] : string[] @@ -46,8 +46,8 @@ var h = [{ foo: 1, bar: '' }, { foo: 2 }]; // {foo: number}[] >foo : number var i = [{ foo: 1, bar: '' }, { foo: '' }]; // {}[] ->i : {}[] ->[{ foo: 1, bar: '' }, { foo: '' }] : {}[] +>i : Array<{ foo: number; bar: string; } | { foo: string; }> +>[{ foo: 1, bar: '' }, { foo: '' }] : Array<{ foo: number; bar: string; } | { foo: string; }> >{ foo: 1, bar: '' } : { foo: number; bar: string; } >foo : number >bar : string @@ -55,8 +55,8 @@ var i = [{ foo: 1, bar: '' }, { foo: '' }]; // {}[] >foo : string var j = [() => 1, () => '']; // {}[] ->j : {}[] ->[() => 1, () => ''] : {}[] +>j : Array<{ (): number; } | { (): string; }> +>[() => 1, () => ''] : Array<{ (): number; } | { (): string; }> >() => 1 : () => number >() => '' : () => string @@ -80,8 +80,8 @@ var m = [() => 1, () => '', () => null]; // { (): any }[] >() => null : () => any var n = [[() => 1], [() => '']]; // {}[] ->n : {}[] ->[[() => 1], [() => '']] : {}[] +>n : Array<{ (): number; }[] | { (): string; }[]> +>[[() => 1], [() => '']] : Array<{ (): number; }[] | { (): string; }[]> >[() => 1] : { (): number; }[] >() => 1 : () => number >[() => ''] : { (): string; }[] @@ -129,8 +129,8 @@ module Derived { >base : Base var i = [{ foo: base, basear: derived }, { foo: derived }]; // {foo: Derived}[] ->i : {}[] ->[{ foo: base, basear: derived }, { foo: derived }] : {}[] +>i : Array<{ foo: Base; basear: Derived; } | { foo: Derived; }> +>[{ foo: base, basear: derived }, { foo: derived }] : Array<{ foo: Base; basear: Derived; } | { foo: Derived; }> >{ foo: base, basear: derived } : { foo: Base; basear: Derived; } >foo : Base >base : Base @@ -149,8 +149,8 @@ module Derived { >derived : Derived var k = [() => base, () => 1]; // {}[]~ ->k : {}[] ->[() => base, () => 1] : {}[] +>k : Array<{ (): Base; } | { (): number; }> +>[() => base, () => 1] : Array<{ (): Base; } | { (): number; }> >() => base : () => Base >base : Base >() => 1 : () => number @@ -182,8 +182,8 @@ module Derived { >derived : Derived var o = [derived, derived2]; // {}[] ->o : {}[] ->[derived, derived2] : {}[] +>o : Array +>[derived, derived2] : Array >derived : Derived >derived2 : Derived2 @@ -195,8 +195,8 @@ module Derived { >base : Base var q = [[() => derived2], [() => derived]]; // {}[] ->q : {}[] ->[[() => derived2], [() => derived]] : {}[] +>q : Array<{ (): Derived2; }[] | { (): Derived; }[]> +>[[() => derived2], [() => derived]] : Array<{ (): Derived2; }[] | { (): Derived; }[]> >[() => derived2] : { (): Derived2; }[] >() => derived2 : () => Derived2 >derived2 : Derived2 @@ -212,24 +212,24 @@ module WithContextualType { var a: Base[] = [derived, derived2]; >a : Base[] >Base : Base ->[derived, derived2] : Base[] +>[derived, derived2] : Array >derived : Derived >derived2 : Derived2 var b: Derived[] = [null]; >b : Derived[] >Derived : Derived ->[null] : Derived[] +>[null] : null[] var c: Derived[] = []; >c : Derived[] >Derived : Derived ->[] : Derived[] +>[] : undefined[] var d: { (): Base }[] = [() => derived, () => derived2]; >d : { (): Base; }[] >Base : Base ->[() => derived, () => derived2] : { (): Base; }[] +>[() => derived, () => derived2] : Array<{ (): Derived; } | { (): Derived2; }> >() => derived : () => Derived >derived : Derived >() => derived2 : () => Derived2 @@ -257,19 +257,19 @@ function foo(t: T, u: U) { >t : T var c = [t, u]; // {}[] ->c : {}[] ->[t, u] : {}[] +>c : Array +>[t, u] : Array >t : T >u : U var d = [t, 1]; // {}[] ->d : {}[] ->[t, 1] : {}[] +>d : Array +>[t, 1] : Array >t : T var e = [() => t, () => u]; // {}[] ->e : {}[] ->[() => t, () => u] : {}[] +>e : Array<{ (): T; } | { (): U; }> +>[() => t, () => u] : Array<{ (): T; } | { (): U; }> >() => t : () => T >t : T >() => u : () => U @@ -308,19 +308,19 @@ function foo2(t: T, u: U) { >t : T var c = [t, u]; // {}[] ->c : {}[] ->[t, u] : {}[] +>c : Array +>[t, u] : Array >t : T >u : U var d = [t, 1]; // {}[] ->d : {}[] ->[t, 1] : {}[] +>d : Array +>[t, 1] : Array >t : T var e = [() => t, () => u]; // {}[] ->e : {}[] ->[() => t, () => u] : {}[] +>e : Array<{ (): T; } | { (): U; }> +>[() => t, () => u] : Array<{ (): T; } | { (): U; }> >() => t : () => T >t : T >() => u : () => U @@ -342,8 +342,8 @@ function foo2(t: T, u: U) { >base : Base var h = [t, derived]; // Derived[] ->h : {}[] ->[t, derived] : {}[] +>h : Array +>[t, derived] : Array >t : T >derived : Derived @@ -383,19 +383,19 @@ function foo3(t: T, u: U) { >t : T var c = [t, u]; // {}[] ->c : {}[] ->[t, u] : {}[] +>c : Array +>[t, u] : Array >t : T >u : U var d = [t, 1]; // {}[] ->d : {}[] ->[t, 1] : {}[] +>d : Array +>[t, 1] : Array >t : T var e = [() => t, () => u]; // {}[] ->e : {}[] ->[() => t, () => u] : {}[] +>e : Array<{ (): T; } | { (): U; }> +>[() => t, () => u] : Array<{ (): T; } | { (): U; }> >() => t : () => T >t : T >() => u : () => U @@ -458,19 +458,19 @@ function foo4(t: T, u: U) { >t : T var c = [t, u]; // BUG 821629 ->c : {}[] ->[t, u] : {}[] +>c : Array +>[t, u] : Array >t : T >u : U var d = [t, 1]; // {}[] ->d : {}[] ->[t, 1] : {}[] +>d : Array +>[t, 1] : Array >t : T var e = [() => t, () => u]; // {}[] ->e : {}[] ->[() => t, () => u] : {}[] +>e : Array<{ (): T; } | { (): U; }> +>[() => t, () => u] : Array<{ (): T; } | { (): U; }> >() => t : () => T >t : T >() => u : () => U @@ -492,8 +492,8 @@ function foo4(t: T, u: U) { >base : Base var h = [t, derived]; // Derived[] ->h : {}[] ->[t, derived] : {}[] +>h : Array +>[t, derived] : Array >t : T >derived : Derived @@ -504,15 +504,15 @@ function foo4(t: T, u: U) { >base : Base var j = [u, derived]; // Derived[] ->j : {}[] ->[u, derived] : {}[] +>j : Array +>[u, derived] : Array >u : U >derived : Derived var k: Base[] = [t, u]; >k : Base[] >Base : Base ->[t, u] : Base[] +>[t, u] : Array >t : T >u : U } diff --git a/tests/baselines/reference/i3.errors.txt b/tests/baselines/reference/i3.errors.txt index ebdf371ab36..1a03e690a2f 100644 --- a/tests/baselines/reference/i3.errors.txt +++ b/tests/baselines/reference/i3.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/i3.ts(6,1): error TS2322: Type 'I3' is not assignable to type '{ one: number; }': + Property 'one' is optional in type 'I3' but required in type '{ one: number; }'. + + ==== tests/cases/compiler/i3.ts (1 errors) ==== interface I3 { one?: number; }; var x: {one: number}; @@ -6,5 +10,5 @@ i = x; x = i; ~ -!!! Type 'I3' is not assignable to type '{ one: number; }': -!!! Required property 'one' cannot be reimplemented with optional property in 'I3'. \ No newline at end of file +!!! error TS2322: Type 'I3' is not assignable to type '{ one: number; }': +!!! error TS2322: Property 'one' is optional in type 'I3' but required in type '{ one: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt b/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt index 034bfe3026d..60239280226 100644 --- a/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt +++ b/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'g' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. +tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'h' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. +tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: string) => any'. +tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(14,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => string'. + + ==== tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts (4 errors) ==== var f: (x: T, y: U) => T; var f: (x: any, y: any) => any; @@ -5,19 +11,19 @@ var g: (x: T, y: U) => T; var g: (x: any, y: any) => any; ~ -!!! Subsequent variable declarations must have the same type. Variable 'g' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'g' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. var h: (x: T, y: U) => T; var h: (x: any, y: any) => any; ~ -!!! Subsequent variable declarations must have the same type. Variable 'h' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'h' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. var i: (x: T, y: U) => T; var i: (x: any, y: string) => any; ~ -!!! Subsequent variable declarations must have the same type. Variable 'i' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: string) => any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: string) => any'. var j: (x: T, y: U) => T; var j: (x: any, y: any) => string; ~ -!!! Subsequent variable declarations must have the same type. Variable 'j' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => string'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => string'. \ No newline at end of file diff --git a/tests/baselines/reference/ifElseWithStatements1.errors.txt b/tests/baselines/reference/ifElseWithStatements1.errors.txt index ccadfd14ce7..186cff59241 100644 --- a/tests/baselines/reference/ifElseWithStatements1.errors.txt +++ b/tests/baselines/reference/ifElseWithStatements1.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/ifElseWithStatements1.ts(2,5): error TS2304: Cannot find name 'f'. +tests/cases/compiler/ifElseWithStatements1.ts(4,5): error TS2304: Cannot find name 'f'. + + ==== tests/cases/compiler/ifElseWithStatements1.ts (2 errors) ==== if (true) f(); ~ -!!! Cannot find name 'f'. +!!! error TS2304: Cannot find name 'f'. else f(); ~ -!!! Cannot find name 'f'. +!!! error TS2304: Cannot find name 'f'. function foo(): boolean { if (true) diff --git a/tests/baselines/reference/illegalModifiersOnClassElements.errors.txt b/tests/baselines/reference/illegalModifiersOnClassElements.errors.txt index 038d2ad7da5..eb373ad2fae 100644 --- a/tests/baselines/reference/illegalModifiersOnClassElements.errors.txt +++ b/tests/baselines/reference/illegalModifiersOnClassElements.errors.txt @@ -1,9 +1,13 @@ +tests/cases/compiler/illegalModifiersOnClassElements.ts(2,5): error TS1031: 'declare' modifier cannot appear on a class element. +tests/cases/compiler/illegalModifiersOnClassElements.ts(3,5): error TS1031: 'export' modifier cannot appear on a class element. + + ==== tests/cases/compiler/illegalModifiersOnClassElements.ts (2 errors) ==== class C { declare foo = 1; ~~~~~~~ -!!! 'declare' modifier cannot appear on a class element. +!!! error TS1031: 'declare' modifier cannot appear on a class element. export bar = 1; ~~~~~~ -!!! 'export' modifier cannot appear on a class element. +!!! error TS1031: 'export' modifier cannot appear on a class element. } \ No newline at end of file diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt b/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt index 41e124d7f14..6b86209b5b1 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt @@ -1,3 +1,13 @@ +tests/cases/compiler/illegalSuperCallsInConstructor.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/illegalSuperCallsInConstructor.ts(15,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/illegalSuperCallsInConstructor.ts(6,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/illegalSuperCallsInConstructor.ts(7,24): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/compiler/illegalSuperCallsInConstructor.ts(8,26): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/compiler/illegalSuperCallsInConstructor.ts(9,32): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/compiler/illegalSuperCallsInConstructor.ts(12,17): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + + ==== tests/cases/compiler/illegalSuperCallsInConstructor.ts (8 errors) ==== class Base { x: string; @@ -9,42 +19,42 @@ var r2 = () => super(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors var r3 = () => { super(); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors var r4 = function () { super(); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors var r5 = { ~~~~~~~~~~~~~~~~~~ get foo() { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~~~~~~~ super(); ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors return 1; ~~~~~~~~~~~~~~~~~~~~~~~~~ }, ~~~~~~~~~~~~~~ set foo(v: number) { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ super(); ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ -!!! Super calls are not permitted outside constructors or in nested functions inside constructors +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors } ~~~~~~~~~~~~~ } ~~~~~~~~~ } ~~~~~ -!!! Constructors for derived classes must contain a 'super' call. +!!! error TS2377: Constructors for derived classes must contain a 'super' call. } \ No newline at end of file diff --git a/tests/baselines/reference/implementClausePrecedingExtends.errors.txt b/tests/baselines/reference/implementClausePrecedingExtends.errors.txt index 997f49a9478..43baa8c8be7 100644 --- a/tests/baselines/reference/implementClausePrecedingExtends.errors.txt +++ b/tests/baselines/reference/implementClausePrecedingExtends.errors.txt @@ -1,10 +1,16 @@ +tests/cases/compiler/implementClausePrecedingExtends.ts(2,22): error TS1005: '{' expected. +tests/cases/compiler/implementClausePrecedingExtends.ts(2,32): error TS1005: ';' expected. +tests/cases/compiler/implementClausePrecedingExtends.ts(2,7): error TS2421: Class 'D' incorrectly implements interface 'C': + Property 'foo' is missing in type 'D'. + + ==== tests/cases/compiler/implementClausePrecedingExtends.ts (3 errors) ==== class C { foo: number } class D implements C extends C { } ~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Class 'D' incorrectly implements interface 'C': -!!! Property 'foo' is missing in type 'D'. \ No newline at end of file +!!! error TS2421: Class 'D' incorrectly implements interface 'C': +!!! error TS2421: Property 'foo' is missing in type 'D'. \ No newline at end of file diff --git a/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt b/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt index 209749db465..4c2803b76ac 100644 --- a/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt +++ b/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt @@ -1,3 +1,14 @@ +tests/cases/compiler/implementGenericWithMismatchedTypes.ts(7,7): error TS2421: Class 'C' incorrectly implements interface 'IFoo': + Types of property 'foo' are incompatible: + Type '(x: string) => number' is not assignable to type '(x: T) => T': + Types of parameters 'x' and 'x' are incompatible: + Type 'string' is not assignable to type 'T'. +tests/cases/compiler/implementGenericWithMismatchedTypes.ts(16,7): error TS2421: Class 'C2' incorrectly implements interface 'IFoo2': + Types of property 'foo' are incompatible: + Type '(x: Tstring) => number' is not assignable to type '(x: T) => T': + Type 'number' is not assignable to type 'T'. + + ==== tests/cases/compiler/implementGenericWithMismatchedTypes.ts (2 errors) ==== // no errors because in the derived types the best common type for T's value is Object // and that matches the original signature for assignability since we treat its T's as Object @@ -7,11 +18,11 @@ } class C implements IFoo { // error ~ -!!! Class 'C' incorrectly implements interface 'IFoo': -!!! Types of property 'foo' are incompatible: -!!! Type '(x: string) => number' is not assignable to type '(x: T) => T': -!!! Types of parameters 'x' and 'x' are incompatible: -!!! Type 'string' is not assignable to type 'T'. +!!! error TS2421: Class 'C' incorrectly implements interface 'IFoo': +!!! error TS2421: Types of property 'foo' are incompatible: +!!! error TS2421: Type '(x: string) => number' is not assignable to type '(x: T) => T': +!!! error TS2421: Types of parameters 'x' and 'x' are incompatible: +!!! error TS2421: Type 'string' is not assignable to type 'T'. foo(x: string): number { return null; } @@ -22,10 +33,10 @@ } class C2 implements IFoo2 { // error ~~ -!!! Class 'C2' incorrectly implements interface 'IFoo2': -!!! Types of property 'foo' are incompatible: -!!! Type '(x: Tstring) => number' is not assignable to type '(x: T) => T': -!!! Type 'number' is not assignable to type 'T'. +!!! error TS2421: Class 'C2' incorrectly implements interface 'IFoo2': +!!! error TS2421: Types of property 'foo' are incompatible: +!!! error TS2421: Type '(x: Tstring) => number' is not assignable to type '(x: T) => T': +!!! error TS2421: Type 'number' is not assignable to type 'T'. foo(x: Tstring): number { return null; } diff --git a/tests/baselines/reference/implementPublicPropertyAsPrivate.errors.txt b/tests/baselines/reference/implementPublicPropertyAsPrivate.errors.txt index 25ffa123d77..c445403c3fa 100644 --- a/tests/baselines/reference/implementPublicPropertyAsPrivate.errors.txt +++ b/tests/baselines/reference/implementPublicPropertyAsPrivate.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/implementPublicPropertyAsPrivate.ts(4,7): error TS2421: Class 'C' incorrectly implements interface 'I': + Property 'x' is private in type 'C' but not in type 'I'. + + ==== tests/cases/compiler/implementPublicPropertyAsPrivate.ts (1 errors) ==== interface I { x: number; } class C implements I { ~ -!!! Class 'C' incorrectly implements interface 'I': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'C' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is private in type 'C' but not in type 'I'. private x = 0; // should raise error at class decl } \ No newline at end of file diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates.errors.txt b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates.errors.txt index 22cbf1aacac..ab12cb9708b 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates.errors.txt +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates.ts(9,7): error TS2421: Class 'Bar' incorrectly implements interface 'I': + Property 'y' is missing in type 'Bar'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates.ts(12,7): error TS2421: Class 'Bar2' incorrectly implements interface 'I': + Property 'x' is missing in type 'Bar2'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates.ts(16,7): error TS2421: Class 'Bar3' incorrectly implements interface 'I': + Property 'x' is private in type 'I' but not in type 'Bar3'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates.ts(21,7): error TS2421: Class 'Bar4' incorrectly implements interface 'I': + Types have separate declarations of a private property 'x'. + + ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates.ts (4 errors) ==== class Foo { private x: string; @@ -9,29 +19,29 @@ class Bar implements I { // error ~~~ -!!! Class 'Bar' incorrectly implements interface 'I': -!!! Property 'y' is missing in type 'Bar'. +!!! error TS2421: Class 'Bar' incorrectly implements interface 'I': +!!! error TS2421: Property 'y' is missing in type 'Bar'. } class Bar2 implements I { // error ~~~~ -!!! Class 'Bar2' incorrectly implements interface 'I': -!!! Property 'x' is missing in type 'Bar2'. +!!! error TS2421: Class 'Bar2' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is missing in type 'Bar2'. y: number; } class Bar3 implements I { // error ~~~~ -!!! Class 'Bar3' incorrectly implements interface 'I': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'Bar3' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is private in type 'I' but not in type 'Bar3'. x: string; y: number; } class Bar4 implements I { // error ~~~~ -!!! Class 'Bar4' incorrectly implements interface 'I': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'Bar4' incorrectly implements interface 'I': +!!! error TS2421: Types have separate declarations of a private property 'x'. private x: string; y: number; } \ No newline at end of file diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt index 7598e2b6132..53fc5c54bee 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt @@ -1,3 +1,33 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(13,7): error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': + Property 'x' is private in type 'Foo' but not in type 'Bar2'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(13,7): error TS2421: Class 'Bar2' incorrectly implements interface 'I': + Property 'x' is private in type 'I' but not in type 'Bar2'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(18,7): error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': + Types have separate declarations of a private property 'x'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(18,7): error TS2421: Class 'Bar3' incorrectly implements interface 'I': + Types have separate declarations of a private property 'x'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(42,11): error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': + Property 'x' is private in type 'Foo' but not in type 'Bar2'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(42,11): error TS2421: Class 'Bar2' incorrectly implements interface 'I': + Property 'z' is missing in type 'Bar2'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(47,11): error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': + Types have separate declarations of a private property 'x'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(47,11): error TS2421: Class 'Bar3' incorrectly implements interface 'I': + Property 'z' is missing in type 'Bar3'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(67,11): error TS2421: Class 'Bar' incorrectly implements interface 'I': + Property 'y' is missing in type 'Bar'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(73,14): error TS2341: Property 'x' is private and only accessible within class 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(74,16): error TS2339: Property 'y' does not exist on type 'Bar'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(76,11): error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': + Property 'x' is private in type 'Foo' but not in type 'Bar2'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(76,11): error TS2421: Class 'Bar2' incorrectly implements interface 'I': + Property 'y' is missing in type 'Bar2'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(81,11): error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': + Types have separate declarations of a private property 'x'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(81,11): error TS2421: Class 'Bar3' incorrectly implements interface 'I': + Property 'y' is missing in type 'Bar3'. + + ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts (15 errors) ==== class Foo { private x: string; @@ -13,22 +43,22 @@ class Bar2 extends Foo implements I { // error ~~~~ -!!! Class 'Bar2' incorrectly extends base class 'Foo': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': +!!! error TS2416: Property 'x' is private in type 'Foo' but not in type 'Bar2'. ~~~~ -!!! Class 'Bar2' incorrectly implements interface 'I': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'Bar2' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is private in type 'I' but not in type 'Bar2'. x: string; y: number; } class Bar3 extends Foo implements I { // error ~~~~ -!!! Class 'Bar3' incorrectly extends base class 'Foo': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': +!!! error TS2416: Types have separate declarations of a private property 'x'. ~~~~ -!!! Class 'Bar3' incorrectly implements interface 'I': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'Bar3' incorrectly implements interface 'I': +!!! error TS2421: Types have separate declarations of a private property 'x'. private x: string; y: number; } @@ -54,22 +84,22 @@ class Bar2 extends Foo implements I { // error ~~~~ -!!! Class 'Bar2' incorrectly extends base class 'Foo': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': +!!! error TS2416: Property 'x' is private in type 'Foo' but not in type 'Bar2'. ~~~~ -!!! Class 'Bar2' incorrectly implements interface 'I': -!!! Property 'z' is missing in type 'Bar2'. +!!! error TS2421: Class 'Bar2' incorrectly implements interface 'I': +!!! error TS2421: Property 'z' is missing in type 'Bar2'. x: string; y: number; } class Bar3 extends Foo implements I { // error ~~~~ -!!! Class 'Bar3' incorrectly extends base class 'Foo': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': +!!! error TS2416: Types have separate declarations of a private property 'x'. ~~~~ -!!! Class 'Bar3' incorrectly implements interface 'I': -!!! Property 'z' is missing in type 'Bar3'. +!!! error TS2421: Class 'Bar3' incorrectly implements interface 'I': +!!! error TS2421: Property 'z' is missing in type 'Bar3'. private x: string; y: number; } @@ -91,8 +121,8 @@ class Bar extends Foo implements I { // error ~~~ -!!! Class 'Bar' incorrectly implements interface 'I': -!!! Property 'y' is missing in type 'Bar'. +!!! error TS2421: Class 'Bar' incorrectly implements interface 'I': +!!! error TS2421: Property 'y' is missing in type 'Bar'. z: number; } @@ -100,29 +130,29 @@ var r1 = b.z; var r2 = b.x; // error ~~~ -!!! Property 'Foo.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'Foo'. var r3 = b.y; // error ~ -!!! Property 'y' does not exist on type 'Bar'. +!!! error TS2339: Property 'y' does not exist on type 'Bar'. class Bar2 extends Foo implements I { // error ~~~~ -!!! Class 'Bar2' incorrectly extends base class 'Foo': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': +!!! error TS2416: Property 'x' is private in type 'Foo' but not in type 'Bar2'. ~~~~ -!!! Class 'Bar2' incorrectly implements interface 'I': -!!! Property 'y' is missing in type 'Bar2'. +!!! error TS2421: Class 'Bar2' incorrectly implements interface 'I': +!!! error TS2421: Property 'y' is missing in type 'Bar2'. x: string; z: number; } class Bar3 extends Foo implements I { // error ~~~~ -!!! Class 'Bar3' incorrectly extends base class 'Foo': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': +!!! error TS2416: Types have separate declarations of a private property 'x'. ~~~~ -!!! Class 'Bar3' incorrectly implements interface 'I': -!!! Property 'y' is missing in type 'Bar3'. +!!! error TS2421: Class 'Bar3' incorrectly implements interface 'I': +!!! error TS2421: Property 'y' is missing in type 'Bar3'. private x: string; z: number; } diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.errors.txt b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.errors.txt new file mode 100644 index 00000000000..fc7cbbed97a --- /dev/null +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.errors.txt @@ -0,0 +1,74 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(9,7): error TS2421: Class 'Bar' incorrectly implements interface 'I': + Property 'y' is missing in type 'Bar'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(12,7): error TS2421: Class 'Bar2' incorrectly implements interface 'I': + Property 'x' is missing in type 'Bar2'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(16,7): error TS2421: Class 'Bar3' incorrectly implements interface 'I': + Property 'x' is protected but type 'Bar3' is not a class derived from 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(21,7): error TS2421: Class 'Bar4' incorrectly implements interface 'I': + Property 'x' is protected but type 'Bar4' is not a class derived from 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(26,7): error TS2421: Class 'Bar5' incorrectly implements interface 'I': + Property 'y' is missing in type 'Bar5'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(29,7): error TS2421: Class 'Bar6' incorrectly implements interface 'I': + Property 'y' is protected in type 'Bar6' but public in type 'I'. + + +==== tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts (6 errors) ==== + class Foo { + protected x: string; + } + + interface I extends Foo { + y: number; + } + + class Bar implements I { // error + ~~~ +!!! error TS2421: Class 'Bar' incorrectly implements interface 'I': +!!! error TS2421: Property 'y' is missing in type 'Bar'. + } + + class Bar2 implements I { // error + ~~~~ +!!! error TS2421: Class 'Bar2' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is missing in type 'Bar2'. + y: number; + } + + class Bar3 implements I { // error + ~~~~ +!!! error TS2421: Class 'Bar3' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is protected but type 'Bar3' is not a class derived from 'Foo'. + x: string; + y: number; + } + + class Bar4 implements I { // error + ~~~~ +!!! error TS2421: Class 'Bar4' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is protected but type 'Bar4' is not a class derived from 'Foo'. + protected x: string; + y: number; + } + + class Bar5 extends Foo implements I { // error + ~~~~ +!!! error TS2421: Class 'Bar5' incorrectly implements interface 'I': +!!! error TS2421: Property 'y' is missing in type 'Bar5'. + } + + class Bar6 extends Foo implements I { // error + ~~~~ +!!! error TS2421: Class 'Bar6' incorrectly implements interface 'I': +!!! error TS2421: Property 'y' is protected in type 'Bar6' but public in type 'I'. + protected y: number; + } + + class Bar7 extends Foo implements I { + y: number; + } + + class Bar8 extends Foo implements I { + x: string; + y: number; + } + \ No newline at end of file diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js new file mode 100644 index 00000000000..1a79496bd12 --- /dev/null +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js @@ -0,0 +1,103 @@ +//// [implementingAnInterfaceExtendingClassWithProtecteds.ts] +class Foo { + protected x: string; +} + +interface I extends Foo { + y: number; +} + +class Bar implements I { // error +} + +class Bar2 implements I { // error + y: number; +} + +class Bar3 implements I { // error + x: string; + y: number; +} + +class Bar4 implements I { // error + protected x: string; + y: number; +} + +class Bar5 extends Foo implements I { // error +} + +class Bar6 extends Foo implements I { // error + protected y: number; +} + +class Bar7 extends Foo implements I { + y: number; +} + +class Bar8 extends Foo implements I { + x: string; + y: number; +} + + +//// [implementingAnInterfaceExtendingClassWithProtecteds.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +var Bar2 = (function () { + function Bar2() { + } + return Bar2; +})(); +var Bar3 = (function () { + function Bar3() { + } + return Bar3; +})(); +var Bar4 = (function () { + function Bar4() { + } + return Bar4; +})(); +var Bar5 = (function (_super) { + __extends(Bar5, _super); + function Bar5() { + _super.apply(this, arguments); + } + return Bar5; +})(Foo); +var Bar6 = (function (_super) { + __extends(Bar6, _super); + function Bar6() { + _super.apply(this, arguments); + } + return Bar6; +})(Foo); +var Bar7 = (function (_super) { + __extends(Bar7, _super); + function Bar7() { + _super.apply(this, arguments); + } + return Bar7; +})(Foo); +var Bar8 = (function (_super) { + __extends(Bar8, _super); + function Bar8() { + _super.apply(this, arguments); + } + return Bar8; +})(Foo); diff --git a/tests/baselines/reference/implementsClauseAlreadySeen.errors.txt b/tests/baselines/reference/implementsClauseAlreadySeen.errors.txt index 020a061fa66..ca06cf9bb73 100644 --- a/tests/baselines/reference/implementsClauseAlreadySeen.errors.txt +++ b/tests/baselines/reference/implementsClauseAlreadySeen.errors.txt @@ -1,19 +1,27 @@ +tests/cases/compiler/implementsClauseAlreadySeen.ts(4,22): error TS1005: '{' expected. +tests/cases/compiler/implementsClauseAlreadySeen.ts(4,33): error TS1005: ';' expected. +tests/cases/compiler/implementsClauseAlreadySeen.ts(4,35): error TS1005: ';' expected. +tests/cases/compiler/implementsClauseAlreadySeen.ts(5,11): error TS1005: ';' expected. +tests/cases/compiler/implementsClauseAlreadySeen.ts(4,22): error TS2304: Cannot find name 'implements'. +tests/cases/compiler/implementsClauseAlreadySeen.ts(5,5): error TS2304: Cannot find name 'baz'. + + ==== tests/cases/compiler/implementsClauseAlreadySeen.ts (6 errors) ==== class C { } class D implements C implements C { ~~~~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~~~~~ -!!! Cannot find name 'implements'. +!!! error TS2304: Cannot find name 'implements'. baz() { } ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~ -!!! Cannot find name 'baz'. +!!! error TS2304: Cannot find name 'baz'. } \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyAmbients.errors.txt b/tests/baselines/reference/implicitAnyAmbients.errors.txt index 99cd350286d..699bd4b7f34 100644 --- a/tests/baselines/reference/implicitAnyAmbients.errors.txt +++ b/tests/baselines/reference/implicitAnyAmbients.errors.txt @@ -1,45 +1,56 @@ +tests/cases/compiler/implicitAnyAmbients.ts(3,9): error TS7005: Variable 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyAmbients.ts(6,5): error TS7010: 'f', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyAmbients.ts(6,16): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyAmbients.ts(7,5): error TS7010: 'f2', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyAmbients.ts(11,9): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyAmbients.ts(12,9): error TS7010: 'foo2', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyAmbients.ts(17,9): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyAmbients.ts(18,9): error TS7010: 'foo2', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyAmbients.ts(23,13): error TS7005: Variable 'y' implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyAmbients.ts (9 errors) ==== declare module m { var x; // error ~ -!!! Variable 'x' implicitly has an 'any' type. +!!! error TS7005: Variable 'x' implicitly has an 'any' type. var y: any; function f(x); // error ~~~~~~~~~~~~~~ -!!! 'f', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'f', which lacks return-type annotation, implicitly has an 'any' return type. ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. function f2(x: any); // error ~~~~~~~~~~~~~~~~~~~~ -!!! 'f2', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'f2', which lacks return-type annotation, implicitly has an 'any' return type. function f3(x: any): any; interface I { foo(); // error ~~~~~~ -!!! 'foo', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. foo2(x: any); // error ~~~~~~~~~~~~~ -!!! 'foo2', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'foo2', which lacks return-type annotation, implicitly has an 'any' return type. foo3(x: any): any; } class C { foo(); // error ~~~~~~ -!!! 'foo', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. foo2(x: any); // error ~~~~~~~~~~~~~ -!!! 'foo2', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'foo2', which lacks return-type annotation, implicitly has an 'any' return type. foo3(x: any): any; } module n { var y; // error ~ -!!! Variable 'y' implicitly has an 'any' type. +!!! error TS7005: Variable 'y' implicitly has an 'any' type. } import m2 = n; diff --git a/tests/baselines/reference/implicitAnyCastedValue.errors.txt b/tests/baselines/reference/implicitAnyCastedValue.errors.txt index c0f887b04d8..4b88cb0a8b4 100644 --- a/tests/baselines/reference/implicitAnyCastedValue.errors.txt +++ b/tests/baselines/reference/implicitAnyCastedValue.errors.txt @@ -1,3 +1,14 @@ +tests/cases/compiler/implicitAnyCastedValue.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyCastedValue.ts(28,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyCastedValue.ts(32,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyCastedValue.ts(10,5): error TS7008: Member 'bar' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyCastedValue.ts(11,5): error TS7008: Member 'foo' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyCastedValue.ts(26,5): error TS7008: Member 'getValue' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyCastedValue.ts(41,1): error TS7010: 'notCastedNull', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyCastedValue.ts(53,24): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyCastedValue.ts(62,24): error TS7006: Parameter 'x' implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyCastedValue.ts (9 errors) ==== var x = function () { return 0; // this should not be an error @@ -10,13 +21,13 @@ class C { bar = null; // this should be an error ~~~~~~~~~~~ -!!! Member 'bar' implicitly has an 'any' type. +!!! error TS7008: Member 'bar' implicitly has an 'any' type. foo = undefined; // this should be an error ~~~~~~~~~~~~~~~~ -!!! Member 'foo' implicitly has an 'any' type. +!!! error TS7008: Member 'foo' implicitly has an 'any' type. public get tempVar() { ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 0; // this should not be an error } @@ -32,17 +43,17 @@ class C1 { getValue = null; // this should be an error ~~~~~~~~~~~~~~~~ -!!! Member 'getValue' implicitly has an 'any' type. +!!! error TS7008: Member 'getValue' implicitly has an 'any' type. public get castedGet() { ~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return this.getValue; // this should not be an error } public get notCastedGet() { ~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return this.getValue; // this should not be an error } } @@ -57,7 +68,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~ -!!! 'notCastedNull', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'notCastedNull', which lacks return-type annotation, implicitly has an 'any' return type. function returnTypeBar(): any { return null; // this should not be an error @@ -69,7 +80,7 @@ function multipleRets1(x) { // this should not be an error ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. if (x) { return 0; } @@ -80,7 +91,7 @@ function multipleRets2(x) { // this should not be an error ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. if (x) { return null; } diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.errors.txt b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.errors.txt index db1e773c17c..34aa58c4199 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.errors.txt +++ b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.errors.txt @@ -1,31 +1,41 @@ +tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(2,15): error TS7006: Parameter 'l1' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(3,15): error TS7006: Parameter 'll1' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(4,33): error TS7006: Parameter 'myParam' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(5,14): error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(8,15): error TS7010: 'temp', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(9,15): error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(10,15): error TS7010: 'temp', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(11,15): error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type. + + ==== tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts (8 errors) ==== // these should be errors for implicit any parameter var lambda = (l1) => { }; // Error at "l1" ~~ -!!! Parameter 'l1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'l1' implicitly has an 'any' type. var lambd2 = (ll1, ll2: string) => { } // Error at "ll1" ~~~ -!!! Parameter 'll1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'll1' implicitly has an 'any' type. var lamda3 = function myLambda3(myParam) { } ~~~~~~~ -!!! Parameter 'myParam' implicitly has an 'any' type. +!!! error TS7006: Parameter 'myParam' implicitly has an 'any' type. var lamda4 = () => { return null }; ~~~~~~~~~~~~~~~~~~~~~ -!!! Function expression, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type. // these should be error for implicit any return type var lambda5 = function temp() { return null; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'temp', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'temp', which lacks return-type annotation, implicitly has an 'any' return type. var lambda6 = () => { return null; } ~~~~~~~~~~~~~~~~~~~~~~ -!!! Function expression, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type. var lambda7 = function temp() { return undefined; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'temp', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'temp', which lacks return-type annotation, implicitly has an 'any' return type. var lambda8 = () => { return undefined; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function expression, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type. // this shouldn't be an error var lambda9 = () => { return 5; } diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.errors.txt b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.errors.txt index dffd6dac81c..57e9b70cf09 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.errors.txt +++ b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.errors.txt @@ -1,26 +1,36 @@ +tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType.ts(2,14): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType.ts(3,25): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType.ts(4,16): error TS7006: Parameter 'a' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType.ts(4,19): error TS7006: Parameter 'b' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType.ts(4,22): error TS7006: Parameter 'c' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType.ts(5,16): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. +tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType.ts(6,16): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType.ts(6,25): error TS7006: Parameter 'w' implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyDeclareFunctionWithoutFormalType.ts (8 errors) ==== // these should be errors function foo(x) { }; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. function bar(x: number, y) { }; // error at "y"; no error at "x" ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. function func2(a, b, c) { }; // error at "a,b,c" ~ -!!! Parameter 'a' implicitly has an 'any' type. +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. ~ -!!! Parameter 'b' implicitly has an 'any' type. +!!! error TS7006: Parameter 'b' implicitly has an 'any' type. ~ -!!! Parameter 'c' implicitly has an 'any' type. +!!! error TS7006: Parameter 'c' implicitly has an 'any' type. function func3(...args) { }; // error at "args" ~~~~~~~ -!!! Rest parameter 'args' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'args' implicitly has an 'any[]' type. function func4(z= null, w= undefined) { }; // error at "z,w" ~~~~~~~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. ~~~~~~~~~~~~ -!!! Parameter 'w' implicitly has an 'any' type. +!!! error TS7006: Parameter 'w' implicitly has an 'any' type. // these shouldn't be errors function noError1(x= 3, y= 2) { }; diff --git a/tests/baselines/reference/implicitAnyDeclareMemberWithoutType.errors.txt b/tests/baselines/reference/implicitAnyDeclareMemberWithoutType.errors.txt index a6ed50b77f4..710bcd32470 100644 --- a/tests/baselines/reference/implicitAnyDeclareMemberWithoutType.errors.txt +++ b/tests/baselines/reference/implicitAnyDeclareMemberWithoutType.errors.txt @@ -1,26 +1,36 @@ +tests/cases/compiler/implicitAnyDeclareMemberWithoutType.ts(3,5): error TS7008: Member 'member1' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType.ts(5,5): error TS7010: 'constructor', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType.ts(5,17): error TS7006: Parameter 'c1' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType.ts(5,33): error TS7006: Parameter 'c3' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType.ts(6,5): error TS7010: 'funcOfIFace', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType.ts(6,17): error TS7006: Parameter 'f1' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType.ts(6,21): error TS7006: Parameter 'f2' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType.ts(7,5): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. + + ==== tests/cases/compiler/implicitAnyDeclareMemberWithoutType.ts (8 errors) ==== // this should be an error interface IFace { member1; // error at "member1" ~~~~~~~~ -!!! Member 'member1' implicitly has an 'any' type. +!!! error TS7008: Member 'member1' implicitly has an 'any' type. member2: string; constructor(c1, c2: string, c3); // error at "c1, c3, "constructor" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'constructor', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'constructor', which lacks return-type annotation, implicitly has an 'any' return type. ~~ -!!! Parameter 'c1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'c1' implicitly has an 'any' type. ~~ -!!! Parameter 'c3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'c3' implicitly has an 'any' type. funcOfIFace(f1, f2, f3: number); // error at "f1, f2, funcOfIFace" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'funcOfIFace', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'funcOfIFace', which lacks return-type annotation, implicitly has an 'any' return type. ~~ -!!! Parameter 'f1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'f1' implicitly has an 'any' type. ~~ -!!! Parameter 'f2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'f2' implicitly has an 'any' type. new (); ~~~~~~~ -!!! Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. } \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyDeclareMemberWithoutType2.errors.txt b/tests/baselines/reference/implicitAnyDeclareMemberWithoutType2.errors.txt index c98f3d3c311..45b95a1c863 100644 --- a/tests/baselines/reference/implicitAnyDeclareMemberWithoutType2.errors.txt +++ b/tests/baselines/reference/implicitAnyDeclareMemberWithoutType2.errors.txt @@ -1,20 +1,27 @@ +tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(3,5): error TS7008: Member 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(6,17): error TS7006: Parameter 'c1' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(6,21): error TS7006: Parameter 'c2' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(7,13): error TS7006: Parameter 'f1' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(7,17): error TS7006: Parameter 'f2' implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts (5 errors) ==== // this should be an error class C { public x = null;// error at "x" ~~~~~~~~~~~~~~~~ -!!! Member 'x' implicitly has an 'any' type. +!!! error TS7008: Member 'x' implicitly has an 'any' type. public x1: string // no error constructor(c1, c2, c3: string) { } // error at "c1, c2" ~~ -!!! Parameter 'c1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'c1' implicitly has an 'any' type. ~~ -!!! Parameter 'c2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'c2' implicitly has an 'any' type. funcOfC(f1, f2, f3: number) { } // error at "f1,f2" ~~ -!!! Parameter 'f1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'f1' implicitly has an 'any' type. ~~ -!!! Parameter 'f2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'f2' implicitly has an 'any' type. } \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyDeclareTypePropertyWithoutType.errors.txt b/tests/baselines/reference/implicitAnyDeclareTypePropertyWithoutType.errors.txt index 9d1fa68e502..8523b361ba8 100644 --- a/tests/baselines/reference/implicitAnyDeclareTypePropertyWithoutType.errors.txt +++ b/tests/baselines/reference/implicitAnyDeclareTypePropertyWithoutType.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/implicitAnyDeclareTypePropertyWithoutType.ts(6,10): error TS7008: Member 'y' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareTypePropertyWithoutType.ts(6,13): error TS7008: Member 'z' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareTypePropertyWithoutType.ts(7,18): error TS7008: Member 'z1' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareTypePropertyWithoutType.ts(8,12): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyDeclareTypePropertyWithoutType.ts(9,10): error TS7006: Parameter 'y2' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareTypePropertyWithoutType.ts(10,22): error TS7006: Parameter 'y3' implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyDeclareTypePropertyWithoutType.ts (6 errors) ==== class C { constructor() { } @@ -6,21 +14,21 @@ // this should be an error var x: { y; z; } // error at "y,z" ~~ -!!! Member 'y' implicitly has an 'any' type. +!!! error TS7008: Member 'y' implicitly has an 'any' type. ~~ -!!! Member 'z' implicitly has an 'any' type. +!!! error TS7008: Member 'z' implicitly has an 'any' type. var x1: { y1: C; z1; }; // error at "z1" ~~~ -!!! Member 'z1' implicitly has an 'any' type. +!!! error TS7008: Member 'z1' implicitly has an 'any' type. var x11: { new (); }; // error at "new" ~~~~~~~ -!!! Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. var x2: (y2) => number; // error at "y2" ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. var x3: (x3: string, y3) => void ; // error at "y3" ~~ -!!! Parameter 'y3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y3' implicitly has an 'any' type. // this should not be an error var bar: { a: number; b: number }; diff --git a/tests/baselines/reference/implicitAnyDeclareVariablesWithoutTypeAndInit.errors.txt b/tests/baselines/reference/implicitAnyDeclareVariablesWithoutTypeAndInit.errors.txt index 57e74c34a34..3acb6e47e10 100644 --- a/tests/baselines/reference/implicitAnyDeclareVariablesWithoutTypeAndInit.errors.txt +++ b/tests/baselines/reference/implicitAnyDeclareVariablesWithoutTypeAndInit.errors.txt @@ -1,14 +1,19 @@ +tests/cases/compiler/implicitAnyDeclareVariablesWithoutTypeAndInit.ts(2,5): error TS7005: Variable 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareVariablesWithoutTypeAndInit.ts(3,13): error TS7005: Variable 'foo' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareVariablesWithoutTypeAndInit.ts(4,15): error TS7006: Parameter 'k' implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyDeclareVariablesWithoutTypeAndInit.ts (3 errors) ==== // this should be an error var x; // error at "x" ~ -!!! Variable 'x' implicitly has an 'any' type. +!!! error TS7005: Variable 'x' implicitly has an 'any' type. declare var foo; // error at "foo" ~~~ -!!! Variable 'foo' implicitly has an 'any' type. +!!! error TS7005: Variable 'foo' implicitly has an 'any' type. function func(k) { }; //error at "k" ~ -!!! Parameter 'k' implicitly has an 'any' type. +!!! error TS7006: Parameter 'k' implicitly has an 'any' type. func(x); // this shouldn't be an error diff --git a/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt b/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt new file mode 100644 index 00000000000..7b80d6405c9 --- /dev/null +++ b/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt @@ -0,0 +1,84 @@ +tests/cases/compiler/implicitAnyFromCircularInference.ts(3,5): error TS7021: 'a' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation. +tests/cases/compiler/implicitAnyFromCircularInference.ts(7,5): error TS7021: 'c' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation. +tests/cases/compiler/implicitAnyFromCircularInference.ts(10,5): error TS7021: 'd' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation. +tests/cases/compiler/implicitAnyFromCircularInference.ts(15,10): error TS7023: 'g' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/compiler/implicitAnyFromCircularInference.ts(18,10): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/compiler/implicitAnyFromCircularInference.ts(23,10): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/compiler/implicitAnyFromCircularInference.ts(26,10): error TS7023: 'h' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/compiler/implicitAnyFromCircularInference.ts(41,5): error TS7022: 's' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer. +tests/cases/compiler/implicitAnyFromCircularInference.ts(46,5): error TS7023: 'x' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. + + +==== tests/cases/compiler/implicitAnyFromCircularInference.ts (9 errors) ==== + + // Error expected + var a: typeof a; + ~ +!!! error TS7021: 'a' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation. + + // Error expected on b or c + var b: typeof c; + var c: typeof b; + ~ +!!! error TS7021: 'c' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation. + + // Error expected + var d: Array; + ~ +!!! error TS7021: 'd' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation. + + function f() { return f; } + + // Error expected + function g() { return g(); } + ~ +!!! error TS7023: 'g' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. + + // Error expected + var f1 = function () { + ~~~~~~~~~~~~~ + return f1(); + ~~~~~~~~~~~~~~~~ + }; + ~ +!!! error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. + + // Error expected + var f2 = () => f2(); + ~~~~~~~~~~ +!!! error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. + + // Error expected + function h() { + ~ +!!! error TS7023: 'h' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. + return foo(); + function foo() { + return h() || "hello"; + } + } + + interface A { + s: string; + } + + function foo(x: A): string { return "abc"; } + + class C { + // Error expected + s = foo(this); + ~~~~~~~~~~~~~~ +!!! error TS7022: 's' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer. + } + + class D { + // Error expected + get x() { + ~~~~~~~~~ + return this.x; + ~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~ +!!! error TS7023: 'x' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. + } + \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyFromCircularInference.js b/tests/baselines/reference/implicitAnyFromCircularInference.js new file mode 100644 index 00000000000..d97b8420ebf --- /dev/null +++ b/tests/baselines/reference/implicitAnyFromCircularInference.js @@ -0,0 +1,103 @@ +//// [implicitAnyFromCircularInference.ts] + +// Error expected +var a: typeof a; + +// Error expected on b or c +var b: typeof c; +var c: typeof b; + +// Error expected +var d: Array; + +function f() { return f; } + +// Error expected +function g() { return g(); } + +// Error expected +var f1 = function () { + return f1(); +}; + +// Error expected +var f2 = () => f2(); + +// Error expected +function h() { + return foo(); + function foo() { + return h() || "hello"; + } +} + +interface A { + s: string; +} + +function foo(x: A): string { return "abc"; } + +class C { + // Error expected + s = foo(this); +} + +class D { + // Error expected + get x() { + return this.x; + } +} + + +//// [implicitAnyFromCircularInference.js] +// Error expected +var a; +// Error expected on b or c +var b; +var c; +// Error expected +var d; +function f() { + return f; +} +// Error expected +function g() { + return g(); +} +// Error expected +var f1 = function () { + return f1(); +}; +// Error expected +var f2 = function () { return f2(); }; +// Error expected +function h() { + return foo(); + function foo() { + return h() || "hello"; + } +} +function foo(x) { + return "abc"; +} +var C = (function () { + function C() { + // Error expected + this.s = foo(this); + } + return C; +})(); +var D = (function () { + function D() { + } + Object.defineProperty(D.prototype, "x", { + // Error expected + get: function () { + return this.x; + }, + enumerable: true, + configurable: true + }); + return D; +})(); diff --git a/tests/baselines/reference/implicitAnyFunctionInvocationWithAnyArguements.errors.txt b/tests/baselines/reference/implicitAnyFunctionInvocationWithAnyArguements.errors.txt index cf135dbbd41..b15fb779b51 100644 --- a/tests/baselines/reference/implicitAnyFunctionInvocationWithAnyArguements.errors.txt +++ b/tests/baselines/reference/implicitAnyFunctionInvocationWithAnyArguements.errors.txt @@ -1,28 +1,37 @@ +tests/cases/compiler/implicitAnyFunctionInvocationWithAnyArguements.ts(2,5): error TS7005: Variable 'arg0' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyFunctionInvocationWithAnyArguements.ts(3,5): error TS7005: Variable 'anyArray' implicitly has an 'any[]' type. +tests/cases/compiler/implicitAnyFunctionInvocationWithAnyArguements.ts(4,13): error TS7008: Member 'v' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyFunctionInvocationWithAnyArguements.ts(4,16): error TS7008: Member 'w' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyFunctionInvocationWithAnyArguements.ts(5,13): error TS7006: Parameter 'y2' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyFunctionInvocationWithAnyArguements.ts(6,16): error TS7006: Parameter 'arg1' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyFunctionInvocationWithAnyArguements.ts(10,36): error TS7006: Parameter 'y2' implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyFunctionInvocationWithAnyArguements.ts (7 errors) ==== // this should be errors var arg0 = null; // error at "arg0" ~~~~ -!!! Variable 'arg0' implicitly has an 'any' type. +!!! error TS7005: Variable 'arg0' implicitly has an 'any' type. var anyArray = [null, undefined]; // error at array literal ~~~~~~~~ -!!! Variable 'anyArray' implicitly has an 'any[]' type. +!!! error TS7005: Variable 'anyArray' implicitly has an 'any[]' type. var objL: { v; w; } // error at "y,z" ~~ -!!! Member 'v' implicitly has an 'any' type. +!!! error TS7008: Member 'v' implicitly has an 'any' type. ~~ -!!! Member 'w' implicitly has an 'any' type. +!!! error TS7008: Member 'w' implicitly has an 'any' type. var funcL: (y2) => number; ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. function temp1(arg1) { } // error at "temp1" ~~~~ -!!! Parameter 'arg1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'arg1' implicitly has an 'any' type. function testFunctionExprC(subReplace: (s: string, ...arg: any[]) => string) { } function testFunctionExprC2(eq: (v1: any, v2: any) => number) { }; function testObjLiteral(objLit: { v: any; w: any }) { }; function testFuncLiteral(funcLit: (y2) => number) { }; ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. // this should not be an error testFunctionExprC2((v1, v2) => 1); diff --git a/tests/baselines/reference/implicitAnyFunctionOverloadWithImplicitAnyReturnType.errors.txt b/tests/baselines/reference/implicitAnyFunctionOverloadWithImplicitAnyReturnType.errors.txt index 6ef65b09ed9..ecd9cfde121 100644 --- a/tests/baselines/reference/implicitAnyFunctionOverloadWithImplicitAnyReturnType.errors.txt +++ b/tests/baselines/reference/implicitAnyFunctionOverloadWithImplicitAnyReturnType.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/implicitAnyFunctionOverloadWithImplicitAnyReturnType.ts(3,5): error TS7010: 'funcOfIFace', which lacks return-type annotation, implicitly has an 'any' return type. + + ==== tests/cases/compiler/implicitAnyFunctionOverloadWithImplicitAnyReturnType.ts (1 errors) ==== // this should be an error interface IFace { funcOfIFace(); // error at "f" ~~~~~~~~~~~~~~ -!!! 'funcOfIFace', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'funcOfIFace', which lacks return-type annotation, implicitly has an 'any' return type. } // this should not be an error diff --git a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.errors.txt b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.errors.txt index 5c8ab6e19a3..de1c57dd797 100644 --- a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.errors.txt +++ b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.errors.txt @@ -1,11 +1,17 @@ +tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(2,1): error TS7010: 'nullWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(3,1): error TS7010: 'undefinedWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(6,5): error TS7010: 'nullWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(10,5): error TS7010: 'underfinedWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. + + ==== tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts (4 errors) ==== // this should be an error function nullWidenFunction() { return null;} // error at "nullWidenFunction" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'nullWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'nullWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. function undefinedWidenFunction() { return undefined; } // error at "undefinedWidenFunction" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'undefinedWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'undefinedWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. class C { nullWidenFuncOfC() { // error at "nullWidenFuncOfC" @@ -14,7 +20,7 @@ ~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! 'nullWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'nullWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. underfinedWidenFuncOfC() { // error at "underfinedWidenFuncOfC" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -22,7 +28,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! 'underfinedWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'underfinedWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. } // this should not be an error diff --git a/tests/baselines/reference/implicitAnyGenericTypeInference.errors.txt b/tests/baselines/reference/implicitAnyGenericTypeInference.errors.txt index 3f95e27ab0a..c479d06d898 100644 --- a/tests/baselines/reference/implicitAnyGenericTypeInference.errors.txt +++ b/tests/baselines/reference/implicitAnyGenericTypeInference.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/implicitAnyGenericTypeInference.ts(7,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyGenericTypeInference.ts(7,22): error TS7006: Parameter 'y' implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyGenericTypeInference.ts (2 errors) ==== interface Comparer { @@ -7,7 +11,7 @@ var c: Comparer; c = { compareTo: (x, y) => { return y; } }; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. var r = c.compareTo(1, ''); \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt index c3484202590..9f2dc9ce949 100644 --- a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt +++ b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt @@ -1,19 +1,29 @@ +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(4,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(3,5): error TS7008: Member 'getAndSet' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,5): error TS7016: Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,28): error TS7006: Parameter 'newXValue' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,5): error TS7010: 'haveOnlyGet', which lacks return-type annotation, implicitly has an 'any' return type. + + ==== tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts (8 errors) ==== // these should be errors class GetAndSet { getAndSet = null; // error at "getAndSet" ~~~~~~~~~~~~~~~~~ -!!! Member 'getAndSet' implicitly has an 'any' type. +!!! error TS7008: Member 'getAndSet' implicitly has an 'any' type. public get haveGetAndSet() { // this should not be an error ~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return this.getAndSet; } // this shouldn't be an error public set haveGetAndSet(value) { // error at "value" ~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. this.getAndSet = value; } } @@ -21,23 +31,23 @@ class SetterOnly { public set haveOnlySet(newXValue) { // error at "haveOnlySet, newXValue" ~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ -!!! Parameter 'newXValue' implicitly has an 'any' type. +!!! error TS7006: Parameter 'newXValue' implicitly has an 'any' type. } ~~~~~ -!!! Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation. +!!! error TS7016: Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation. } class GetterOnly { public get haveOnlyGet() { // error at "haveOnlyGet" ~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return null; ~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! 'haveOnlyGet', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'haveOnlyGet', which lacks return-type annotation, implicitly has an 'any' return type. } \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt index 16ee2425d41..6ec975e33ea 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt @@ -1,19 +1,25 @@ +tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(8,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. +tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(3,9): error TS7008: Member 'publicMember' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,9): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,31): error TS7006: Parameter 'x' implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyInAmbientDeclaration.ts (4 errors) ==== module Test { declare class C { public publicMember; // this should be an error ~~~~~~~~~~~~~~~~~~~~ -!!! Member 'publicMember' implicitly has an 'any' type. +!!! error TS7008: Member 'publicMember' implicitly has an 'any' type. private privateMember; // this should not be an error public publicFunction(x); // this should be an error ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. private privateFunction(privateParam); // this should not be an error private constructor(privateParam); ~~~~~~~ -!!! 'private' modifier cannot appear on a constructor declaration. +!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. } } \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt index c65b2e49340..726c408aced 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt @@ -1,31 +1,41 @@ +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(9,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,1): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,22): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(2,13): error TS7005: Variable 'bar' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(4,5): error TS7008: Member 'publicMember' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(7,5): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(7,27): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(13,24): error TS7006: Parameter 'publicConsParam' implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts (8 errors) ==== declare function foo(x); // this should be an error ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'foo', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. declare var bar; // this should be be an erro ~~~ -!!! Variable 'bar' implicitly has an 'any' type. +!!! error TS7005: Variable 'bar' implicitly has an 'any' type. declare class C { public publicMember; // this should be an error ~~~~~~~~~~~~~~~~~~~~ -!!! Member 'publicMember' implicitly has an 'any' type. +!!! error TS7008: Member 'publicMember' implicitly has an 'any' type. private privateMember; // this should not be an error public publicFunction(x); // this should be an error ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. private privateFunction(privateParam); // this should not be an error private constructor(privateParam); // this should not be an error ~~~~~~~ -!!! 'private' modifier cannot appear on a constructor declaration. +!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. } declare class D { public constructor(publicConsParam, int: number); // this should be an error ~~~~~~~~~~~~~~~ -!!! Parameter 'publicConsParam' implicitly has an 'any' type. +!!! error TS7006: Parameter 'publicConsParam' implicitly has an 'any' type. } \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.errors.txt b/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.errors.txt index d78cf0d5b4b..e623cae18d8 100644 --- a/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.errors.txt +++ b/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/implicitAnyNewExprLackConstructorSignature.ts(2,14): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + ==== tests/cases/compiler/implicitAnyNewExprLackConstructorSignature.ts (1 errors) ==== function Point() { this.x = 3; } var x: any = new Point(); // error at "new" ~~~~~~~~~~~ -!!! 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. \ No newline at end of file +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyWidenToAny.errors.txt b/tests/baselines/reference/implicitAnyWidenToAny.errors.txt index b9e5cbf1a1e..3b86c52c2ea 100644 --- a/tests/baselines/reference/implicitAnyWidenToAny.errors.txt +++ b/tests/baselines/reference/implicitAnyWidenToAny.errors.txt @@ -1,17 +1,23 @@ +tests/cases/compiler/implicitAnyWidenToAny.ts(2,5): error TS7005: Variable 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyWidenToAny.ts(3,5): error TS7005: Variable 'x1' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyWidenToAny.ts(4,5): error TS7005: Variable 'widenArray' implicitly has an 'any[]' type. +tests/cases/compiler/implicitAnyWidenToAny.ts(5,5): error TS7005: Variable 'emptyArray' implicitly has an 'any[]' type. + + ==== tests/cases/compiler/implicitAnyWidenToAny.ts (4 errors) ==== // these should be errors var x = null; // error at "x" ~ -!!! Variable 'x' implicitly has an 'any' type. +!!! error TS7005: Variable 'x' implicitly has an 'any' type. var x1 = undefined; // error at "x1" ~~ -!!! Variable 'x1' implicitly has an 'any' type. +!!! error TS7005: Variable 'x1' implicitly has an 'any' type. var widenArray = [null, undefined]; // error at "widenArray" ~~~~~~~~~~ -!!! Variable 'widenArray' implicitly has an 'any[]' type. +!!! error TS7005: Variable 'widenArray' implicitly has an 'any[]' type. var emptyArray = []; // error at "emptyArray" ~~~~~~~~~~ -!!! Variable 'emptyArray' implicitly has an 'any[]' type. +!!! error TS7005: Variable 'emptyArray' implicitly has an 'any[]' type. // these should not be error class AnimalObj { diff --git a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt index 3960281c7d4..abd9ee65196 100644 --- a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt +++ b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts(1,15): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file1.ts (0 errors) ==== import r = require('importAliasAnExternalModuleInsideAnInternalModule_file0'); module m_private { @@ -9,7 +12,7 @@ ==== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts (1 errors) ==== export module m { ~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. export function foo() { } } \ No newline at end of file diff --git a/tests/baselines/reference/importAnImport.errors.txt b/tests/baselines/reference/importAnImport.errors.txt index 147b856685e..662655d3a3e 100644 --- a/tests/baselines/reference/importAnImport.errors.txt +++ b/tests/baselines/reference/importAnImport.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/importAnImport.ts(6,5): error TS2305: Module 'c.a.b' has no exported member 'ma'. + + ==== tests/cases/compiler/importAnImport.ts (1 errors) ==== module c.a.b { import ma = a; @@ -6,5 +9,5 @@ module m0 { import m8 = c.a.b.ma; ~~~~~~~~~~~~~~~~~~~~~ -!!! Module 'c.a.b' has no exported member 'ma'. +!!! error TS2305: Module 'c.a.b' has no exported member 'ma'. } \ No newline at end of file diff --git a/tests/baselines/reference/importAndVariableDeclarationConflict1.errors.txt b/tests/baselines/reference/importAndVariableDeclarationConflict1.errors.txt index faf8a4bfe73..cae8612481a 100644 --- a/tests/baselines/reference/importAndVariableDeclarationConflict1.errors.txt +++ b/tests/baselines/reference/importAndVariableDeclarationConflict1.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/importAndVariableDeclarationConflict1.ts(5,1): error TS2440: Import declaration conflicts with local declaration of 'x' + + ==== tests/cases/compiler/importAndVariableDeclarationConflict1.ts (1 errors) ==== module m { export var m = ''; @@ -5,6 +8,6 @@ import x = m.m; ~~~~~~~~~~~~~~~ -!!! Import declaration conflicts with local declaration of 'x' +!!! error TS2440: Import declaration conflicts with local declaration of 'x' var x = ''; \ No newline at end of file diff --git a/tests/baselines/reference/importAndVariableDeclarationConflict3.errors.txt b/tests/baselines/reference/importAndVariableDeclarationConflict3.errors.txt index 53ec5b64fac..39567a11753 100644 --- a/tests/baselines/reference/importAndVariableDeclarationConflict3.errors.txt +++ b/tests/baselines/reference/importAndVariableDeclarationConflict3.errors.txt @@ -1,10 +1,16 @@ -==== tests/cases/compiler/importAndVariableDeclarationConflict3.ts (1 errors) ==== +tests/cases/compiler/importAndVariableDeclarationConflict3.ts(5,8): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/importAndVariableDeclarationConflict3.ts(6,8): error TS2300: Duplicate identifier 'x'. + + +==== tests/cases/compiler/importAndVariableDeclarationConflict3.ts (2 errors) ==== module m { export var m = ''; } import x = m.m; + ~ +!!! error TS2300: Duplicate identifier 'x'. import x = m.m; ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. \ No newline at end of file diff --git a/tests/baselines/reference/importAndVariableDeclarationConflict4.errors.txt b/tests/baselines/reference/importAndVariableDeclarationConflict4.errors.txt index edef13b1a26..4905d4d2a73 100644 --- a/tests/baselines/reference/importAndVariableDeclarationConflict4.errors.txt +++ b/tests/baselines/reference/importAndVariableDeclarationConflict4.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/importAndVariableDeclarationConflict4.ts(6,1): error TS2440: Import declaration conflicts with local declaration of 'x' + + ==== tests/cases/compiler/importAndVariableDeclarationConflict4.ts (1 errors) ==== module m { export var m = ''; @@ -6,5 +9,5 @@ var x = ''; import x = m.m; ~~~~~~~~~~~~~~~ -!!! Import declaration conflicts with local declaration of 'x' +!!! error TS2440: Import declaration conflicts with local declaration of 'x' \ No newline at end of file diff --git a/tests/baselines/reference/importAsBaseClass.errors.txt b/tests/baselines/reference/importAsBaseClass.errors.txt index e9cd8590cbc..f09eb55561b 100644 --- a/tests/baselines/reference/importAsBaseClass.errors.txt +++ b/tests/baselines/reference/importAsBaseClass.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/importAsBaseClass_1.ts(2,21): error TS2304: Cannot find name 'Greeter'. + + ==== tests/cases/compiler/importAsBaseClass_1.ts (1 errors) ==== import Greeter = require("importAsBaseClass_0"); class Hello extends Greeter { } ~~~~~~~ -!!! Cannot find name 'Greeter'. +!!! error TS2304: Cannot find name 'Greeter'. ==== tests/cases/compiler/importAsBaseClass_0.ts (0 errors) ==== export class Greeter { diff --git a/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt b/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt index 9cb444661b9..7603a694348 100644 --- a/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt +++ b/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt @@ -1,14 +1,20 @@ +tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,20): error TS2307: Cannot find external module 'externalModule'. +tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(2,16): error TS2435: Ambient external modules cannot be nested in other modules. +tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(3,26): error TS2307: Cannot find external module 'externalModule'. + + ==== tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts (4 errors) ==== import b = require("externalModule"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ~~~~~~~~~~~~~~~~ -!!! Cannot find external module 'externalModule'. +!!! error TS2307: Cannot find external module 'externalModule'. declare module "m1" { ~~~~ -!!! Ambient external modules cannot be nested in other modules. +!!! error TS2435: Ambient external modules cannot be nested in other modules. import im2 = require("externalModule"); ~~~~~~~~~~~~~~~~ -!!! Cannot find external module 'externalModule'. +!!! error TS2307: Cannot find external module 'externalModule'. } \ No newline at end of file diff --git a/tests/baselines/reference/importDeclWithClassModifiers.errors.txt b/tests/baselines/reference/importDeclWithClassModifiers.errors.txt index 081bebda446..7555ac366c4 100644 --- a/tests/baselines/reference/importDeclWithClassModifiers.errors.txt +++ b/tests/baselines/reference/importDeclWithClassModifiers.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/compiler/importDeclWithClassModifiers.ts(5,1): error TS2305: Module 'x' has no exported member 'c'. +tests/cases/compiler/importDeclWithClassModifiers.ts(6,1): error TS2305: Module 'x' has no exported member 'c'. +tests/cases/compiler/importDeclWithClassModifiers.ts(7,1): error TS2305: Module 'x' has no exported member 'c'. + + ==== tests/cases/compiler/importDeclWithClassModifiers.ts (6 errors) ==== module x { interface c { @@ -5,18 +13,18 @@ } export public import a = x.c; ~~~~~~ -!!! 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module element. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Module 'x' has no exported member 'c'. +!!! error TS2305: Module 'x' has no exported member 'c'. export private import b = x.c; ~~~~~~~ -!!! 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module element. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Module 'x' has no exported member 'c'. +!!! error TS2305: Module 'x' has no exported member 'c'. export static import c = x.c; ~~~~~~ -!!! 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module element. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Module 'x' has no exported member 'c'. +!!! error TS2305: Module 'x' has no exported member 'c'. var b: a; \ No newline at end of file diff --git a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt index 972a1b9cc77..8aeb64291a6 100644 --- a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt +++ b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1079: A 'declare' modifier cannot be used with an import declaration. +tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier. +tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS2305: Module 'x' has no exported member 'c'. + + ==== tests/cases/compiler/importDeclWithDeclareModifier.ts (4 errors) ==== module x { interface c { @@ -5,12 +11,12 @@ } declare export import a = x.c; ~~~~~~~ -!!! A 'declare' modifier cannot be used with an import declaration. +!!! error TS1079: A 'declare' modifier cannot be used with an import declaration. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ~~~~~~ -!!! 'export' modifier must precede 'declare' modifier. +!!! error TS1029: 'export' modifier must precede 'declare' modifier. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Module 'x' has no exported member 'c'. +!!! error TS2305: Module 'x' has no exported member 'c'. var b: a; \ No newline at end of file diff --git a/tests/baselines/reference/importDeclWithDeclareModifierInAmbientContext.errors.txt b/tests/baselines/reference/importDeclWithDeclareModifierInAmbientContext.errors.txt index 38c3d97185c..9773b293037 100644 --- a/tests/baselines/reference/importDeclWithDeclareModifierInAmbientContext.errors.txt +++ b/tests/baselines/reference/importDeclWithDeclareModifierInAmbientContext.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts(6,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. +tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts(6,5): error TS1079: A 'declare' modifier cannot be used with an import declaration. +tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts(6,13): error TS1029: 'export' modifier must precede 'declare' modifier. + + ==== tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts (3 errors) ==== declare module "m" { module x { @@ -6,11 +11,11 @@ } declare export import a = x.c; ~~~~~~~ -!!! A 'declare' modifier cannot be used in an already ambient context. +!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. ~~~~~~~ -!!! A 'declare' modifier cannot be used with an import declaration. +!!! error TS1079: A 'declare' modifier cannot be used with an import declaration. ~~~~~~ -!!! 'export' modifier must precede 'declare' modifier. +!!! error TS1029: 'export' modifier must precede 'declare' modifier. var b: a; } \ No newline at end of file diff --git a/tests/baselines/reference/importDeclWithExportModifier.errors.txt b/tests/baselines/reference/importDeclWithExportModifier.errors.txt index ffa48b8a523..e1d75496a39 100644 --- a/tests/baselines/reference/importDeclWithExportModifier.errors.txt +++ b/tests/baselines/reference/importDeclWithExportModifier.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/importDeclWithExportModifier.ts(5,1): error TS2305: Module 'x' has no exported member 'c'. + + ==== tests/cases/compiler/importDeclWithExportModifier.ts (1 errors) ==== module x { interface c { @@ -5,6 +8,6 @@ } export import a = x.c; ~~~~~~~~~~~~~~~~~~~~~~ -!!! Module 'x' has no exported member 'c'. +!!! error TS2305: Module 'x' has no exported member 'c'. var b: a; \ No newline at end of file diff --git a/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt b/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt index 9c66bc3ca42..b7d938fbd58 100644 --- a/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt +++ b/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(5,1): error TS2305: Module 'x' has no exported member 'c'. +tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + ==== tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts (2 errors) ==== module x { interface c { @@ -5,7 +9,7 @@ } export import a = x.c; ~~~~~~~~~~~~~~~~~~~~~~ -!!! Module 'x' has no exported member 'c'. +!!! error TS2305: Module 'x' has no exported member 'c'. export = x; ~~~~~~~~~~~ -!!! An export assignment cannot be used in a module with other exported elements. \ No newline at end of file +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/tests/baselines/reference/importDeclWithExportModifierAndExportAssignmentInAmbientContext.errors.txt b/tests/baselines/reference/importDeclWithExportModifierAndExportAssignmentInAmbientContext.errors.txt index 5dc48436ad7..19fe8d55955 100644 --- a/tests/baselines/reference/importDeclWithExportModifierAndExportAssignmentInAmbientContext.errors.txt +++ b/tests/baselines/reference/importDeclWithExportModifierAndExportAssignmentInAmbientContext.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/importDeclWithExportModifierAndExportAssignmentInAmbientContext.ts(7,5): error TS2309: An export assignment cannot be used in a module with other exported elements. + + ==== tests/cases/compiler/importDeclWithExportModifierAndExportAssignmentInAmbientContext.ts (1 errors) ==== declare module "m" { module x { @@ -7,5 +10,5 @@ export import a = x.c; export = x; ~~~~~~~~~~~ -!!! An export assignment cannot be used in a module with other exported elements. +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. } \ No newline at end of file diff --git a/tests/baselines/reference/importInsideModule.errors.txt b/tests/baselines/reference/importInsideModule.errors.txt index 38f09c07cf2..dc89bb5e9ca 100644 --- a/tests/baselines/reference/importInsideModule.errors.txt +++ b/tests/baselines/reference/importInsideModule.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/importInsideModule_file2.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module. +tests/cases/compiler/importInsideModule_file2.ts(2,26): error TS2307: Cannot find external module 'importInsideModule_file1'. + + ==== tests/cases/compiler/importInsideModule_file2.ts (2 errors) ==== export module myModule { import foo = require("importInsideModule_file1"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Import declarations in an internal module cannot reference an external module. +!!! error TS1147: Import declarations in an internal module cannot reference an external module. ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot find external module 'importInsideModule_file1'. +!!! error TS2307: Cannot find external module 'importInsideModule_file1'. var a = foo.x; } ==== tests/cases/compiler/importInsideModule_file1.ts (0 errors) ==== diff --git a/tests/baselines/reference/importNonExternalModule.errors.txt b/tests/baselines/reference/importNonExternalModule.errors.txt index 6abcf7ac44b..bce2c86d0f0 100644 --- a/tests/baselines/reference/importNonExternalModule.errors.txt +++ b/tests/baselines/reference/importNonExternalModule.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/externalModules/foo_1.ts(1,22): error TS2306: File 'tests/cases/conformance/externalModules/foo_0.ts' is not an external module. + + ==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ==== import foo = require("./foo_0"); ~~~~~~~~~ -!!! File 'foo_0.ts' is not an external module. +!!! error TS2306: File 'foo_0.ts' is not an external module. // Import should fail. foo_0 not an external module if(foo.answer === 42){ diff --git a/tests/baselines/reference/importNonStringLiteral.errors.txt b/tests/baselines/reference/importNonStringLiteral.errors.txt index 0c1c2fde046..ce3dbb3e1ec 100644 --- a/tests/baselines/reference/importNonStringLiteral.errors.txt +++ b/tests/baselines/reference/importNonStringLiteral.errors.txt @@ -1,8 +1,12 @@ +tests/cases/conformance/externalModules/importNonStringLiteral.ts(2,22): error TS1141: String literal expected. +tests/cases/conformance/externalModules/importNonStringLiteral.ts(2,23): error TS1005: ';' expected. + + ==== tests/cases/conformance/externalModules/importNonStringLiteral.ts (2 errors) ==== var x = "filename"; import foo = require(x); // invalid ~ -!!! String literal expected. +!!! error TS1141: String literal expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/importStatementsInterfaces.errors.txt b/tests/baselines/reference/importStatementsInterfaces.errors.txt index 95a733dc2c4..313365fb191 100644 --- a/tests/baselines/reference/importStatementsInterfaces.errors.txt +++ b/tests/baselines/reference/importStatementsInterfaces.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/internalModules/codeGeneration/importStatementsInterfaces.ts(23,19): error TS2304: Cannot find name 'a'. + + ==== tests/cases/conformance/internalModules/codeGeneration/importStatementsInterfaces.ts (1 errors) ==== module A { export interface Point { @@ -23,7 +26,7 @@ import b = a.inA; var m: typeof a; ~ -!!! Cannot find name 'a'. +!!! error TS2304: Cannot find name 'a'. var p: b.Point3D; var p = {x:0, y:0, z: 0 }; } diff --git a/tests/baselines/reference/importTsBeforeDTs.errors.txt b/tests/baselines/reference/importTsBeforeDTs.errors.txt index 58e72634573..aaee4e3d070 100644 --- a/tests/baselines/reference/importTsBeforeDTs.errors.txt +++ b/tests/baselines/reference/importTsBeforeDTs.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/externalModules/foo_1.ts(2,14): error TS2339: Property 'x' does not exist on type 'typeof "tests/cases/conformance/externalModules/foo_0"'. + + ==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ==== import foo = require("./foo_0"); var z1 = foo.x + 10; // Should error, as .ts preferred over .d.ts ~ -!!! Property 'x' does not exist on type 'typeof "tests/cases/conformance/externalModules/foo_0"'. +!!! error TS2339: Property 'x' does not exist on type 'typeof "tests/cases/conformance/externalModules/foo_0"'. var z2 = foo.y + 10; // Should resolve ==== tests/cases/conformance/externalModules/foo_0.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/importedModuleAddToGlobal.errors.txt b/tests/baselines/reference/importedModuleAddToGlobal.errors.txt index d6989e5b3b9..2ffd16ecbf2 100644 --- a/tests/baselines/reference/importedModuleAddToGlobal.errors.txt +++ b/tests/baselines/reference/importedModuleAddToGlobal.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2304: Cannot find name 'b'. + + ==== tests/cases/compiler/importedModuleAddToGlobal.ts (1 errors) ==== // Binding for an import statement in a typeref position is being added to the global scope // Shouldn't compile b.B is not defined in C @@ -15,5 +18,5 @@ import a = A; function hello(): b.B { return null; } ~~~ -!!! Cannot find name 'b'. +!!! error TS2304: Cannot find name 'b'. } \ No newline at end of file diff --git a/tests/baselines/reference/inOperator.errors.txt b/tests/baselines/reference/inOperator.errors.txt index 83f11b759e5..7c9c874ea19 100644 --- a/tests/baselines/reference/inOperator.errors.txt +++ b/tests/baselines/reference/inOperator.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/inOperator.ts(7,15): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter + + ==== tests/cases/compiler/inOperator.ts (1 errors) ==== var a=[]; @@ -7,7 +10,7 @@ var b = '' in 0; ~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter var c: any; var y: number; diff --git a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt index cb65a412006..9411d016dcb 100644 --- a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt @@ -1,3 +1,25 @@ +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(15,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(18,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(29,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(31,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(32,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(33,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(34,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(35,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(36,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(37,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(40,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(40,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter + + ==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (20 errors) ==== enum E { a } @@ -12,31 +34,31 @@ var ra1 = a1 in x; ~~ -!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. var ra2 = a2 in x; ~~ -!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. var ra3 = a3 in x; ~~ -!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. var ra4 = a4 in x; ~~ -!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. var ra5 = null in x; ~~~~ -!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. var ra6 = undefined in x; ~~~~~~~~~ -!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. var ra7 = E.a in x; ~~~ -!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. var ra8 = false in x; ~~~~~ -!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. var ra9 = {} in x; ~~ -!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. // invalid right operands // the right operand is required to be of type Any, an object type, or a type parameter type @@ -47,35 +69,35 @@ var rb1 = x in b1; ~~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter var rb2 = x in b2; ~~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter var rb3 = x in b3; ~~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter var rb4 = x in b4; ~~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter var rb5 = x in 0; ~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter var rb6 = x in false; ~~~~~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter var rb7 = x in ''; ~~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter var rb8 = x in null; ~~~~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter var rb9 = x in undefined; ~~~~~~~~~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter // both operands are invalid var rc1 = {} in ''; ~~ -!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. ~~ -!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleExports1.errors.txt b/tests/baselines/reference/incompatibleExports1.errors.txt index 99a35e122bb..6371bfc5377 100644 --- a/tests/baselines/reference/incompatibleExports1.errors.txt +++ b/tests/baselines/reference/incompatibleExports1.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/incompatibleExports1.ts(4,5): error TS2309: An export assignment cannot be used in a module with other exported elements. +tests/cases/compiler/incompatibleExports1.ts(16,5): error TS2309: An export assignment cannot be used in a module with other exported elements. + + ==== tests/cases/compiler/incompatibleExports1.ts (2 errors) ==== declare module "foo" { export interface x { a: string } interface y { a: Date } export = y; ~~~~~~~~~~~ -!!! An export assignment cannot be used in a module with other exported elements. +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. } declare module "baz" { @@ -18,6 +22,6 @@ export = c; ~~~~~~~~~~~ -!!! An export assignment cannot be used in a module with other exported elements. +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. } \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleExports2.errors.txt b/tests/baselines/reference/incompatibleExports2.errors.txt index a809d70feb7..0ea5a35cf62 100644 --- a/tests/baselines/reference/incompatibleExports2.errors.txt +++ b/tests/baselines/reference/incompatibleExports2.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/incompatibleExports2.ts(4,5): error TS2309: An export assignment cannot be used in a module with other exported elements. + + ==== tests/cases/compiler/incompatibleExports2.ts (1 errors) ==== declare module "foo" { export interface x { a: string } interface y { a: Date } export = y; ~~~~~~~~~~~ -!!! An export assignment cannot be used in a module with other exported elements. +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. } \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleGenericTypes.errors.txt b/tests/baselines/reference/incompatibleGenericTypes.errors.txt index 5dca84027d8..13aa9ea2e25 100644 --- a/tests/baselines/reference/incompatibleGenericTypes.errors.txt +++ b/tests/baselines/reference/incompatibleGenericTypes.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/incompatibleGenericTypes.ts(10,5): error TS2322: Type 'I1' is not assignable to type 'I1': + Type 'boolean' is not assignable to type 'number'. + + ==== tests/cases/compiler/incompatibleGenericTypes.ts (1 errors) ==== interface I1 { @@ -10,5 +14,5 @@ var v2: I1 = v1; ~~ -!!! Type 'I1' is not assignable to type 'I1': -!!! Type 'boolean' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'I1' is not assignable to type 'I1': +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleTypes.errors.txt b/tests/baselines/reference/incompatibleTypes.errors.txt index bac9dbabf1f..6f7fd89d79e 100644 --- a/tests/baselines/reference/incompatibleTypes.errors.txt +++ b/tests/baselines/reference/incompatibleTypes.errors.txt @@ -1,3 +1,28 @@ +tests/cases/compiler/incompatibleTypes.ts(5,7): error TS2421: Class 'C1' incorrectly implements interface 'IFoo1': + Types of property 'p1' are incompatible: + Type '() => string' is not assignable to type '() => number': + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/incompatibleTypes.ts(15,7): error TS2421: Class 'C2' incorrectly implements interface 'IFoo2': + Types of property 'p1' are incompatible: + Type '(n: number) => number' is not assignable to type '(s: string) => number': + Types of parameters 'n' and 's' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/incompatibleTypes.ts(25,7): error TS2421: Class 'C3' incorrectly implements interface 'IFoo3': + Types of property 'p1' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/incompatibleTypes.ts(33,7): error TS2421: Class 'C4' incorrectly implements interface 'IFoo4': + Types of property 'p1' are incompatible: + Type '{ c: { b: string; }; d: string; }' is not assignable to type '{ a: { a: string; }; b: string; }': + Property 'a' is missing in type '{ c: { b: string; }; d: string; }'. +tests/cases/compiler/incompatibleTypes.ts(42,5): error TS2345: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. +tests/cases/compiler/incompatibleTypes.ts(49,5): error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. + Property 'c' is missing in type '{ e: number; f: number; }'. +tests/cases/compiler/incompatibleTypes.ts(66,5): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }': + Property 'a' is missing in type '{ e: number; f: number; }'. +tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2323: Type 'number' is not assignable to type '() => string'. +tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2323: Type '(a: any) => number' is not assignable to type '() => any'. + + ==== tests/cases/compiler/incompatibleTypes.ts (9 errors) ==== interface IFoo1 { p1(): number; @@ -5,10 +30,10 @@ class C1 implements IFoo1 { // incompatible on the return type ~~ -!!! Class 'C1' incorrectly implements interface 'IFoo1': -!!! Types of property 'p1' are incompatible: -!!! Type '() => string' is not assignable to type '() => number': -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2421: Class 'C1' incorrectly implements interface 'IFoo1': +!!! error TS2421: Types of property 'p1' are incompatible: +!!! error TS2421: Type '() => string' is not assignable to type '() => number': +!!! error TS2421: Type 'string' is not assignable to type 'number'. public p1() { return "s"; } @@ -20,11 +45,11 @@ class C2 implements IFoo2 { // incompatible on the param type ~~ -!!! Class 'C2' incorrectly implements interface 'IFoo2': -!!! Types of property 'p1' are incompatible: -!!! Type '(n: number) => number' is not assignable to type '(s: string) => number': -!!! Types of parameters 'n' and 's' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2421: Class 'C2' incorrectly implements interface 'IFoo2': +!!! error TS2421: Types of property 'p1' are incompatible: +!!! error TS2421: Type '(n: number) => number' is not assignable to type '(s: string) => number': +!!! error TS2421: Types of parameters 'n' and 's' are incompatible: +!!! error TS2421: Type 'number' is not assignable to type 'string'. public p1(n:number) { return 0; } @@ -36,9 +61,9 @@ class C3 implements IFoo3 { // incompatible on the property type ~~ -!!! Class 'C3' incorrectly implements interface 'IFoo3': -!!! Types of property 'p1' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2421: Class 'C3' incorrectly implements interface 'IFoo3': +!!! error TS2421: Types of property 'p1' are incompatible: +!!! error TS2421: Type 'number' is not assignable to type 'string'. public p1: number; } @@ -48,10 +73,10 @@ class C4 implements IFoo4 { // incompatible on the property type ~~ -!!! Class 'C4' incorrectly implements interface 'IFoo4': -!!! Types of property 'p1' are incompatible: -!!! Type '{ c: { b: string; }; d: string; }' is not assignable to type '{ a: { a: string; }; b: string; }': -!!! Property 'a' is missing in type '{ c: { b: string; }; d: string; }'. +!!! error TS2421: Class 'C4' incorrectly implements interface 'IFoo4': +!!! error TS2421: Types of property 'p1' are incompatible: +!!! error TS2421: Type '{ c: { b: string; }; d: string; }' is not assignable to type '{ a: { a: string; }; b: string; }': +!!! error TS2421: Property 'a' is missing in type '{ c: { b: string; }; d: string; }'. public p1: { c: { b: string; }; d: string; }; } @@ -62,7 +87,7 @@ var c2: C2; if1(c1); ~~ -!!! Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. +!!! error TS2345: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. function of1(n: { a: { a: string; }; b: string; }): number; @@ -71,8 +96,8 @@ of1({ e: 0, f: 0 }); ~~~~~~~~~~~~~~ -!!! Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. -!!! Property 'c' is missing in type '{ e: number; f: number; }'. +!!! error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. +!!! error TS2345: Property 'c' is missing in type '{ e: number; f: number; }'. interface IMap { [key:string]:string; @@ -91,8 +116,8 @@ var o1: { a: { a: string; }; b: string; } = { e: 0, f: 0 }; ~~ -!!! Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }': -!!! Property 'a' is missing in type '{ e: number; f: number; }'. +!!! error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }': +!!! error TS2322: Property 'a' is missing in type '{ e: number; f: number; }'. var a1 = [{ e: 0, f: 0 }, { e: 0, f: 0 }, { e: 0, g: 0 }]; @@ -100,9 +125,9 @@ var i1c1: { (): string; } = 5; ~~~~ -!!! Type 'number' is not assignable to type '() => string'. +!!! error TS2323: Type 'number' is not assignable to type '() => string'. var fp1: () =>any = a => 0; ~~~ -!!! Type '(a: any) => number' is not assignable to type '() => any'. +!!! error TS2323: Type '(a: any) => number' is not assignable to type '() => any'. \ No newline at end of file diff --git a/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt b/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt index f54412d13d4..b338129db8c 100644 --- a/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt +++ b/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,18): error TS1003: Identifier expected. +tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,10): error TS2304: Cannot find name 'window'. + + ==== tests/cases/compiler/incompleteDottedExpressionAtEOF.ts (2 errors) ==== // used to leak __missing into error message var p2 = window. -!!! Identifier expected. +!!! error TS1003: Identifier expected. ~~~~~~ -!!! Cannot find name 'window'. \ No newline at end of file +!!! error TS2304: Cannot find name 'window'. \ No newline at end of file diff --git a/tests/baselines/reference/incompleteObjectLiteral1.errors.txt b/tests/baselines/reference/incompleteObjectLiteral1.errors.txt index 60bebb70367..2e363de591e 100644 --- a/tests/baselines/reference/incompleteObjectLiteral1.errors.txt +++ b/tests/baselines/reference/incompleteObjectLiteral1.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/incompleteObjectLiteral1.ts(1,14): error TS1005: ':' expected. +tests/cases/compiler/incompleteObjectLiteral1.ts(1,16): error TS1128: Declaration or statement expected. + + ==== tests/cases/compiler/incompleteObjectLiteral1.ts (2 errors) ==== var tt = { aa; } ~ -!!! ':' expected. +!!! error TS1005: ':' expected. ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. var x = tt; \ No newline at end of file diff --git a/tests/baselines/reference/incorrectClassOverloadChain.errors.txt b/tests/baselines/reference/incorrectClassOverloadChain.errors.txt index c6a4361b56e..c33ba4c9b7b 100644 --- a/tests/baselines/reference/incorrectClassOverloadChain.errors.txt +++ b/tests/baselines/reference/incorrectClassOverloadChain.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/incorrectClassOverloadChain.ts(3,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/compiler/incorrectClassOverloadChain.ts (1 errors) ==== class C { foo(): string; foo(x): number; ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. x = 1; } \ No newline at end of file diff --git a/tests/baselines/reference/incrementAndDecrement.errors.txt b/tests/baselines/reference/incrementAndDecrement.errors.txt index b8dc8c5b4e0..f8a718c5f06 100644 --- a/tests/baselines/reference/incrementAndDecrement.errors.txt +++ b/tests/baselines/reference/incrementAndDecrement.errors.txt @@ -1,3 +1,26 @@ +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(8,5): error TS1005: ';' expected. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(11,5): error TS1005: ';' expected. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(14,5): error TS1005: ';' expected. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(17,5): error TS1005: ';' expected. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(5,9): error TS2304: Cannot find name 'window'. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(24,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(25,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(26,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(27,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(34,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(35,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(36,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(37,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(44,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(45,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(46,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(47,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(55,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(56,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(57,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(58,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + + ==== tests/cases/conformance/expressions/operators/incrementAndDecrement.ts (21 errors) ==== enum E { A, B, C }; var x = 4; @@ -5,27 +28,27 @@ var a: any; var w = window; ~~~~~~ -!!! Cannot find name 'window'. +!!! error TS2304: Cannot find name 'window'. // Assign to expression++ x++ = 4; // Error ~ -!!! ';' expected. +!!! error TS1005: ';' expected. // Assign to expression-- x-- = 5; // Error ~ -!!! ';' expected. +!!! error TS1005: ';' expected. // Assign to++expression ++x = 4; // Error ~ -!!! ';' expected. +!!! error TS1005: ';' expected. // Assign to--expression --x = 5; // Error ~ -!!! ';' expected. +!!! error TS1005: ';' expected. // Pre and postfix++ on number x++; @@ -34,16 +57,16 @@ --x; ++x++; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --x--; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++x--; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --x++; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. // Pre and postfix++ on enum e++; @@ -52,16 +75,16 @@ --e; ++e++; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --e--; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++e--; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --e++; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. // Pre and postfix++ on value of type 'any' a++; @@ -70,16 +93,16 @@ --a; ++a++; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --a--; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++a--; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --a++; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. // Pre and postfix++ on other types @@ -89,16 +112,16 @@ --w; // Error ++w++; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --w--; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++w--; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. --w++; // Error ~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file diff --git a/tests/baselines/reference/incrementOnTypeParameter.errors.txt b/tests/baselines/reference/incrementOnTypeParameter.errors.txt index b9461c690e2..10cfb13aee5 100644 --- a/tests/baselines/reference/incrementOnTypeParameter.errors.txt +++ b/tests/baselines/reference/incrementOnTypeParameter.errors.txt @@ -1,13 +1,17 @@ +tests/cases/compiler/incrementOnTypeParameter.ts(4,9): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/compiler/incrementOnTypeParameter.ts(5,39): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + ==== tests/cases/compiler/incrementOnTypeParameter.ts (2 errors) ==== class C { a: T; foo() { this.a++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. for (var i: T, j = 0; j < 10; i++) { ~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. } } } diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherType.types b/tests/baselines/reference/incrementOperatorWithAnyOtherType.types index 165c166941c..930c87274d0 100644 --- a/tests/baselines/reference/incrementOperatorWithAnyOtherType.types +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherType.types @@ -9,7 +9,7 @@ var ANY1; var ANY2: any[] = ["", ""]; >ANY2 : any[] ->["", ""] : any[] +>["", ""] : string[] var obj = {x:1,y:null}; >obj : { x: number; y: any; } diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt index 6ebcb4490eb..ab301964026 100644 --- a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt @@ -1,3 +1,47 @@ +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(24,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(25,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(26,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(27,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(28,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(30,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(31,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(32,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(33,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(34,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(37,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(39,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(42,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(43,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(46,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(47,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(51,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(52,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(54,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(55,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,25): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,25): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,25): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(59,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(60,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(63,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(65,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(67,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + + ==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts (42 errors) ==== // ++ operator on any type var ANY1; @@ -24,131 +68,131 @@ // any type var var ResultIsNumber1 = ++ANY2; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber2 = ++A; ~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber3 = ++M; ~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber4 = ++obj; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber5 = ++obj1; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber6 = ANY2++; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber7 = A++; ~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber8 = M++; ~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber9 = obj++; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber10 = obj1++; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // any type literal var ResultIsNumber11 = ++{}; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber12 = ++null; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber13 = ++undefined; ~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber14 = null++; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber15 = {}++; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber16 = undefined++; ~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // any type expressions var ResultIsNumber17 = ++foo(); ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber18 = ++A.foo(); ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber19 = ++(null + undefined); ~~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsNumber20 = ++(null + null); ~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var ResultIsNumber21 = ++(undefined + undefined); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsNumber22 = ++obj1.x; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber23 = ++obj1.y; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber24 = foo()++; ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber25 = A.foo()++; ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber26 = (null + undefined)++; ~~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsNumber27 = (null + null)++; ~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var ResultIsNumber28 = (undefined + undefined)++; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsNumber29 = obj1.x++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber30 = obj1.y++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // miss assignment operators ++ANY2; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ANY2++; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++ANY1++; ~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++ANY2++; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++ANY2[0]++; ~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file diff --git a/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt b/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt new file mode 100644 index 00000000000..9bcf6c7612f --- /dev/null +++ b/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(7,23): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(12,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + + +==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts (2 errors) ==== + // ++ operator on enum type + + enum ENUM1 { A, B, "" }; + + // expression + var ResultIsNumber1 = ++ENUM1["B"]; + var ResultIsNumber2 = ENUM1.B++; + ~~~~~~~ +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + + // miss assignment operator + ++ENUM1["B"]; + + ENUM1.B++; + ~~~~~~~ +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file diff --git a/tests/baselines/reference/incrementOperatorWithEnumType.js b/tests/baselines/reference/incrementOperatorWithEnumType.js index cdea036c335..2baa326f399 100644 --- a/tests/baselines/reference/incrementOperatorWithEnumType.js +++ b/tests/baselines/reference/incrementOperatorWithEnumType.js @@ -1,29 +1,29 @@ //// [incrementOperatorWithEnumType.ts] // ++ operator on enum type -enum ENUM1 { 1, 2, "" }; +enum ENUM1 { A, B, "" }; // expression -var ResultIsNumber1 = ++ENUM1[1]; -var ResultIsNumber2 = ENUM1[1]++; +var ResultIsNumber1 = ++ENUM1["B"]; +var ResultIsNumber2 = ENUM1.B++; // miss assignment operator -++ENUM1[1]; +++ENUM1["B"]; -ENUM1[1]++; +ENUM1.B++; //// [incrementOperatorWithEnumType.js] // ++ operator on enum type var ENUM1; (function (ENUM1) { - ENUM1[ENUM1["1"] = 0] = "1"; - ENUM1[ENUM1["2"] = 1] = "2"; + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = {})); ; // expression -var ResultIsNumber1 = ++ENUM1[1]; -var ResultIsNumber2 = ENUM1[1]++; +var ResultIsNumber1 = ++ENUM1["B"]; +var ResultIsNumber2 = 1 /* B */++; // miss assignment operator -++ENUM1[1]; -ENUM1[1]++; +++ENUM1["B"]; +1 /* B */++; diff --git a/tests/baselines/reference/incrementOperatorWithEnumType.types b/tests/baselines/reference/incrementOperatorWithEnumType.types deleted file mode 100644 index 3b13c01d5df..00000000000 --- a/tests/baselines/reference/incrementOperatorWithEnumType.types +++ /dev/null @@ -1,30 +0,0 @@ -=== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts === -// ++ operator on enum type - -enum ENUM1 { 1, 2, "" }; ->ENUM1 : ENUM1 - -// expression -var ResultIsNumber1 = ++ENUM1[1]; ->ResultIsNumber1 : number ->++ENUM1[1] : number ->ENUM1[1] : ENUM1 ->ENUM1 : typeof ENUM1 - -var ResultIsNumber2 = ENUM1[1]++; ->ResultIsNumber2 : number ->ENUM1[1]++ : number ->ENUM1[1] : ENUM1 ->ENUM1 : typeof ENUM1 - -// miss assignment operator -++ENUM1[1]; ->++ENUM1[1] : number ->ENUM1[1] : ENUM1 ->ENUM1 : typeof ENUM1 - -ENUM1[1]++; ->ENUM1[1]++ : number ->ENUM1[1] : ENUM1 ->ENUM1 : typeof ENUM1 - diff --git a/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.errors.txt b/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.errors.txt index f2262423810..08a1b8ec460 100644 --- a/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.errors.txt @@ -1,43 +1,55 @@ +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts(7,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts(8,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts(10,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts(11,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts(14,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts(15,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts(18,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts(19,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts(21,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts(22,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + ==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations.ts (10 errors) ==== // ++ operator on enum type enum ENUM { }; - enum ENUM1 { 1, 2, "" }; + enum ENUM1 { A, B, "" }; // enum type var var ResultIsNumber1 = ++ENUM; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber2 = ++ENUM1; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber3 = ENUM++; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber4 = ENUM1++; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // enum type expressions var ResultIsNumber5 = ++(ENUM[1] + ENUM[2]); ~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber6 = (ENUM[1] + ENUM[2])++; ~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // miss assignment operator ++ENUM; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++ENUM1; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ENUM++; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ENUM1++; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.js b/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.js index ed9b33e16bb..3bc43cefa4b 100644 --- a/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.js +++ b/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.js @@ -2,7 +2,7 @@ // ++ operator on enum type enum ENUM { }; -enum ENUM1 { 1, 2, "" }; +enum ENUM1 { A, B, "" }; // enum type var var ResultIsNumber1 = ++ENUM; @@ -30,8 +30,8 @@ var ENUM; ; var ENUM1; (function (ENUM1) { - ENUM1[ENUM1["1"] = 0] = "1"; - ENUM1[ENUM1["2"] = 1] = "2"; + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = {})); ; diff --git a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.errors.txt b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.errors.txt index be0ea1d1492..71c3ad67c46 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.errors.txt @@ -1,3 +1,25 @@ +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(18,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(19,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(22,25): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(23,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(24,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(26,23): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(27,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(28,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(31,25): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(32,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(33,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(35,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(36,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(37,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(40,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(41,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(42,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(44,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(45,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts(46,1): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. + + ==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithNumberTypeInvalidOperations.ts (20 errors) ==== // ++ operator on number type var NUMBER: number; @@ -18,70 +40,70 @@ //number type var var ResultIsNumber1 = ++NUMBER1; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber2 = NUMBER1++; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // number type literal var ResultIsNumber3 = ++1; ~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber4 = ++{ x: 1, y: 2}; ~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber5 = ++{ x: 1, y: (n: number) => { return n; } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber6 = 1++; ~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber7 = { x: 1, y: 2 }++; ~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }++; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // number type expressions var ResultIsNumber9 = ++foo(); ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber10 = ++A.foo(); ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber11 = ++(NUMBER + NUMBER); ~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber12 = foo()++; ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber13 = A.foo()++; ~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. var ResultIsNumber14 = (NUMBER + NUMBER)++; ~~~~~~~~~~~~~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. // miss assignment operator ++1; ~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. ++NUMBER1; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++foo(); ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. 1++; ~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. NUMBER1++; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. foo()++; ~~~~~ -!!! The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file +!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. \ No newline at end of file diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.errors.txt b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.errors.txt index ff51aac9af0..42c00a2bf28 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.errors.txt @@ -1,3 +1,34 @@ +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(17,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(19,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(22,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(23,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(24,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(26,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(27,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(28,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(31,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(32,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(33,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(34,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(36,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(37,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(38,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(39,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(42,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(43,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(44,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(45,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(46,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(47,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(49,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(50,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(51,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(52,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(53,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(54,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts(54,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + ==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedBooleanType.ts (29 errors) ==== // ++ operator on boolean type var BOOLEAN: boolean; @@ -17,97 +48,97 @@ // boolean type var var ResultIsNumber1 = ++BOOLEAN; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber2 = BOOLEAN++; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // boolean type literal var ResultIsNumber3 = ++true; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber4 = ++{ x: true, y: false }; ~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber5 = ++{ x: true, y: (n: boolean) => { return n; } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber6 = true++; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber7 = { x: true, y: false }++; ~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }++; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // boolean type expressions var ResultIsNumber9 = ++objA.a; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber10 = ++M.n; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber11 = ++foo(); ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber12 = ++A.foo(); ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber13 = foo()++; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber14 = A.foo()++; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber15 = objA.a++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber16 = M.n++; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // miss assignment operators ++true; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++BOOLEAN; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++foo(); ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++objA.a; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++M.n; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++objA.a, M.n; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. true++; ~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. BOOLEAN++; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. foo()++; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. objA.a++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. M.n++; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. objA.a++, M.n++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.errors.txt b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.errors.txt index 3449108faa4..7947bcb34b8 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.errors.txt @@ -1,3 +1,44 @@ +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(18,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(19,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(21,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(22,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(25,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(26,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(27,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(29,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(30,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(31,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(34,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(35,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(36,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(37,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(38,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(39,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(41,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(42,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(43,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(44,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(45,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(46,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(49,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(50,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(51,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(52,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(53,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(54,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(55,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(56,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(58,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(59,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(60,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(61,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(62,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(63,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(64,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(65,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(65,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + ==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts (39 errors) ==== // ++ operator on string type var STRING: string; @@ -18,127 +59,127 @@ // string type var var ResultIsNumber1 = ++STRING; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber2 = ++STRING1; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber3 = STRING++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber4 = STRING1++; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // string type literal var ResultIsNumber5 = ++""; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber6 = ++{ x: "", y: "" }; ~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber7 = ++{ x: "", y: (s: string) => { return s; } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber8 = ""++; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber9 = { x: "", y: "" }++; ~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }++; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // string type expressions var ResultIsNumber11 = ++objA.a; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber12 = ++M.n; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber13 = ++STRING1[0]; ~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber14 = ++foo(); ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber15 = ++A.foo(); ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber16 = ++(STRING + STRING); ~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber17 = objA.a++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber18 = M.n++; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber19 = STRING1[0]++; ~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber20 = foo()++; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber21 = A.foo()++; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber22 = (STRING + STRING)++; ~~~~~~~~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. // miss assignment operators ++""; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++STRING; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++STRING1; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++STRING1[0]; ~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++foo(); ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++objA.a; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++M.n; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ++objA.a, M.n; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ""++; ~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. STRING++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. STRING1++; ~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. STRING1[0]++; ~~~~~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. foo()++; ~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. objA.a++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. M.n++; ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. objA.a++, M.n++; ~~~~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. ~~~ -!!! An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/indexIntoArraySubclass.errors.txt b/tests/baselines/reference/indexIntoArraySubclass.errors.txt index 83919640f7a..297ef6a960b 100644 --- a/tests/baselines/reference/indexIntoArraySubclass.errors.txt +++ b/tests/baselines/reference/indexIntoArraySubclass.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/indexIntoArraySubclass.ts(4,1): error TS2323: Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/indexIntoArraySubclass.ts (1 errors) ==== interface Foo2 extends Array { } var x2: Foo2; var r = x2[0]; // string r = 0; //error ~ -!!! Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2323: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt index d0aec71ef15..52934b7ae9e 100644 --- a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt +++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt @@ -1,22 +1,28 @@ +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(2,6): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(7,6): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(12,5): error TS1021: An index signature must have a type annotation. + + ==== tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts (4 errors) ==== interface I { [x]: string; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [x: string]; ~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. } class C { [x]: string ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. } class C2 { [x: string] ~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureTypeCheck.errors.txt b/tests/baselines/reference/indexSignatureTypeCheck.errors.txt index 0c808feecbf..1cc69f6294b 100644 --- a/tests/baselines/reference/indexSignatureTypeCheck.errors.txt +++ b/tests/baselines/reference/indexSignatureTypeCheck.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/indexSignatureTypeCheck.ts(14,6): error TS1019: An index signature parameter cannot have a question mark. +tests/cases/compiler/indexSignatureTypeCheck.ts(15,9): error TS1017: An index signature cannot have a rest parameter. +tests/cases/compiler/indexSignatureTypeCheck.ts(16,6): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/indexSignatureTypeCheck.ts(17,6): error TS1096: An index signature must have exactly one parameter. + + ==== tests/cases/compiler/indexSignatureTypeCheck.ts (4 errors) ==== interface IPropertySet { @@ -14,14 +20,14 @@ interface indexErrors { [p2?: string]; ~~ -!!! An index signature parameter cannot have a question mark. +!!! error TS1019: An index signature parameter cannot have a question mark. [...p3: any[]]; ~~ -!!! An index signature cannot have a rest parameter. +!!! error TS1017: An index signature cannot have a rest parameter. [p4: string, p5?: string]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. [p6: string, ...p7: any[]]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureTypeCheck2.errors.txt b/tests/baselines/reference/indexSignatureTypeCheck2.errors.txt index 88a004e0b37..25e3ab94280 100644 --- a/tests/baselines/reference/indexSignatureTypeCheck2.errors.txt +++ b/tests/baselines/reference/indexSignatureTypeCheck2.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/indexSignatureTypeCheck2.ts(10,6): error TS1019: An index signature parameter cannot have a question mark. +tests/cases/compiler/indexSignatureTypeCheck2.ts(11,9): error TS1017: An index signature cannot have a rest parameter. +tests/cases/compiler/indexSignatureTypeCheck2.ts(12,6): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/indexSignatureTypeCheck2.ts(13,6): error TS1096: An index signature must have exactly one parameter. + + ==== tests/cases/compiler/indexSignatureTypeCheck2.ts (4 errors) ==== class IPropertySet { [index: string]: any @@ -10,14 +16,14 @@ interface indexErrors { [p2?: string]; ~~ -!!! An index signature parameter cannot have a question mark. +!!! error TS1019: An index signature parameter cannot have a question mark. [...p3: any[]]; ~~ -!!! An index signature cannot have a rest parameter. +!!! error TS1017: An index signature cannot have a rest parameter. [p4: string, p5?: string]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. [p6: string, ...p7: any[]]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureTypeInference.errors.txt b/tests/baselines/reference/indexSignatureTypeInference.errors.txt index ee42069a4ec..55bd2ce884f 100644 --- a/tests/baselines/reference/indexSignatureTypeInference.errors.txt +++ b/tests/baselines/reference/indexSignatureTypeInference.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts(18,27): error TS2345: Argument of type 'NumberMap' is not assignable to parameter of type 'StringMap<{}>'. + + ==== tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts (1 errors) ==== interface NumberMap { [index: number]: T; @@ -18,6 +21,6 @@ var v1 = numberMapToArray(stringMap); // Ok var v1 = stringMapToArray(numberMap); // Error expected here ~~~~~~~~~ -!!! Argument of type 'NumberMap' is not assignable to parameter of type 'StringMap<{}>'. +!!! error TS2345: Argument of type 'NumberMap' is not assignable to parameter of type 'StringMap<{}>'. var v1 = stringMapToArray(stringMap); // Ok \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt b/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt index 0b857a8df05..6c836e268d6 100644 --- a/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt +++ b/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt @@ -1,16 +1,22 @@ +tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(2,13): error TS1018: An index signature parameter cannot have an accessibility modifier. +tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(6,13): error TS1018: An index signature parameter cannot have an accessibility modifier. +tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(2,6): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(6,6): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts (4 errors) ==== interface I { [public x: string]: string; ~ -!!! An index signature parameter cannot have an accessibility modifier. +!!! error TS1018: An index signature parameter cannot have an accessibility modifier. ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } class C { [public x: string]: string ~ -!!! An index signature parameter cannot have an accessibility modifier. +!!! error TS1018: An index signature parameter cannot have an accessibility modifier. ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt index c82a2103e66..9eeff2c5781 100644 --- a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt +++ b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt @@ -1,16 +1,22 @@ +tests/cases/compiler/indexSignatureWithInitializer.ts(2,6): error TS1020: An index signature parameter cannot have an initializer. +tests/cases/compiler/indexSignatureWithInitializer.ts(6,6): error TS1020: An index signature parameter cannot have an initializer. +tests/cases/compiler/indexSignatureWithInitializer.ts(2,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/compiler/indexSignatureWithInitializer.ts(6,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + + ==== tests/cases/compiler/indexSignatureWithInitializer.ts (4 errors) ==== interface I { [x = '']: string; ~ -!!! An index signature parameter cannot have an initializer. +!!! error TS1020: An index signature parameter cannot have an initializer. ~~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. } class C { [x = 0]: string ~ -!!! An index signature parameter cannot have an initializer. +!!! error TS1020: An index signature parameter cannot have an initializer. ~~~~~ -!!! A parameter initializer is only allowed in a function or constructor implementation. +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignaturesInferentialTyping.types b/tests/baselines/reference/indexSignaturesInferentialTyping.types index 3c16db3a2bf..4054ccca227 100644 --- a/tests/baselines/reference/indexSignaturesInferentialTyping.types +++ b/tests/baselines/reference/indexSignaturesInferentialTyping.types @@ -24,10 +24,10 @@ var x1 = foo({ 0: 0, 1: 1 }); // type should be number >{ 0: 0, 1: 1 } : { [x: number]: number; 0: number; 1: number; } var x2 = foo({ zero: 0, one: 1 }); ->x2 : {} ->foo({ zero: 0, one: 1 }) : {} +>x2 : any +>foo({ zero: 0, one: 1 }) : any >foo : (items: { [x: number]: T; }) => T ->{ zero: 0, one: 1 } : { [x: number]: {}; zero: number; one: number; } +>{ zero: 0, one: 1 } : { [x: number]: undefined; zero: number; one: number; } >zero : number >one : number diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index d5a9fab9d62..71bc03eca96 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -1,11 +1,21 @@ +tests/cases/compiler/indexTypeCheck.ts(2,2): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/indexTypeCheck.ts(3,2): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. +tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'. +tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. +tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. + + ==== tests/cases/compiler/indexTypeCheck.ts (8 errors) ==== interface Red { [n:number]; // ok ~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [s:string]; // ok ~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. } interface Blue { @@ -21,34 +31,34 @@ interface Orange { [n:number]: number; // ok ~~~~~~~~~~~~~~~~~~~ -!!! Numeric index type 'number' is not assignable to string index type 'string'. +!!! error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. [s:string]: string; // error } interface Green { [n:number]: Orange; // error ~~~~~~~~~~~~~~~~~~~ -!!! Numeric index type 'Orange' is not assignable to string index type 'Yellow'. +!!! error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'. [s:string]: Yellow; // ok } interface Cyan { [n:number]: number; // error ~~~~~~~~~~~~~~~~~~~ -!!! Numeric index type 'number' is not assignable to string index type 'string'. +!!! error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. [s:string]: string; // ok } interface Purple { [n:number, s:string]; // error ~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. } interface Magenta { [p:Purple]; // error ~ -!!! An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. } var yellow: Yellow; @@ -65,7 +75,7 @@ yellow[blue]; // error ~~~~~~~~~~~~ -!!! An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. var x:number[]; x[0]; diff --git a/tests/baselines/reference/indexWithoutParamType.errors.txt b/tests/baselines/reference/indexWithoutParamType.errors.txt index 0fc4f4c094f..292583302a0 100644 --- a/tests/baselines/reference/indexWithoutParamType.errors.txt +++ b/tests/baselines/reference/indexWithoutParamType.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/indexWithoutParamType.ts(1,10): error TS1096: An index signature must have exactly one parameter. + + ==== tests/cases/compiler/indexWithoutParamType.ts (1 errors) ==== var y: { []; } // Error ~~ -!!! An index signature must have exactly one parameter. \ No newline at end of file +!!! error TS1096: An index signature must have exactly one parameter. \ No newline at end of file diff --git a/tests/baselines/reference/indexWithoutParamType2.errors.txt b/tests/baselines/reference/indexWithoutParamType2.errors.txt index 50cdb50379e..3e7b9b49223 100644 --- a/tests/baselines/reference/indexWithoutParamType2.errors.txt +++ b/tests/baselines/reference/indexWithoutParamType2.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/indexWithoutParamType2.ts(2,6): error TS1022: An index signature parameter must have a type annotation. + + ==== tests/cases/compiler/indexWithoutParamType2.ts (1 errors) ==== class C { [x]: string ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. } \ No newline at end of file diff --git a/tests/baselines/reference/indexer.types b/tests/baselines/reference/indexer.types index 236113cfaa8..9987fdde0b1 100644 --- a/tests/baselines/reference/indexer.types +++ b/tests/baselines/reference/indexer.types @@ -17,7 +17,7 @@ interface JQuery { var jq:JQuery={ 0: { id : "a" }, 1: { id : "b" } }; >jq : JQuery >JQuery : JQuery ->{ 0: { id : "a" }, 1: { id : "b" } } : { [x: number]: JQueryElement; 0: { id: string; }; 1: { id: string; }; } +>{ 0: { id : "a" }, 1: { id : "b" } } : { [x: number]: { id: string; }; 0: { id: string; }; 1: { id: string; }; } >{ id : "a" } : { id: string; } >id : string >{ id : "b" } : { id: string; } diff --git a/tests/baselines/reference/indexer2.errors.txt b/tests/baselines/reference/indexer2.errors.txt new file mode 100644 index 00000000000..9587bb6bb75 --- /dev/null +++ b/tests/baselines/reference/indexer2.errors.txt @@ -0,0 +1,20 @@ +tests/cases/compiler/indexer2.ts(6,25): error TS2353: Neither type '{ [x: number]: undefined; }' nor type 'IDirectChildrenMap' is assignable to the other: + Types of property 'hasOwnProperty' are incompatible: + Type '(v: string) => boolean' is not assignable to type '(objectId: number) => boolean': + Types of parameters 'v' and 'objectId' are incompatible: + Type 'string' is not assignable to type 'number'. + + +==== tests/cases/compiler/indexer2.ts (1 errors) ==== + interface IHeapObjectProperty {} + interface IDirectChildrenMap { + hasOwnProperty(objectId: number) : boolean; + [objectId: number] : IHeapObjectProperty[]; + } + var directChildrenMap = {}; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2353: Neither type '{ [x: number]: undefined; }' nor type 'IDirectChildrenMap' is assignable to the other: +!!! error TS2353: Types of property 'hasOwnProperty' are incompatible: +!!! error TS2353: Type '(v: string) => boolean' is not assignable to type '(objectId: number) => boolean': +!!! error TS2353: Types of parameters 'v' and 'objectId' are incompatible: +!!! error TS2353: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/indexer2.types b/tests/baselines/reference/indexer2.types deleted file mode 100644 index 498ade679a8..00000000000 --- a/tests/baselines/reference/indexer2.types +++ /dev/null @@ -1,21 +0,0 @@ -=== tests/cases/compiler/indexer2.ts === -interface IHeapObjectProperty {} ->IHeapObjectProperty : IHeapObjectProperty - -interface IDirectChildrenMap { ->IDirectChildrenMap : IDirectChildrenMap - - hasOwnProperty(objectId: number) : boolean; ->hasOwnProperty : (objectId: number) => boolean ->objectId : number - - [objectId: number] : IHeapObjectProperty[]; ->objectId : number ->IHeapObjectProperty : IHeapObjectProperty -} -var directChildrenMap = {}; ->directChildrenMap : IDirectChildrenMap ->{} : IDirectChildrenMap ->IDirectChildrenMap : IDirectChildrenMap ->{} : { [x: number]: IHeapObjectProperty[]; } - diff --git a/tests/baselines/reference/indexer2A.errors.txt b/tests/baselines/reference/indexer2A.errors.txt index 59575b3ef5b..548ed5e565b 100644 --- a/tests/baselines/reference/indexer2A.errors.txt +++ b/tests/baselines/reference/indexer2A.errors.txt @@ -1,10 +1,24 @@ -==== tests/cases/compiler/indexer2A.ts (1 errors) ==== +tests/cases/compiler/indexer2A.ts(4,5): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/indexer2A.ts(7,25): error TS2353: Neither type '{ [x: number]: undefined; }' nor type 'IDirectChildrenMap' is assignable to the other: + Types of property 'hasOwnProperty' are incompatible: + Type '(v: string) => boolean' is not assignable to type '(objectId: number) => boolean': + Types of parameters 'v' and 'objectId' are incompatible: + Type 'string' is not assignable to type 'number'. + + +==== tests/cases/compiler/indexer2A.ts (2 errors) ==== class IHeapObjectProperty { } class IDirectChildrenMap { // Decided to enforce a semicolon after declarations hasOwnProperty(objectId: number): boolean ~~~~~~~~~~~~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. [objectId: number]: IHeapObjectProperty[] } - var directChildrenMap = {}; \ No newline at end of file + var directChildrenMap = {}; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2353: Neither type '{ [x: number]: undefined; }' nor type 'IDirectChildrenMap' is assignable to the other: +!!! error TS2353: Types of property 'hasOwnProperty' are incompatible: +!!! error TS2353: Type '(v: string) => boolean' is not assignable to type '(objectId: number) => boolean': +!!! error TS2353: Types of parameters 'v' and 'objectId' are incompatible: +!!! error TS2353: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/indexer3.types b/tests/baselines/reference/indexer3.types index 2b23ac85885..7f660ab6aa9 100644 --- a/tests/baselines/reference/indexer3.types +++ b/tests/baselines/reference/indexer3.types @@ -3,7 +3,7 @@ var dateMap: { [x: string]: Date; } = {} >dateMap : { [x: string]: Date; } >x : string >Date : Date ->{} : { [x: string]: Date; } +>{} : { [x: string]: undefined; } var r: Date = dateMap["hello"] // result type includes indexer using BCT >r : Date diff --git a/tests/baselines/reference/indexerA.types b/tests/baselines/reference/indexerA.types index 7b409ecedc0..39f7372c839 100644 --- a/tests/baselines/reference/indexerA.types +++ b/tests/baselines/reference/indexerA.types @@ -17,7 +17,7 @@ class JQuery { var jq:JQuery={ 0: { id : "a" }, 1: { id : "b" } }; >jq : JQuery >JQuery : JQuery ->{ 0: { id : "a" }, 1: { id : "b" } } : { [x: number]: JQueryElement; 0: { id: string; }; 1: { id: string; }; } +>{ 0: { id : "a" }, 1: { id : "b" } } : { [x: number]: { id: string; }; 0: { id: string; }; 1: { id: string; }; } >{ id : "a" } : { id: string; } >id : string >{ id : "b" } : { id: string; } diff --git a/tests/baselines/reference/indexerAsOptional.errors.txt b/tests/baselines/reference/indexerAsOptional.errors.txt index c76a4791936..101c03acccd 100644 --- a/tests/baselines/reference/indexerAsOptional.errors.txt +++ b/tests/baselines/reference/indexerAsOptional.errors.txt @@ -1,14 +1,18 @@ +tests/cases/compiler/indexerAsOptional.ts(3,6): error TS1019: An index signature parameter cannot have a question mark. +tests/cases/compiler/indexerAsOptional.ts(8,6): error TS1019: An index signature parameter cannot have a question mark. + + ==== tests/cases/compiler/indexerAsOptional.ts (2 errors) ==== interface indexSig { //Index signatures can't be optional [idx?: number]: any; //err ~~~ -!!! An index signature parameter cannot have a question mark. +!!! error TS1019: An index signature parameter cannot have a question mark. } class indexSig2 { //Index signatures can't be optional [idx?: number]: any //err ~~~ -!!! An index signature parameter cannot have a question mark. +!!! error TS1019: An index signature parameter cannot have a question mark. } \ No newline at end of file diff --git a/tests/baselines/reference/indexerAssignability.errors.txt b/tests/baselines/reference/indexerAssignability.errors.txt index b7dca06f207..062ddbc3c43 100644 --- a/tests/baselines/reference/indexerAssignability.errors.txt +++ b/tests/baselines/reference/indexerAssignability.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/indexerAssignability.ts(5,1): error TS2322: Type '{ [x: number]: string; }' is not assignable to type '{ [x: string]: string; }': + Index signature is missing in type '{ [x: number]: string; }'. +tests/cases/compiler/indexerAssignability.ts(6,1): error TS2322: Type '{}' is not assignable to type '{ [x: string]: string; }': + Index signature is missing in type '{}'. +tests/cases/compiler/indexerAssignability.ts(8,1): error TS2322: Type '{}' is not assignable to type '{ [x: number]: string; }': + Index signature is missing in type '{}'. + + ==== tests/cases/compiler/indexerAssignability.ts (3 errors) ==== var a: { [s: string]: string; }; var b: { [n: number]: string; }; @@ -5,16 +13,16 @@ a = b; ~ -!!! Type '{ [x: number]: string; }' is not assignable to type '{ [x: string]: string; }': -!!! Index signature is missing in type '{ [x: number]: string; }'. +!!! error TS2322: Type '{ [x: number]: string; }' is not assignable to type '{ [x: string]: string; }': +!!! error TS2322: Index signature is missing in type '{ [x: number]: string; }'. a = c; ~ -!!! Type '{}' is not assignable to type '{ [x: string]: string; }': -!!! Index signature is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type '{ [x: string]: string; }': +!!! error TS2322: Index signature is missing in type '{}'. b = a; b = c; ~ -!!! Type '{}' is not assignable to type '{ [x: number]: string; }': -!!! Index signature is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type '{ [x: number]: string; }': +!!! error TS2322: Index signature is missing in type '{}'. c = a; c = b; \ No newline at end of file diff --git a/tests/baselines/reference/indexerConstraints.errors.txt b/tests/baselines/reference/indexerConstraints.errors.txt index ff0a75e0b7f..cb7785535d1 100644 --- a/tests/baselines/reference/indexerConstraints.errors.txt +++ b/tests/baselines/reference/indexerConstraints.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/indexerConstraints.ts(17,5): error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. +tests/cases/compiler/indexerConstraints.ts(25,5): error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. +tests/cases/compiler/indexerConstraints.ts(33,5): error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. +tests/cases/compiler/indexerConstraints.ts(41,5): error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. + + ==== tests/cases/compiler/indexerConstraints.ts (4 errors) ==== interface A { a: number; } interface B extends A { b: number; } @@ -17,7 +23,7 @@ interface E { [n: number]: A; ~~~~~~~~~~~~~~~ -!!! Numeric index type 'A' is not assignable to string index type 'B'. +!!! error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. } // Inheritance @@ -27,7 +33,7 @@ interface G extends F { [n: number]: A; ~~~~~~~~~~~~~~~ -!!! Numeric index type 'A' is not assignable to string index type 'B'. +!!! error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. } // Other way @@ -37,7 +43,7 @@ interface I extends H { [s: string]: B; ~~~~~~~~~~~~~~~ -!!! Numeric index type 'A' is not assignable to string index type 'B'. +!!! error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. } // With hidden indexer @@ -47,6 +53,6 @@ interface K extends J { [n: number]: A; ~~~~~~~~~~~~~~~ -!!! Numeric index type 'A' is not assignable to string index type 'B'. +!!! error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. [s: string]: B; } \ No newline at end of file diff --git a/tests/baselines/reference/indexerConstraints2.errors.txt b/tests/baselines/reference/indexerConstraints2.errors.txt index 39f16a1b200..316486e709f 100644 --- a/tests/baselines/reference/indexerConstraints2.errors.txt +++ b/tests/baselines/reference/indexerConstraints2.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/indexerConstraints2.ts(9,5): error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. +tests/cases/compiler/indexerConstraints2.ts(17,5): error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. +tests/cases/compiler/indexerConstraints2.ts(26,5): error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. + + ==== tests/cases/compiler/indexerConstraints2.ts (3 errors) ==== class A { a: number; } class B extends A { b: number; } @@ -9,7 +14,7 @@ class G extends F { [n: number]: A ~~~~~~~~~~~~~~ -!!! Numeric index type 'A' is not assignable to string index type 'B'. +!!! error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. } // Other way @@ -19,7 +24,7 @@ class I extends H { [s: string]: B ~~~~~~~~~~~~~~ -!!! Numeric index type 'A' is not assignable to string index type 'B'. +!!! error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. } // With hidden indexer @@ -30,6 +35,6 @@ class K extends J { [n: number]: A; ~~~~~~~~~~~~~~~ -!!! Numeric index type 'A' is not assignable to string index type 'B'. +!!! error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. [s: string]: B; } \ No newline at end of file diff --git a/tests/baselines/reference/indexerSignatureWithRestParam.errors.txt b/tests/baselines/reference/indexerSignatureWithRestParam.errors.txt index d97a4d2a19d..4743ed8e91c 100644 --- a/tests/baselines/reference/indexerSignatureWithRestParam.errors.txt +++ b/tests/baselines/reference/indexerSignatureWithRestParam.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/indexerSignatureWithRestParam.ts(2,9): error TS1017: An index signature cannot have a rest parameter. +tests/cases/compiler/indexerSignatureWithRestParam.ts(6,9): error TS1017: An index signature cannot have a rest parameter. + + ==== tests/cases/compiler/indexerSignatureWithRestParam.ts (2 errors) ==== interface I { [...x]: string; ~ -!!! An index signature cannot have a rest parameter. +!!! error TS1017: An index signature cannot have a rest parameter. } class C { [...x]: string ~ -!!! An index signature cannot have a rest parameter. +!!! error TS1017: An index signature cannot have a rest parameter. } \ No newline at end of file diff --git a/tests/baselines/reference/indexerWithTuple.js b/tests/baselines/reference/indexerWithTuple.js new file mode 100644 index 00000000000..fc82716ba05 --- /dev/null +++ b/tests/baselines/reference/indexerWithTuple.js @@ -0,0 +1,32 @@ +//// [indexerWithTuple.ts] +var strNumTuple: [string, number] = ["foo", 10]; +var numTupleTuple: [number, [string, number]] = [10, ["bar", 20]]; + +// no error +var idx0 = 0; +var idx1 = 1; +var ele10 = strNumTuple[0]; // string +var ele11 = strNumTuple[1]; // number +var ele12 = strNumTuple[2]; // {} +var ele13 = strNumTuple[idx0]; // {} +var ele14 = strNumTuple[idx1]; // {} +var ele15 = strNumTuple["0"]; // string +var ele16 = strNumTuple["1"]; // number +var strNumTuple1 = numTupleTuple[1]; //[string, number]; +var ele17 = numTupleTuple[2]; // {} + +//// [indexerWithTuple.js] +var strNumTuple = ["foo", 10]; +var numTupleTuple = [10, ["bar", 20]]; +// no error +var idx0 = 0; +var idx1 = 1; +var ele10 = strNumTuple[0]; // string +var ele11 = strNumTuple[1]; // number +var ele12 = strNumTuple[2]; // {} +var ele13 = strNumTuple[idx0]; // {} +var ele14 = strNumTuple[idx1]; // {} +var ele15 = strNumTuple["0"]; // string +var ele16 = strNumTuple["1"]; // number +var strNumTuple1 = numTupleTuple[1]; //[string, number]; +var ele17 = numTupleTuple[2]; // {} diff --git a/tests/baselines/reference/indexerWithTuple.types b/tests/baselines/reference/indexerWithTuple.types new file mode 100644 index 00000000000..28053a33081 --- /dev/null +++ b/tests/baselines/reference/indexerWithTuple.types @@ -0,0 +1,64 @@ +=== tests/cases/conformance/types/tuple/indexerWithTuple.ts === +var strNumTuple: [string, number] = ["foo", 10]; +>strNumTuple : [string, number] +>["foo", 10] : [string, number] + +var numTupleTuple: [number, [string, number]] = [10, ["bar", 20]]; +>numTupleTuple : [number, [string, number]] +>[10, ["bar", 20]] : [number, [string, number]] +>["bar", 20] : [string, number] + +// no error +var idx0 = 0; +>idx0 : number + +var idx1 = 1; +>idx1 : number + +var ele10 = strNumTuple[0]; // string +>ele10 : string +>strNumTuple[0] : string +>strNumTuple : [string, number] + +var ele11 = strNumTuple[1]; // number +>ele11 : number +>strNumTuple[1] : number +>strNumTuple : [string, number] + +var ele12 = strNumTuple[2]; // {} +>ele12 : string | number +>strNumTuple[2] : string | number +>strNumTuple : [string, number] + +var ele13 = strNumTuple[idx0]; // {} +>ele13 : string | number +>strNumTuple[idx0] : string | number +>strNumTuple : [string, number] +>idx0 : number + +var ele14 = strNumTuple[idx1]; // {} +>ele14 : string | number +>strNumTuple[idx1] : string | number +>strNumTuple : [string, number] +>idx1 : number + +var ele15 = strNumTuple["0"]; // string +>ele15 : string +>strNumTuple["0"] : string +>strNumTuple : [string, number] + +var ele16 = strNumTuple["1"]; // number +>ele16 : number +>strNumTuple["1"] : number +>strNumTuple : [string, number] + +var strNumTuple1 = numTupleTuple[1]; //[string, number]; +>strNumTuple1 : [string, number] +>numTupleTuple[1] : [string, number] +>numTupleTuple : [number, [string, number]] + +var ele17 = numTupleTuple[2]; // {} +>ele17 : number | [string, number] +>numTupleTuple[2] : number | [string, number] +>numTupleTuple : [number, [string, number]] + diff --git a/tests/baselines/reference/indirectSelfReference.errors.txt b/tests/baselines/reference/indirectSelfReference.errors.txt index 209d85233ac..e7c5a00d421 100644 --- a/tests/baselines/reference/indirectSelfReference.errors.txt +++ b/tests/baselines/reference/indirectSelfReference.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/indirectSelfReference.ts(1,7): error TS2310: Type 'a' recursively references itself as a base type. + + ==== tests/cases/compiler/indirectSelfReference.ts (1 errors) ==== class a extends b{ } ~ -!!! Type 'a' recursively references itself as a base type. +!!! error TS2310: Type 'a' recursively references itself as a base type. class b extends a{ } \ No newline at end of file diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt b/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt index 6ce51ab9752..765112f0e99 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/indirectSelfReferenceGeneric.ts(1,7): error TS2310: Type 'a' recursively references itself as a base type. + + ==== tests/cases/compiler/indirectSelfReferenceGeneric.ts (1 errors) ==== class a extends b { } ~ -!!! Type 'a' recursively references itself as a base type. +!!! error TS2310: Type 'a' recursively references itself as a base type. class b extends a { } \ No newline at end of file diff --git a/tests/baselines/reference/inferSetterParamType.errors.txt b/tests/baselines/reference/inferSetterParamType.errors.txt index 5c8a590e620..9b01d9c4bc6 100644 --- a/tests/baselines/reference/inferSetterParamType.errors.txt +++ b/tests/baselines/reference/inferSetterParamType.errors.txt @@ -1,14 +1,21 @@ +tests/cases/compiler/inferSetterParamType.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inferSetterParamType.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inferSetterParamType.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inferSetterParamType.ts(13,16): error TS2323: Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/inferSetterParamType.ts (5 errors) ==== class Foo { get bar() { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 0; } set bar(n) { // should not be an error - infer number ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } @@ -16,14 +23,14 @@ get bar() { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 0; // should be an error - can't coerce infered return type to match setter annotated type ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. } set bar(n:string) { ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } \ No newline at end of file diff --git a/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types b/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types index 11e017d6661..53a9dff0b48 100644 --- a/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types +++ b/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types @@ -34,7 +34,7 @@ var result = zipWith([1, 2], ['a', 'b'], pair); >zipWith([1, 2], ['a', 'b'], pair) : { x: number; y: {}; }[] >zipWith : (a: T[], b: S[], f: (x: T) => (y: S) => U) => U[] >[1, 2] : number[] ->['a', 'b'] : {}[] +>['a', 'b'] : string[] >pair : (x: T) => (y: S) => { x: T; y: S; } var i = result[0].x; // number diff --git a/tests/baselines/reference/inferentialTypingWithObjectLiteralProperties.errors.txt b/tests/baselines/reference/inferentialTypingWithObjectLiteralProperties.errors.txt index 8644e8b3e0b..0c87fb6d22d 100644 --- a/tests/baselines/reference/inferentialTypingWithObjectLiteralProperties.errors.txt +++ b/tests/baselines/reference/inferentialTypingWithObjectLiteralProperties.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(4,1): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(5,1): error TS2323: Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts (2 errors) ==== function f(x: T, y: T): T { return x; } f({ x: [null] }, { x: [1] }).x[0] = "" // ok ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. f({ x: [1] }, { x: [null] }).x[0] = "" // was error TS2011: Cannot convert 'string' to 'number'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types b/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types index c8f51c985e6..451280ee16f 100644 --- a/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types +++ b/tests/baselines/reference/inferentiallyTypingAnEmptyArray.types @@ -25,6 +25,6 @@ foo([]).bar; >foo([]).bar : any >foo([]) : any >foo : (arr: T[]) => T ->[] : any[] +>[] : undefined[] >bar : any diff --git a/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt b/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt index d1afdb17f44..915e75dd6da 100644 --- a/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt +++ b/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts(1,1): error TS2354: No best common type exists among return expressions. + + ==== tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts (1 errors) ==== function foo() { ~~~~~~~~~~~~~~~~ @@ -15,5 +18,5 @@ ~~~~~ }; ~ -!!! No best common type exists among return expressions. +!!! error TS2354: No best common type exists among return expressions. \ No newline at end of file diff --git a/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt b/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt index 577913c10e9..908681ddf7a 100644 --- a/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt +++ b/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts(16,1): error TS2322: Type 'OwnerList' is not assignable to type 'List': + Types of property 'data' are incompatible: + Type 'List' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts(21,5): error TS2322: Type 'OwnerList' is not assignable to type 'List': + Types of property 'data' are incompatible: + Type 'List' is not assignable to type 'T'. + + ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts (2 errors) ==== // instantiating a derived type can cause an infinitely expanding type reference to be generated @@ -16,18 +24,18 @@ var ownerList: OwnerList; list = ownerList; ~~~~ -!!! Type 'OwnerList' is not assignable to type 'List': -!!! Types of property 'data' are incompatible: -!!! Type 'List' is not assignable to type 'string'. +!!! error TS2322: Type 'OwnerList' is not assignable to type 'List': +!!! error TS2322: Types of property 'data' are incompatible: +!!! error TS2322: Type 'List' is not assignable to type 'string'. function other(x: T) { var list: List; var ownerList: OwnerList; list = ownerList; ~~~~ -!!! Type 'OwnerList' is not assignable to type 'List': -!!! Types of property 'data' are incompatible: -!!! Type 'List' is not assignable to type 'T'. +!!! error TS2322: Type 'OwnerList' is not assignable to type 'List': +!!! error TS2322: Types of property 'data' are incompatible: +!!! error TS2322: Type 'List' is not assignable to type 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/infiniteExpansionThroughInstantiation2.errors.txt b/tests/baselines/reference/infiniteExpansionThroughInstantiation2.errors.txt index 958adf5d312..1778e092715 100644 --- a/tests/baselines/reference/infiniteExpansionThroughInstantiation2.errors.txt +++ b/tests/baselines/reference/infiniteExpansionThroughInstantiation2.errors.txt @@ -1,10 +1,13 @@ +tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation2.ts(4,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation2.ts (1 errors) ==== // instantiating a derived type can cause an infinitely expanding type reference to be generated // which could be used in an assignment check for constraint satisfaction interface AA> // now an error due to referencing type parameter in constraint ~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. { x: T } diff --git a/tests/baselines/reference/infinitelyExpandingOverloads.errors.txt b/tests/baselines/reference/infinitelyExpandingOverloads.errors.txt index fb3893d9c2a..fc3c49477fb 100644 --- a/tests/baselines/reference/infinitelyExpandingOverloads.errors.txt +++ b/tests/baselines/reference/infinitelyExpandingOverloads.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/infinitelyExpandingOverloads.ts(23,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/infinitelyExpandingOverloads.ts (1 errors) ==== interface KnockoutSubscription2 { target: KnockoutObservableBase2; @@ -23,7 +26,7 @@ } public get options(): ViewModel { ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return null; } } \ No newline at end of file diff --git a/tests/baselines/reference/infinitelyExpandingTypes1.errors.txt b/tests/baselines/reference/infinitelyExpandingTypes1.errors.txt index 969036a6355..e188c8da45f 100644 --- a/tests/baselines/reference/infinitelyExpandingTypes1.errors.txt +++ b/tests/baselines/reference/infinitelyExpandingTypes1.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/infinitelyExpandingTypes1.ts(21,1): error TS2365: Operator '==' cannot be applied to types 'List' and 'List'. + + ==== tests/cases/compiler/infinitelyExpandingTypes1.ts (1 errors) ==== interface List { data: T; @@ -21,6 +24,6 @@ l == l2; // should error; ~~~~~~~ -!!! Operator '==' cannot be applied to types 'List' and 'List'. +!!! error TS2365: Operator '==' cannot be applied to types 'List' and 'List'. l == l; // should not error \ No newline at end of file diff --git a/tests/baselines/reference/infinitelyExpandingTypes2.errors.txt b/tests/baselines/reference/infinitelyExpandingTypes2.errors.txt index c9e46e20b97..3f79b63ca1e 100644 --- a/tests/baselines/reference/infinitelyExpandingTypes2.errors.txt +++ b/tests/baselines/reference/infinitelyExpandingTypes2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/infinitelyExpandingTypes2.ts(10,5): error TS2304: Cannot find name 'console'. + + ==== tests/cases/compiler/infinitelyExpandingTypes2.ts (1 errors) ==== interface Foo { x: Foo>; @@ -10,7 +13,7 @@ function f(p: Foo) { console.log(p); ~~~~~~~ -!!! Cannot find name 'console'. +!!! error TS2304: Cannot find name 'console'. } var v: Bar = null; diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt b/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt index f2946439380..a9b3cb4b686 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/inheritFromGenericTypeParameter.ts(1,20): error TS2311: A class may only extend another class. +tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An interface may only extend a class or another interface. + + ==== tests/cases/compiler/inheritFromGenericTypeParameter.ts (2 errors) ==== class C extends T { } ~ -!!! A class may only extend another class. +!!! error TS2311: A class may only extend another class. interface I extends T { } ~ -!!! An interface may only extend a class or another interface. \ No newline at end of file +!!! error TS2312: An interface may only extend a class or another interface. \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt index c4093032cf8..71a9f74e77a 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2': + Named properties 'x' of types 'C' and 'C2' are not identical. + + ==== tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts (1 errors) ==== class C { private x: number; @@ -9,7 +13,7 @@ interface A extends C, C2 { // error ~ -!!! Interface 'A' cannot simultaneously extend types 'C' and 'C2': -!!! Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2': +!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt index 3dc0aa2b25b..8de311e230a 100644 --- a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt +++ b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2': + Named properties 'x' of types 'C' and 'C2' are not identical. + + ==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts (1 errors) ==== interface C { x?: number; @@ -9,7 +13,7 @@ interface A extends C, C2 { // error ~ -!!! Interface 'A' cannot simultaneously extend types 'C' and 'C2': -!!! Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2': +!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt index e8d89b75c09..a6671492277 100644 --- a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt +++ b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2': + Named properties 'x' of types 'C' and 'C2' are not identical. + + ==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts (1 errors) ==== class C { public x: number; @@ -9,7 +13,7 @@ interface A extends C, C2 { // error ~ -!!! Interface 'A' cannot simultaneously extend types 'C' and 'C2': -!!! Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2': +!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritance.errors.txt b/tests/baselines/reference/inheritance.errors.txt index dfe00fc6240..4811357b6d5 100644 --- a/tests/baselines/reference/inheritance.errors.txt +++ b/tests/baselines/reference/inheritance.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/inheritance.ts(30,7): error TS2416: Class 'Baad' incorrectly extends base class 'Good': + Types of property 'g' are incompatible: + Type '(n: number) => number' is not assignable to type '() => number'. +tests/cases/compiler/inheritance.ts(31,12): error TS2425: Class 'Good' defines instance member property 'f', but extended class 'Baad' defines it as instance member function. + + ==== tests/cases/compiler/inheritance.ts (2 errors) ==== class B1 { public x; @@ -30,12 +36,12 @@ class Baad extends Good { ~~~~ -!!! Class 'Baad' incorrectly extends base class 'Good': -!!! Types of property 'g' are incompatible: -!!! Type '(n: number) => number' is not assignable to type '() => number'. +!!! error TS2416: Class 'Baad' incorrectly extends base class 'Good': +!!! error TS2416: Types of property 'g' are incompatible: +!!! error TS2416: Type '(n: number) => number' is not assignable to type '() => number'. public f(): number { return 0; } ~ -!!! Class 'Good' defines instance member property 'f', but extended class 'Baad' defines it as instance member function. +!!! error TS2425: Class 'Good' defines instance member property 'f', but extended class 'Baad' defines it as instance member function. public g(n: number) { return 0; } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritance1.errors.txt b/tests/baselines/reference/inheritance1.errors.txt index 537b7b8fa4e..0d2f6a72bfd 100644 --- a/tests/baselines/reference/inheritance1.errors.txt +++ b/tests/baselines/reference/inheritance1.errors.txt @@ -1,3 +1,27 @@ +tests/cases/compiler/inheritance1.ts(14,7): error TS2421: Class 'ImageBase' incorrectly implements interface 'SelectableControl': + Property 'select' is missing in type 'ImageBase'. +tests/cases/compiler/inheritance1.ts(18,7): error TS2421: Class 'Locations' incorrectly implements interface 'SelectableControl': + Property 'state' is missing in type 'Locations'. +tests/cases/compiler/inheritance1.ts(31,1): error TS2322: Type 'Control' is not assignable to type 'Button': + Property 'select' is missing in type 'Control'. +tests/cases/compiler/inheritance1.ts(37,1): error TS2322: Type 'Control' is not assignable to type 'TextBox': + Property 'select' is missing in type 'Control'. +tests/cases/compiler/inheritance1.ts(40,1): error TS2323: Type 'ImageBase' is not assignable to type 'SelectableControl'. +tests/cases/compiler/inheritance1.ts(46,1): error TS2322: Type 'Image1' is not assignable to type 'SelectableControl': + Property 'select' is missing in type 'Image1'. +tests/cases/compiler/inheritance1.ts(52,1): error TS2323: Type 'Locations' is not assignable to type 'SelectableControl'. +tests/cases/compiler/inheritance1.ts(53,1): error TS2322: Type 'Locations' is not assignable to type 'Control': + Property 'state' is missing in type 'Locations'. +tests/cases/compiler/inheritance1.ts(55,1): error TS2322: Type 'Control' is not assignable to type 'Locations': + Property 'select' is missing in type 'Control'. +tests/cases/compiler/inheritance1.ts(58,1): error TS2322: Type 'Locations1' is not assignable to type 'SelectableControl': + Property 'state' is missing in type 'Locations1'. +tests/cases/compiler/inheritance1.ts(59,1): error TS2322: Type 'Locations1' is not assignable to type 'Control': + Property 'state' is missing in type 'Locations1'. +tests/cases/compiler/inheritance1.ts(61,1): error TS2322: Type 'Control' is not assignable to type 'Locations1': + Property 'select' is missing in type 'Control'. + + ==== tests/cases/compiler/inheritance1.ts (12 errors) ==== class Control { private state: any; @@ -14,15 +38,15 @@ } class ImageBase extends Control implements SelectableControl{ ~~~~~~~~~ -!!! Class 'ImageBase' incorrectly implements interface 'SelectableControl': -!!! Property 'select' is missing in type 'ImageBase'. +!!! error TS2421: Class 'ImageBase' incorrectly implements interface 'SelectableControl': +!!! error TS2421: Property 'select' is missing in type 'ImageBase'. } class Image1 extends Control { } class Locations implements SelectableControl { ~~~~~~~~~ -!!! Class 'Locations' incorrectly implements interface 'SelectableControl': -!!! Property 'state' is missing in type 'Locations'. +!!! error TS2421: Class 'Locations' incorrectly implements interface 'SelectableControl': +!!! error TS2421: Property 'state' is missing in type 'Locations'. select() { } } class Locations1 { @@ -37,8 +61,8 @@ b = sc; b = c; ~ -!!! Type 'Control' is not assignable to type 'Button': -!!! Property 'select' is missing in type 'Control'. +!!! error TS2322: Type 'Control' is not assignable to type 'Button': +!!! error TS2322: Property 'select' is missing in type 'Control'. var t: TextBox; sc = t; @@ -46,13 +70,13 @@ t = sc; t = c; ~ -!!! Type 'Control' is not assignable to type 'TextBox': -!!! Property 'select' is missing in type 'Control'. +!!! error TS2322: Type 'Control' is not assignable to type 'TextBox': +!!! error TS2322: Property 'select' is missing in type 'Control'. var i: ImageBase; sc = i; ~~ -!!! Type 'ImageBase' is not assignable to type 'SelectableControl'. +!!! error TS2323: Type 'ImageBase' is not assignable to type 'SelectableControl'. c = i; i = sc; i = c; @@ -60,8 +84,8 @@ var i1: Image1; sc = i1; ~~ -!!! Type 'Image1' is not assignable to type 'SelectableControl': -!!! Property 'select' is missing in type 'Image1'. +!!! error TS2322: Type 'Image1' is not assignable to type 'SelectableControl': +!!! error TS2322: Property 'select' is missing in type 'Image1'. c = i1; i1 = sc; i1 = c; @@ -69,28 +93,28 @@ var l: Locations; sc = l; ~~ -!!! Type 'Locations' is not assignable to type 'SelectableControl'. +!!! error TS2323: Type 'Locations' is not assignable to type 'SelectableControl'. c = l; ~ -!!! Type 'Locations' is not assignable to type 'Control': -!!! Property 'state' is missing in type 'Locations'. +!!! error TS2322: Type 'Locations' is not assignable to type 'Control': +!!! error TS2322: Property 'state' is missing in type 'Locations'. l = sc; l = c; ~ -!!! Type 'Control' is not assignable to type 'Locations': -!!! Property 'select' is missing in type 'Control'. +!!! error TS2322: Type 'Control' is not assignable to type 'Locations': +!!! error TS2322: Property 'select' is missing in type 'Control'. var l1: Locations1; sc = l1; ~~ -!!! Type 'Locations1' is not assignable to type 'SelectableControl': -!!! Property 'state' is missing in type 'Locations1'. +!!! error TS2322: Type 'Locations1' is not assignable to type 'SelectableControl': +!!! error TS2322: Property 'state' is missing in type 'Locations1'. c = l1; ~ -!!! Type 'Locations1' is not assignable to type 'Control': -!!! Property 'state' is missing in type 'Locations1'. +!!! error TS2322: Type 'Locations1' is not assignable to type 'Control': +!!! error TS2322: Property 'state' is missing in type 'Locations1'. l1 = sc; l1 = c; ~~ -!!! Type 'Control' is not assignable to type 'Locations1': -!!! Property 'select' is missing in type 'Control'. \ No newline at end of file +!!! error TS2322: Type 'Control' is not assignable to type 'Locations1': +!!! error TS2322: Property 'select' is missing in type 'Control'. \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.errors.txt b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.errors.txt index a59e3da0d04..8bcef0e5a14 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.errors.txt +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/inheritanceGrandParentPrivateMemberCollision.ts(7,7): error TS2416: Class 'C' incorrectly extends base class 'B': + Types have separate declarations of a private property 'myMethod'. + + ==== tests/cases/compiler/inheritanceGrandParentPrivateMemberCollision.ts (1 errors) ==== class A { private myMethod() { } @@ -7,8 +11,8 @@ class C extends B { ~ -!!! Class 'C' incorrectly extends base class 'B': -!!! Private property 'myMethod' cannot be reimplemented. +!!! error TS2416: Class 'C' incorrectly extends base class 'B': +!!! error TS2416: Types have separate declarations of a private property 'myMethod'. private myMethod() { } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.errors.txt b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.errors.txt index ca7a3b32b8e..7676029fb8b 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.errors.txt +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.ts(7,7): error TS2416: Class 'C' incorrectly extends base class 'B': + Property 'myMethod' is private in type 'B' but not in type 'C'. + + ==== tests/cases/compiler/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.ts (1 errors) ==== class A { private myMethod() { } @@ -7,8 +11,8 @@ class C extends B { ~ -!!! Class 'C' incorrectly extends base class 'B': -!!! Private property 'myMethod' cannot be reimplemented. +!!! error TS2416: Class 'C' incorrectly extends base class 'B': +!!! error TS2416: Property 'myMethod' is private in type 'B' but not in type 'C'. public myMethod() { } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.errors.txt b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.errors.txt index be63f2e9c1e..c5d41868fab 100644 --- a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.errors.txt +++ b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.ts(7,7): error TS2416: Class 'C' incorrectly extends base class 'B': + Property 'myMethod' is private in type 'C' but not in type 'B'. + + ==== tests/cases/compiler/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.ts (1 errors) ==== class A { public myMethod() { } @@ -7,8 +11,8 @@ class C extends B { ~ -!!! Class 'C' incorrectly extends base class 'B': -!!! Private property 'myMethod' cannot be reimplemented. +!!! error TS2416: Class 'C' incorrectly extends base class 'B': +!!! error TS2416: Property 'myMethod' is private in type 'C' but not in type 'B'. private myMethod() { } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.errors.txt b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.errors.txt index b62b70743ca..f729e230ca2 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.errors.txt +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.errors.txt @@ -1,13 +1,19 @@ +tests/cases/compiler/inheritanceMemberAccessorOverridingAccessor.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceMemberAccessorOverridingAccessor.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceMemberAccessorOverridingAccessor.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceMemberAccessorOverridingAccessor.ts(14,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/inheritanceMemberAccessorOverridingAccessor.ts (4 errors) ==== class a { get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "20"; } set x(aValue: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } @@ -15,12 +21,12 @@ class b extends a { get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "20"; } set x(aValue: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt index 3d97822ef7d..243bcecb57d 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(7,7): error TS2416: Class 'b' incorrectly extends base class 'a': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type '() => string'. +tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(8,9): error TS2423: Class 'a' defines instance member function 'x', but extended class 'b' defines it as instance member accessor. + + ==== tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts (4 errors) ==== class a { x() { @@ -7,19 +15,19 @@ class b extends a { ~ -!!! Class 'b' incorrectly extends base class 'a': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type '() => string'. +!!! error TS2416: Class 'b' incorrectly extends base class 'a': +!!! error TS2416: Types of property 'x' are incompatible: +!!! error TS2416: Type 'string' is not assignable to type '() => string'. get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Class 'a' defines instance member function 'x', but extended class 'b' defines it as instance member accessor. +!!! error TS2423: Class 'a' defines instance member function 'x', but extended class 'b' defines it as instance member accessor. return "20"; } set x(aValue: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.errors.txt b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.errors.txt index 85342038c54..98b9d349d64 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.errors.txt +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/inheritanceMemberAccessorOverridingProperty.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceMemberAccessorOverridingProperty.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/inheritanceMemberAccessorOverridingProperty.ts (2 errors) ==== class a { x: string; @@ -6,12 +10,12 @@ class b extends a { get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "20"; } set x(aValue: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.errors.txt b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.errors.txt index 8575f167c0b..3208de26bd4 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.errors.txt +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.errors.txt @@ -1,25 +1,33 @@ +tests/cases/compiler/inheritanceMemberFuncOverridingAccessor.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceMemberFuncOverridingAccessor.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceMemberFuncOverridingAccessor.ts(10,7): error TS2416: Class 'b' incorrectly extends base class 'a': + Types of property 'x' are incompatible: + Type '() => string' is not assignable to type 'string'. +tests/cases/compiler/inheritanceMemberFuncOverridingAccessor.ts(11,5): error TS2426: Class 'a' defines instance member accessor 'x', but extended class 'b' defines it as instance member function. + + ==== tests/cases/compiler/inheritanceMemberFuncOverridingAccessor.ts (4 errors) ==== class a { get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "20"; } set x(aValue: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } class b extends a { ~ -!!! Class 'b' incorrectly extends base class 'a': -!!! Types of property 'x' are incompatible: -!!! Type '() => string' is not assignable to type 'string'. +!!! error TS2416: Class 'b' incorrectly extends base class 'a': +!!! error TS2416: Types of property 'x' are incompatible: +!!! error TS2416: Type '() => string' is not assignable to type 'string'. x() { ~ -!!! Class 'a' defines instance member accessor 'x', but extended class 'b' defines it as instance member function. +!!! error TS2426: Class 'a' defines instance member accessor 'x', but extended class 'b' defines it as instance member function. return "20"; } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.errors.txt b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.errors.txt index 9c1fc8c565f..bf35b620e73 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.errors.txt +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/inheritanceMemberFuncOverridingProperty.ts(6,5): error TS2425: Class 'a' defines instance member property 'x', but extended class 'b' defines it as instance member function. + + ==== tests/cases/compiler/inheritanceMemberFuncOverridingProperty.ts (1 errors) ==== class a { x: () => string; @@ -6,7 +9,7 @@ class b extends a { x() { ~ -!!! Class 'a' defines instance member property 'x', but extended class 'b' defines it as instance member function. +!!! error TS2425: Class 'a' defines instance member property 'x', but extended class 'b' defines it as instance member function. return "20"; } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.errors.txt b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.errors.txt index 45f6ed765df..ec8ec05a8ae 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.errors.txt +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.errors.txt @@ -1,14 +1,18 @@ +tests/cases/compiler/inheritanceMemberPropertyOverridingAccessor.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceMemberPropertyOverridingAccessor.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/inheritanceMemberPropertyOverridingAccessor.ts (2 errors) ==== class a { private __x: () => string; get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return this.__x; } set x(aValue: () => string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. this.__x = aValue; } } diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.errors.txt b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.errors.txt index 03a0e21de72..2b56866b22b 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.errors.txt +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/inheritanceMemberPropertyOverridingMethod.ts(8,5): error TS2424: Class 'a' defines instance member function 'x', but extended class 'b' defines it as instance member property. + + ==== tests/cases/compiler/inheritanceMemberPropertyOverridingMethod.ts (1 errors) ==== class a { x() { @@ -8,5 +11,5 @@ class b extends a { x: () => string; ~ -!!! Class 'a' defines instance member function 'x', but extended class 'b' defines it as instance member property. +!!! error TS2424: Class 'a' defines instance member function 'x', but extended class 'b' defines it as instance member property. } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.errors.txt b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.errors.txt index 74f1f1409e8..ae6a19c4530 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.errors.txt +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.errors.txt @@ -1,13 +1,19 @@ +tests/cases/compiler/inheritanceStaticAccessorOverridingAccessor.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticAccessorOverridingAccessor.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticAccessorOverridingAccessor.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticAccessorOverridingAccessor.ts(14,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/inheritanceStaticAccessorOverridingAccessor.ts (4 errors) ==== class a { static get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "20"; } static set x(aValue: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } @@ -15,12 +21,12 @@ class b extends a { static get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "20"; } static set x(aValue: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt index 47752c88765..eb8b181c1fd 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(7,7): error TS2418: Class static side 'typeof b' incorrectly extends base class static side 'typeof a': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type '() => string'. + + ==== tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts (3 errors) ==== class a { static x() { @@ -7,17 +14,17 @@ class b extends a { ~ -!!! Class static side 'typeof b' incorrectly extends base class static side 'typeof a': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type '() => string'. +!!! error TS2418: Class static side 'typeof b' incorrectly extends base class static side 'typeof a': +!!! error TS2418: Types of property 'x' are incompatible: +!!! error TS2418: Type 'string' is not assignable to type '() => string'. static get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "20"; } static set x(aValue: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.errors.txt b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.errors.txt index 65d69802e8a..cdcbaa101e7 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.errors.txt +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/inheritanceStaticAccessorOverridingProperty.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticAccessorOverridingProperty.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/inheritanceStaticAccessorOverridingProperty.ts (2 errors) ==== class a { static x: string; @@ -6,12 +10,12 @@ class b extends a { static get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "20"; } static set x(aValue: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.errors.txt b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.errors.txt index 5b015fd54cd..46e079217b8 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.errors.txt +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.errors.txt @@ -1,22 +1,29 @@ +tests/cases/compiler/inheritanceStaticFuncOverridingAccessor.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticFuncOverridingAccessor.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticFuncOverridingAccessor.ts(10,7): error TS2418: Class static side 'typeof b' incorrectly extends base class static side 'typeof a': + Types of property 'x' are incompatible: + Type '() => string' is not assignable to type 'string'. + + ==== tests/cases/compiler/inheritanceStaticFuncOverridingAccessor.ts (3 errors) ==== class a { static get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return "20"; } static set x(aValue: string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } class b extends a { ~ -!!! Class static side 'typeof b' incorrectly extends base class static side 'typeof a': -!!! Types of property 'x' are incompatible: -!!! Type '() => string' is not assignable to type 'string'. +!!! error TS2418: Class static side 'typeof b' incorrectly extends base class static side 'typeof a': +!!! error TS2418: Types of property 'x' are incompatible: +!!! error TS2418: Type '() => string' is not assignable to type 'string'. static x() { return "20"; } diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.errors.txt b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.errors.txt index 2c3804a5eba..1fa828f30c4 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.errors.txt +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/inheritanceStaticFuncOverridingAccessorOfFuncType.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/inheritanceStaticFuncOverridingAccessorOfFuncType.ts (1 errors) ==== class a { static get x(): () => string { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return null; } } diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.errors.txt b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.errors.txt index 346937240e1..3ecc7a44522 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.errors.txt +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/inheritanceStaticFuncOverridingProperty.ts(5,7): error TS2418: Class static side 'typeof b' incorrectly extends base class static side 'typeof a': + Types of property 'x' are incompatible: + Type '() => string' is not assignable to type 'string'. + + ==== tests/cases/compiler/inheritanceStaticFuncOverridingProperty.ts (1 errors) ==== class a { static x: string; @@ -5,9 +10,9 @@ class b extends a { ~ -!!! Class static side 'typeof b' incorrectly extends base class static side 'typeof a': -!!! Types of property 'x' are incompatible: -!!! Type '() => string' is not assignable to type 'string'. +!!! error TS2418: Class static side 'typeof b' incorrectly extends base class static side 'typeof a': +!!! error TS2418: Types of property 'x' are incompatible: +!!! error TS2418: Type '() => string' is not assignable to type 'string'. static x() { return "20"; } diff --git a/tests/baselines/reference/inheritanceStaticMembersIncompatible.errors.txt b/tests/baselines/reference/inheritanceStaticMembersIncompatible.errors.txt index 92c0c6a83b1..01c276be81c 100644 --- a/tests/baselines/reference/inheritanceStaticMembersIncompatible.errors.txt +++ b/tests/baselines/reference/inheritanceStaticMembersIncompatible.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/inheritanceStaticMembersIncompatible.ts(5,7): error TS2418: Class static side 'typeof b' incorrectly extends base class static side 'typeof a': + Types of property 'x' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/inheritanceStaticMembersIncompatible.ts (1 errors) ==== class a { static x: string; @@ -5,8 +10,8 @@ class b extends a { ~ -!!! Class static side 'typeof b' incorrectly extends base class static side 'typeof a': -!!! Types of property 'x' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2418: Class static side 'typeof b' incorrectly extends base class static side 'typeof a': +!!! error TS2418: Types of property 'x' are incompatible: +!!! error TS2418: Type 'number' is not assignable to type 'string'. static x: number; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.errors.txt b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.errors.txt index 3611d019a2a..08aab5b1158 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.errors.txt +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.errors.txt @@ -1,13 +1,17 @@ +tests/cases/compiler/inheritanceStaticPropertyOverridingAccessor.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticPropertyOverridingAccessor.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/inheritanceStaticPropertyOverridingAccessor.ts (2 errors) ==== class a { static get x(): () => string { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return null;; } static set x(aValue: () => string) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } } diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.errors.txt b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.errors.txt index 5498010bddb..f2137aab6f0 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.errors.txt +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/inheritanceStaticPropertyOverridingMethod.ts(7,7): error TS2418: Class static side 'typeof b' incorrectly extends base class static side 'typeof a': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type '() => string'. + + ==== tests/cases/compiler/inheritanceStaticPropertyOverridingMethod.ts (1 errors) ==== class a { static x() { @@ -7,8 +12,8 @@ class b extends a { ~ -!!! Class static side 'typeof b' incorrectly extends base class static side 'typeof a': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type '() => string'. +!!! error TS2418: Class static side 'typeof b' incorrectly extends base class static side 'typeof a': +!!! error TS2418: Types of property 'x' are incompatible: +!!! error TS2418: Type 'string' is not assignable to type '() => string'. static x: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams.errors.txt b/tests/baselines/reference/inheritedConstructorWithRestParams.errors.txt index 7a1dcbe5a55..fd63eafbaf7 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams.errors.txt +++ b/tests/baselines/reference/inheritedConstructorWithRestParams.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/inheritedConstructorWithRestParams.ts(13,17): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/inheritedConstructorWithRestParams.ts(14,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/inheritedConstructorWithRestParams.ts (2 errors) ==== class Base { constructor(...a: string[]) { } @@ -13,7 +17,7 @@ // Errors new Derived("", 3); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new Derived(3); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt b/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt index c26643584c8..514d0d8941f 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/inheritedConstructorWithRestParams2.ts(32,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/inheritedConstructorWithRestParams2.ts(33,17): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/inheritedConstructorWithRestParams2.ts(34,17): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/inheritedConstructorWithRestParams2.ts (3 errors) ==== class IBaseBase { constructor(x: U) { } @@ -32,10 +37,10 @@ // Errors new Derived(3); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new Derived("", 3, "", 3); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new Derived("", 3, "", ""); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases.errors.txt b/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases.errors.txt index d02ddfbb148..d2ad69730da 100644 --- a/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases.errors.txt +++ b/tests/baselines/reference/inheritedMembersAndIndexSignaturesFromDifferentBases.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/inheritedMembersAndIndexSignaturesFromDifferentBases.ts(17,11): error TS2411: Property 'm' of type '{}' is not assignable to string index type '{ a: any; }'. +tests/cases/compiler/inheritedMembersAndIndexSignaturesFromDifferentBases.ts(23,11): error TS2411: Property '0' of type '{}' is not assignable to string index type '{ a: any; }'. +tests/cases/compiler/inheritedMembersAndIndexSignaturesFromDifferentBases.ts(23,11): error TS2412: Property '0' of type '{}' is not assignable to numeric index type '{ a: any; b: any; }'. +tests/cases/compiler/inheritedMembersAndIndexSignaturesFromDifferentBases.ts(25,11): error TS2411: Property '0' of type '{}' is not assignable to string index type '{ a: any; }'. +tests/cases/compiler/inheritedMembersAndIndexSignaturesFromDifferentBases.ts(25,11): error TS2411: Property 'm' of type '{}' is not assignable to string index type '{ a: any; }'. +tests/cases/compiler/inheritedMembersAndIndexSignaturesFromDifferentBases.ts(25,11): error TS2412: Property '0' of type '{}' is not assignable to numeric index type '{ a: any; b: any; }'. + + ==== tests/cases/compiler/inheritedMembersAndIndexSignaturesFromDifferentBases.ts (6 errors) ==== // indexer in B is a subtype of indexer in A interface A { @@ -17,7 +25,7 @@ interface D extends A, B, C { } // error because m is not a subtype of {a;} ~ -!!! Property 'm' of type '{}' is not assignable to string index type '{ a: any; }'. +!!! error TS2411: Property 'm' of type '{}' is not assignable to string index type '{ a: any; }'. interface E { 0: {}; @@ -25,16 +33,16 @@ interface F extends A, B, E { } // error because 0 is not a subtype of {a; b;} ~ -!!! Property '0' of type '{}' is not assignable to string index type '{ a: any; }'. +!!! error TS2411: Property '0' of type '{}' is not assignable to string index type '{ a: any; }'. ~ -!!! Property '0' of type '{}' is not assignable to numeric index type '{ a: any; b: any; }'. +!!! error TS2412: Property '0' of type '{}' is not assignable to numeric index type '{ a: any; b: any; }'. interface G extends A, B, C, E { } // should only report one error ~ -!!! Property '0' of type '{}' is not assignable to string index type '{ a: any; }'. +!!! error TS2411: Property '0' of type '{}' is not assignable to string index type '{ a: any; }'. ~ -!!! Property 'm' of type '{}' is not assignable to string index type '{ a: any; }'. +!!! error TS2411: Property 'm' of type '{}' is not assignable to string index type '{ a: any; }'. ~ -!!! Property '0' of type '{}' is not assignable to numeric index type '{ a: any; b: any; }'. +!!! error TS2412: Property '0' of type '{}' is not assignable to numeric index type '{ a: any; b: any; }'. interface H extends A, F { } // Should report no error at all because error is internal to F \ No newline at end of file diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt b/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt index ed90ca4d415..31816482cb5 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/inheritedModuleMembersForClodule.ts(7,7): error TS2418: Class static side 'typeof D' incorrectly extends base class static side 'typeof C': + Types of property 'foo' are incompatible: + Type '() => number' is not assignable to type '() => string': + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/inheritedModuleMembersForClodule.ts (1 errors) ==== class C { static foo(): string { @@ -7,10 +13,10 @@ class D extends C { ~ -!!! Class static side 'typeof D' incorrectly extends base class static side 'typeof C': -!!! Types of property 'foo' are incompatible: -!!! Type '() => number' is not assignable to type '() => string': -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2418: Class static side 'typeof D' incorrectly extends base class static side 'typeof C': +!!! error TS2418: Types of property 'foo' are incompatible: +!!! error TS2418: Type '() => number' is not assignable to type '() => string': +!!! error TS2418: Type 'number' is not assignable to type 'string'. } module D { diff --git a/tests/baselines/reference/inheritedStringIndexersFromDifferentBaseTypes.errors.txt b/tests/baselines/reference/inheritedStringIndexersFromDifferentBaseTypes.errors.txt index cd119798286..a7861a136ca 100644 --- a/tests/baselines/reference/inheritedStringIndexersFromDifferentBaseTypes.errors.txt +++ b/tests/baselines/reference/inheritedStringIndexersFromDifferentBaseTypes.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/inheritedStringIndexersFromDifferentBaseTypes.ts(13,11): error TS2429: Interface 'E' incorrectly extends interface 'D': + Index signatures are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/inheritedStringIndexersFromDifferentBaseTypes.ts(28,11): error TS2429: Interface 'E2' incorrectly extends interface 'D2': + Index signatures are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/inheritedStringIndexersFromDifferentBaseTypes.ts (2 errors) ==== // string indexer tests interface A { @@ -13,9 +21,9 @@ } interface E extends A, D { } // error ~ -!!! Interface 'E' incorrectly extends interface 'D': -!!! Index signatures are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2429: Interface 'E' incorrectly extends interface 'D': +!!! error TS2429: Index signatures are incompatible: +!!! error TS2429: Type 'number' is not assignable to type 'string'. // Same tests for number indexer @@ -32,6 +40,6 @@ } interface E2 extends A2, D2 { } // error ~~ -!!! Interface 'E2' incorrectly extends interface 'D2': -!!! Index signatures are incompatible: -!!! Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2429: Interface 'E2' incorrectly extends interface 'D2': +!!! error TS2429: Index signatures are incompatible: +!!! error TS2429: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/inheritedStringIndexersFromDifferentBaseTypes2.errors.txt b/tests/baselines/reference/inheritedStringIndexersFromDifferentBaseTypes2.errors.txt index de29e44ac46..8e6fc5b3158 100644 --- a/tests/baselines/reference/inheritedStringIndexersFromDifferentBaseTypes2.errors.txt +++ b/tests/baselines/reference/inheritedStringIndexersFromDifferentBaseTypes2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/inheritedStringIndexersFromDifferentBaseTypes2.ts(18,11): error TS2413: Numeric index type '{}' is not assignable to string index type '{ a: any; }'. + + ==== tests/cases/compiler/inheritedStringIndexersFromDifferentBaseTypes2.ts (1 errors) ==== // indexer in B is a subtype of indexer in A interface A { @@ -18,7 +21,7 @@ } interface E extends A, D { } // error ~ -!!! Numeric index type '{}' is not assignable to string index type '{ a: any; }'. +!!! error TS2413: Numeric index type '{}' is not assignable to string index type '{ a: any; }'. interface F extends A, D { [s: number]: { diff --git a/tests/baselines/reference/initializerReferencingConstructorLocals.errors.txt b/tests/baselines/reference/initializerReferencingConstructorLocals.errors.txt index 56a9455608b..896552cabd5 100644 --- a/tests/baselines/reference/initializerReferencingConstructorLocals.errors.txt +++ b/tests/baselines/reference/initializerReferencingConstructorLocals.errors.txt @@ -1,46 +1,60 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(7,15): error TS1003: Identifier expected. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(17,15): error TS1003: Identifier expected. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(4,9): error TS2304: Cannot find name 'z'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(5,15): error TS2304: Cannot find name 'z'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(6,14): error TS2339: Property 'z' does not exist on type 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(7,20): error TS2339: Property 'z' does not exist on type 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(9,9): error TS2304: Cannot find name 'z'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(14,9): error TS2304: Cannot find name 'z'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(15,15): error TS2304: Cannot find name 'z'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(16,14): error TS2339: Property 'z' does not exist on type 'D'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(17,20): error TS2339: Property 'z' does not exist on type 'D'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(19,9): error TS2304: Cannot find name 'z'. + + ==== tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts (12 errors) ==== // Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. class C { a = z; // error ~ -!!! Cannot find name 'z'. +!!! error TS2304: Cannot find name 'z'. b: typeof z; // error ~ -!!! Cannot find name 'z'. +!!! error TS2304: Cannot find name 'z'. c = this.z; // error ~ -!!! Property 'z' does not exist on type 'C'. +!!! error TS2339: Property 'z' does not exist on type 'C'. d: typeof this.z; // error ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ~ -!!! Property 'z' does not exist on type 'C'. +!!! error TS2339: Property 'z' does not exist on type 'C'. constructor(x) { z = 1; ~ -!!! Cannot find name 'z'. +!!! error TS2304: Cannot find name 'z'. } } class D { a = z; // error ~ -!!! Cannot find name 'z'. +!!! error TS2304: Cannot find name 'z'. b: typeof z; // error ~ -!!! Cannot find name 'z'. +!!! error TS2304: Cannot find name 'z'. c = this.z; // error ~ -!!! Property 'z' does not exist on type 'D'. +!!! error TS2339: Property 'z' does not exist on type 'D'. d: typeof this.z; // error ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. ~ -!!! Property 'z' does not exist on type 'D'. +!!! error TS2339: Property 'z' does not exist on type 'D'. constructor(x: T) { z = 1; ~ -!!! Cannot find name 'z'. +!!! error TS2304: Cannot find name 'z'. } } \ No newline at end of file diff --git a/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt b/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt index 6d137e173ce..465e3c42167 100644 --- a/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt +++ b/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt @@ -1,23 +1,31 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(17,15): error TS1003: Identifier expected. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(4,9): error TS2304: Cannot find name 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(5,15): error TS2304: Cannot find name 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(10,9): error TS2304: Cannot find name 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(11,15): error TS2304: Cannot find name 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(23,9): error TS2304: Cannot find name 'x'. + + ==== tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts (6 errors) ==== // Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. class C { a = x; // error ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. b: typeof x; // error ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. constructor(x) { } } class D { a = x; // error ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. b: typeof x; // error ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. constructor(public x) { } } @@ -25,7 +33,7 @@ a = this.x; // ok b: typeof this.x; // error ~~~~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. constructor(public x) { } } @@ -33,6 +41,6 @@ a = this.x; // ok b = x; // error ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. constructor(public x: T) { } } \ No newline at end of file diff --git a/tests/baselines/reference/initializersInDeclarations.errors.txt b/tests/baselines/reference/initializersInDeclarations.errors.txt index ff2555447ce..94736957365 100644 --- a/tests/baselines/reference/initializersInDeclarations.errors.txt +++ b/tests/baselines/reference/initializersInDeclarations.errors.txt @@ -1,3 +1,12 @@ +tests/cases/conformance/externalModules/initializersInDeclarations.ts(5,7): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(6,14): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(7,16): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(12,15): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(13,15): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(16,2): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(18,16): error TS1039: Initializers are not allowed in ambient contexts. + + ==== tests/cases/conformance/externalModules/initializersInDeclarations.ts (7 errors) ==== // Errors: Initializers & statements in declaration file @@ -5,30 +14,30 @@ declare class Foo { name = "test"; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. "some prop" = 42; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. fn(): boolean { ~ -!!! A function implementation cannot be declared in an ambient context. +!!! error TS1037: A function implementation cannot be declared in an ambient context. return false; } } declare var x = []; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. declare var y = {}; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. declare module M1 { while(true); ~~~~~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. export var v1 = () => false; ~ -!!! Initializers are not allowed in ambient contexts. +!!! error TS1039: Initializers are not allowed in ambient contexts. } \ No newline at end of file diff --git a/tests/baselines/reference/innerAliases.errors.txt b/tests/baselines/reference/innerAliases.errors.txt index f8010153c58..b5135c19d12 100644 --- a/tests/baselines/reference/innerAliases.errors.txt +++ b/tests/baselines/reference/innerAliases.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/innerAliases.ts(19,8): error TS2305: Module 'D' has no exported member 'inner'. +tests/cases/compiler/innerAliases.ts(21,11): error TS2339: Property 'inner' does not exist on type 'typeof D'. + + ==== tests/cases/compiler/innerAliases.ts (2 errors) ==== module A { export module B { @@ -19,10 +23,10 @@ var c: D.inner.Class1; ~~~~~~~~~~~~~~ -!!! Module 'D' has no exported member 'inner'. +!!! error TS2305: Module 'D' has no exported member 'inner'. c = new D.inner.Class1(); ~~~~~ -!!! Property 'inner' does not exist on type 'typeof D'. +!!! error TS2339: Property 'inner' does not exist on type 'typeof D'. \ No newline at end of file diff --git a/tests/baselines/reference/innerModExport1.errors.txt b/tests/baselines/reference/innerModExport1.errors.txt index 1f960cd37f7..11e9cdc01d1 100644 --- a/tests/baselines/reference/innerModExport1.errors.txt +++ b/tests/baselines/reference/innerModExport1.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/innerModExport1.ts(5,12): error TS1005: ';' expected. +tests/cases/compiler/innerModExport1.ts(7,9): error TS1129: Statement expected. +tests/cases/compiler/innerModExport1.ts(14,5): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/innerModExport1.ts(17,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/innerModExport1.ts(5,5): error TS2304: Cannot find name 'module'. + + ==== tests/cases/compiler/innerModExport1.ts (5 errors) ==== module Outer { @@ -5,13 +12,13 @@ var non_export_var: number; module { ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~ -!!! Cannot find name 'module'. +!!! error TS2304: Cannot find name 'module'. var non_export_var = 0; export var export_var = 1; ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. function NonExportFunc() { return 0; } @@ -20,11 +27,11 @@ export var outer_var_export = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. export function outerFuncExport() { return 0; } } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. Outer.ExportFunc(); \ No newline at end of file diff --git a/tests/baselines/reference/innerModExport2.errors.txt b/tests/baselines/reference/innerModExport2.errors.txt index 59c6c4dde83..1adcc46d441 100644 --- a/tests/baselines/reference/innerModExport2.errors.txt +++ b/tests/baselines/reference/innerModExport2.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/innerModExport2.ts(5,12): error TS1005: ';' expected. +tests/cases/compiler/innerModExport2.ts(7,9): error TS1129: Statement expected. +tests/cases/compiler/innerModExport2.ts(15,5): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/innerModExport2.ts(18,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/innerModExport2.ts(5,5): error TS2304: Cannot find name 'module'. +tests/cases/compiler/innerModExport2.ts(20,7): error TS2339: Property 'NonExportFunc' does not exist on type 'typeof Outer'. + + ==== tests/cases/compiler/innerModExport2.ts (6 errors) ==== module Outer { @@ -5,13 +13,13 @@ var non_export_var: number; module { ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~ -!!! Cannot find name 'module'. +!!! error TS2304: Cannot find name 'module'. var non_export_var = 0; export var export_var = 1; ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. function NonExportFunc() { return 0; } @@ -21,13 +29,13 @@ export var outer_var_export = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. export function outerFuncExport() { return 0; } } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. Outer.NonExportFunc(); ~~~~~~~~~~~~~ -!!! Property 'NonExportFunc' does not exist on type 'typeof Outer'. \ No newline at end of file +!!! error TS2339: Property 'NonExportFunc' does not exist on type 'typeof Outer'. \ No newline at end of file diff --git a/tests/baselines/reference/innerTypeCheckOfLambdaArgument.errors.txt b/tests/baselines/reference/innerTypeCheckOfLambdaArgument.errors.txt index be79017314f..93f66768b35 100644 --- a/tests/baselines/reference/innerTypeCheckOfLambdaArgument.errors.txt +++ b/tests/baselines/reference/innerTypeCheckOfLambdaArgument.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/innerTypeCheckOfLambdaArgument.ts(10,7): error TS2323: Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/innerTypeCheckOfLambdaArgument.ts (1 errors) ==== function takesCallback(callback: (n) =>any) { @@ -10,7 +13,7 @@ // otherwise, there's a bug in overload resolution / partial typechecking var k: string = 10; ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. } ); \ No newline at end of file diff --git a/tests/baselines/reference/instanceMemberAssignsToClassPrototype.errors.txt b/tests/baselines/reference/instanceMemberAssignsToClassPrototype.errors.txt index 124c3ab81df..06d2d76a6e1 100644 --- a/tests/baselines/reference/instanceMemberAssignsToClassPrototype.errors.txt +++ b/tests/baselines/reference/instanceMemberAssignsToClassPrototype.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/instanceMemberAssignsToClassPrototype.ts(7,9): error TS2322: Type '() => void' is not assignable to type '(x: number) => number': + Type 'void' is not assignable to type 'number'. + + ==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/instanceMemberAssignsToClassPrototype.ts (1 errors) ==== class C { foo() { @@ -7,8 +11,8 @@ bar(x: number): number { C.prototype.bar = () => { } // error ~~~~~~~~~~~~~~~ -!!! Type '() => void' is not assignable to type '(x: number) => number': -!!! Type 'void' is not assignable to type 'number'. +!!! error TS2322: Type '() => void' is not assignable to type '(x: number) => number': +!!! error TS2322: Type 'void' is not assignable to type 'number'. C.prototype.bar = (x) => x; // ok C.prototype.bar = (x: number) => 1; // ok return 1; diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt index b6cabdb962f..fbd64e5018e 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt @@ -1,15 +1,23 @@ +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(26,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(29,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(41,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. + + ==== tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts (6 errors) ==== module NonGeneric { class C { x: string; get y() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 1; } set y(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. fn() { return this; } constructor(public a: number, private b: number) { } } @@ -23,7 +31,7 @@ r.y = 4; var r6 = d.y(); // error ~~~~~ -!!! Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. } @@ -32,12 +40,12 @@ x: T; get y() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return null; } set y(v: U) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. fn() { return this; } constructor(public a: T, private b: U) { } } @@ -51,5 +59,5 @@ r.y = ''; var r6 = d.y(); // error ~~~~~ -!!! Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. } \ No newline at end of file diff --git a/tests/baselines/reference/instancePropertyInClassType.errors.txt b/tests/baselines/reference/instancePropertyInClassType.errors.txt index 79177eb22e9..9a7dce0f0cd 100644 --- a/tests/baselines/reference/instancePropertyInClassType.errors.txt +++ b/tests/baselines/reference/instancePropertyInClassType.errors.txt @@ -1,15 +1,23 @@ +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(24,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(27,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(37,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. + + ==== tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts (6 errors) ==== module NonGeneric { class C { x: string; get y() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 1; } set y(v) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. fn() { return this; } constructor(public a: number, private b: number) { } } @@ -21,7 +29,7 @@ r.y = 4; var r6 = c.y(); // error ~~~~~ -!!! Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. } @@ -30,12 +38,12 @@ x: T; get y() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return null; } set y(v: U) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. fn() { return this; } constructor(public a: T, private b: U) { } } @@ -47,5 +55,5 @@ r.y = ''; var r6 = c.y(); // error ~~~~~ -!!! Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. } \ No newline at end of file diff --git a/tests/baselines/reference/instanceSubtypeCheck2.errors.txt b/tests/baselines/reference/instanceSubtypeCheck2.errors.txt index d123ec33f9f..dab3c0279bc 100644 --- a/tests/baselines/reference/instanceSubtypeCheck2.errors.txt +++ b/tests/baselines/reference/instanceSubtypeCheck2.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/instanceSubtypeCheck2.ts(5,7): error TS2416: Class 'C2' incorrectly extends base class 'C1': + Types of property 'x' are incompatible: + Type 'string' is not assignable to type 'C2': + Property 'x' is missing in type 'String'. + + ==== tests/cases/compiler/instanceSubtypeCheck2.ts (1 errors) ==== class C1 { x: C2; @@ -5,9 +11,9 @@ class C2 extends C1 { ~~ -!!! Class 'C2' incorrectly extends base class 'C1': -!!! Types of property 'x' are incompatible: -!!! Type 'string' is not assignable to type 'C2': -!!! Property 'x' is missing in type 'String'. +!!! error TS2416: Class 'C2' incorrectly extends base class 'C1': +!!! error TS2416: Types of property 'x' are incompatible: +!!! error TS2416: Type 'string' is not assignable to type 'C2': +!!! error TS2416: Property 'x' is missing in type 'String'. x: string } \ No newline at end of file diff --git a/tests/baselines/reference/instanceofOperator.errors.txt b/tests/baselines/reference/instanceofOperator.errors.txt index df7ed3991cb..15d55188741 100644 --- a/tests/baselines/reference/instanceofOperator.errors.txt +++ b/tests/baselines/reference/instanceofOperator.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/instanceofOperator.ts(6,7): error TS2300: Duplicate identifier 'Object'. +tests/cases/compiler/instanceofOperator.ts(11,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/compiler/instanceofOperator.ts(14,16): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/compiler/instanceofOperator.ts(15,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/compiler/instanceofOperator.ts(18,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/compiler/instanceofOperator.ts(20,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. + + ==== tests/cases/compiler/instanceofOperator.ts (6 errors) ==== // Spec: // The instanceof operator requires the left operand to be of type Any or an object type, and the right @@ -6,30 +14,30 @@ class Object { } ~~~~~~ -!!! Duplicate identifier 'Object'. +!!! error TS2300: Duplicate identifier 'Object'. var obj: Object; 4 instanceof null; ~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. // Error and should be error obj instanceof 4; ~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. Object instanceof obj; ~~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. // Error on left hand side null instanceof null; ~~~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. obj instanceof Object; undefined instanceof undefined; ~~~~~~~~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/instanceofOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/instanceofOperatorWithInvalidOperands.errors.txt index f5698b29c6b..49b5fbc0cd0 100644 --- a/tests/baselines/reference/instanceofOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/instanceofOperatorWithInvalidOperands.errors.txt @@ -1,3 +1,26 @@ +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(14,11): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(15,11): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(16,11): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(17,11): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(18,11): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(19,11): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(20,11): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(21,11): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(22,11): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(34,24): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(35,24): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(36,24): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(37,24): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(38,24): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(39,24): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(40,24): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(41,24): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(42,24): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(43,25): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(46,11): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts(46,25): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. + + ==== tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidOperands.ts (21 errors) ==== class C { foo() { } @@ -14,31 +37,31 @@ var ra1 = a1 instanceof x; ~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. var ra2 = a2 instanceof x; ~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. var ra3 = a3 instanceof x; ~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. var ra4 = a4 instanceof x; ~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. var ra5 = 0 instanceof x; ~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. var ra6 = true instanceof x; ~~~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. var ra7 = '' instanceof x; ~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. var ra8 = null instanceof x; ~~~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. var ra9 = undefined instanceof x; ~~~~~~~~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. // invalid right operand // the right operand to be of type Any or a subtype of the 'Function' interface type @@ -52,38 +75,38 @@ var rb1 = x instanceof b1; ~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. var rb2 = x instanceof b2; ~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. var rb3 = x instanceof b3; ~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. var rb4 = x instanceof b4; ~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. var rb5 = x instanceof 0; ~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. var rb6 = x instanceof true; ~~~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. var rb7 = x instanceof ''; ~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. var rb8 = x instanceof o1; ~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. var rb9 = x instanceof o2; ~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. var rb10 = x instanceof o3; ~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. // both operands are invalid var rc1 = '' instanceof {}; ~~ -!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. ~~ -!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. \ No newline at end of file +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. \ No newline at end of file diff --git a/tests/baselines/reference/instantiateConstraintsToTypeArguments2.errors.txt b/tests/baselines/reference/instantiateConstraintsToTypeArguments2.errors.txt index 1f74e2c9e56..f5d53c582f6 100644 --- a/tests/baselines/reference/instantiateConstraintsToTypeArguments2.errors.txt +++ b/tests/baselines/reference/instantiateConstraintsToTypeArguments2.errors.txt @@ -1,11 +1,17 @@ +tests/cases/compiler/instantiateConstraintsToTypeArguments2.ts(1,13): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/instantiateConstraintsToTypeArguments2.ts(1,32): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/instantiateConstraintsToTypeArguments2.ts(2,13): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/instantiateConstraintsToTypeArguments2.ts(2,32): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/instantiateConstraintsToTypeArguments2.ts (4 errors) ==== interface A, S extends A> { } ~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. interface B, S extends B> extends A, B> { } ~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. \ No newline at end of file +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. \ No newline at end of file diff --git a/tests/baselines/reference/instantiateGenericClassWithWrongNumberOfTypeArguments.errors.txt b/tests/baselines/reference/instantiateGenericClassWithWrongNumberOfTypeArguments.errors.txt index d058f42951b..5162cd28fd5 100644 --- a/tests/baselines/reference/instantiateGenericClassWithWrongNumberOfTypeArguments.errors.txt +++ b/tests/baselines/reference/instantiateGenericClassWithWrongNumberOfTypeArguments.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGenericClassWithWrongNumberOfTypeArguments.ts(8,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGenericClassWithWrongNumberOfTypeArguments.ts(16,9): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateGenericClassWithWrongNumberOfTypeArguments.ts (2 errors) ==== // it is always an error to provide a type argument list whose count does not match the type parameter list // both of these attempts to construct a type is an error @@ -8,7 +12,7 @@ var c = new C(); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. class D { x: T @@ -18,4 +22,4 @@ // BUG 794238 var d = new D(); ~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/instantiateNonGenericTypeWithTypeArguments.errors.txt b/tests/baselines/reference/instantiateNonGenericTypeWithTypeArguments.errors.txt index 8129005313e..8322fd3b2e4 100644 --- a/tests/baselines/reference/instantiateNonGenericTypeWithTypeArguments.errors.txt +++ b/tests/baselines/reference/instantiateNonGenericTypeWithTypeArguments.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(8,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(11,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(11,9): error TS2350: Only a void function can be called with the 'new' keyword. +tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(14,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(14,10): error TS2350: Only a void function can be called with the 'new' keyword. +tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts(18,10): error TS2347: Untyped function calls may not accept type arguments. + + ==== tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiateNonGenericTypeWithTypeArguments.ts (6 errors) ==== // it is an error to provide type arguments to a non-generic call // all of these are errors @@ -8,24 +16,24 @@ var c = new C(); ~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. function Foo(): void { } var r = new Foo(); ~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. ~~~~~~~~~~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. +!!! error TS2350: Only a void function can be called with the 'new' keyword. var f: { (): void }; var r2 = new f(); ~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. ~~~~~~~~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. +!!! error TS2350: Only a void function can be called with the 'new' keyword. var a: any; // BUG 790977 var r2 = new a(); ~~~~~~~~~~~~~~~ -!!! Untyped function calls may not accept type arguments. \ No newline at end of file +!!! error TS2347: Untyped function calls may not accept type arguments. \ No newline at end of file diff --git a/tests/baselines/reference/instantiateTypeParameter.errors.txt b/tests/baselines/reference/instantiateTypeParameter.errors.txt index 6d5a507f475..40967ba586f 100644 --- a/tests/baselines/reference/instantiateTypeParameter.errors.txt +++ b/tests/baselines/reference/instantiateTypeParameter.errors.txt @@ -1,12 +1,18 @@ +tests/cases/compiler/instantiateTypeParameter.ts(2,5): error TS1131: Property or signature expected. +tests/cases/compiler/instantiateTypeParameter.ts(2,13): error TS1099: Type argument list cannot be empty. +tests/cases/compiler/instantiateTypeParameter.ts(3,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/instantiateTypeParameter.ts(2,12): error TS2304: Cannot find name 'T'. + + ==== tests/cases/compiler/instantiateTypeParameter.ts (4 errors) ==== interface Foo { var x: T<>; ~~~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. ~~ -!!! Type argument list cannot be empty. +!!! error TS1099: Type argument list cannot be empty. ~~~ -!!! Cannot find name 'T'. +!!! error TS2304: Cannot find name 'T'. } ~ -!!! Declaration or statement expected. \ No newline at end of file +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/instantiatedBaseTypeConstraints.errors.txt b/tests/baselines/reference/instantiatedBaseTypeConstraints.errors.txt index 489103dc682..db62abe5688 100644 --- a/tests/baselines/reference/instantiatedBaseTypeConstraints.errors.txt +++ b/tests/baselines/reference/instantiatedBaseTypeConstraints.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/instantiatedBaseTypeConstraints.ts(1,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/instantiatedBaseTypeConstraints.ts (1 errors) ==== interface Foo, C> { ~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo(bar: C): void; } diff --git a/tests/baselines/reference/instantiatedBaseTypeConstraints2.errors.txt b/tests/baselines/reference/instantiatedBaseTypeConstraints2.errors.txt index f80877a9142..d5c6d838a84 100644 --- a/tests/baselines/reference/instantiatedBaseTypeConstraints2.errors.txt +++ b/tests/baselines/reference/instantiatedBaseTypeConstraints2.errors.txt @@ -1,7 +1,11 @@ +tests/cases/compiler/instantiatedBaseTypeConstraints2.ts(1,13): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/instantiatedBaseTypeConstraints2.ts(1,32): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/instantiatedBaseTypeConstraints2.ts (2 errors) ==== interface A, S extends A> { } ~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. interface B extends A, B> { } \ No newline at end of file diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index 29462bbf527..6fdf7ea2aa8 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -1,3 +1,96 @@ +tests/cases/compiler/intTypeCheck.ts(35,6): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/intTypeCheck.ts(36,5): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/intTypeCheck.ts(37,6): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/intTypeCheck.ts(70,6): error TS1022: An index signature parameter must have a type annotation. +tests/cases/compiler/intTypeCheck.ts(71,5): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/intTypeCheck.ts(72,6): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/intTypeCheck.ts(104,20): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(118,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(132,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(146,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(160,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(174,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(188,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(202,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(83,5): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/intTypeCheck.ts(97,5): error TS2322: Type 'Object' is not assignable to type 'i1': + Property 'p' is missing in type 'Object'. +tests/cases/compiler/intTypeCheck.ts(98,16): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(99,5): error TS2322: Type 'Base' is not assignable to type 'i1': + Property 'p' is missing in type 'Base'. +tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type '() => void' is not assignable to type 'i1': + Property 'p' is missing in type '() => void'. +tests/cases/compiler/intTypeCheck.ts(104,5): error TS2322: Type 'boolean' is not assignable to type 'i1': + Property 'p' is missing in type 'Boolean'. +tests/cases/compiler/intTypeCheck.ts(104,21): error TS2304: Cannot find name 'i1'. +tests/cases/compiler/intTypeCheck.ts(105,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(110,5): error TS2323: Type '{}' is not assignable to type 'i2'. +tests/cases/compiler/intTypeCheck.ts(111,5): error TS2323: Type 'Object' is not assignable to type 'i2'. +tests/cases/compiler/intTypeCheck.ts(112,17): error TS2350: Only a void function can be called with the 'new' keyword. +tests/cases/compiler/intTypeCheck.ts(113,5): error TS2323: Type 'Base' is not assignable to type 'i2'. +tests/cases/compiler/intTypeCheck.ts(118,5): error TS2323: Type 'boolean' is not assignable to type 'i2'. +tests/cases/compiler/intTypeCheck.ts(118,22): error TS2304: Cannot find name 'i2'. +tests/cases/compiler/intTypeCheck.ts(119,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(124,5): error TS2323: Type '{}' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(125,5): error TS2323: Type 'Object' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(127,5): error TS2323: Type 'Base' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(129,5): error TS2323: Type '() => void' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(132,5): error TS2323: Type 'boolean' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(132,22): error TS2304: Cannot find name 'i3'. +tests/cases/compiler/intTypeCheck.ts(133,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(139,5): error TS2322: Type 'Object' is not assignable to type 'i4': + Index signature is missing in type 'Object'. +tests/cases/compiler/intTypeCheck.ts(140,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(141,5): error TS2322: Type 'Base' is not assignable to type 'i4': + Index signature is missing in type 'Base'. +tests/cases/compiler/intTypeCheck.ts(143,5): error TS2322: Type '() => void' is not assignable to type 'i4': + Index signature is missing in type '() => void'. +tests/cases/compiler/intTypeCheck.ts(146,5): error TS2322: Type 'boolean' is not assignable to type 'i4': + Index signature is missing in type 'Boolean'. +tests/cases/compiler/intTypeCheck.ts(146,22): error TS2304: Cannot find name 'i4'. +tests/cases/compiler/intTypeCheck.ts(147,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(152,5): error TS2322: Type '{}' is not assignable to type 'i5': + Property 'p' is missing in type '{}'. +tests/cases/compiler/intTypeCheck.ts(153,5): error TS2322: Type 'Object' is not assignable to type 'i5': + Property 'p' is missing in type 'Object'. +tests/cases/compiler/intTypeCheck.ts(154,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(155,5): error TS2322: Type 'Base' is not assignable to type 'i5': + Property 'p' is missing in type 'Base'. +tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type '() => void' is not assignable to type 'i5': + Property 'p' is missing in type '() => void'. +tests/cases/compiler/intTypeCheck.ts(160,5): error TS2322: Type 'boolean' is not assignable to type 'i5': + Property 'p' is missing in type 'Boolean'. +tests/cases/compiler/intTypeCheck.ts(160,22): error TS2304: Cannot find name 'i5'. +tests/cases/compiler/intTypeCheck.ts(161,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(166,5): error TS2323: Type '{}' is not assignable to type 'i6'. +tests/cases/compiler/intTypeCheck.ts(167,5): error TS2323: Type 'Object' is not assignable to type 'i6'. +tests/cases/compiler/intTypeCheck.ts(168,17): error TS2350: Only a void function can be called with the 'new' keyword. +tests/cases/compiler/intTypeCheck.ts(169,5): error TS2323: Type 'Base' is not assignable to type 'i6'. +tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type '() => void' is not assignable to type 'i6': + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/intTypeCheck.ts(174,5): error TS2323: Type 'boolean' is not assignable to type 'i6'. +tests/cases/compiler/intTypeCheck.ts(174,22): error TS2304: Cannot find name 'i6'. +tests/cases/compiler/intTypeCheck.ts(175,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(180,5): error TS2323: Type '{}' is not assignable to type 'i7'. +tests/cases/compiler/intTypeCheck.ts(181,5): error TS2323: Type 'Object' is not assignable to type 'i7'. +tests/cases/compiler/intTypeCheck.ts(183,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. +tests/cases/compiler/intTypeCheck.ts(185,5): error TS2323: Type '() => void' is not assignable to type 'i7'. +tests/cases/compiler/intTypeCheck.ts(188,5): error TS2323: Type 'boolean' is not assignable to type 'i7'. +tests/cases/compiler/intTypeCheck.ts(188,22): error TS2304: Cannot find name 'i7'. +tests/cases/compiler/intTypeCheck.ts(189,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(195,5): error TS2322: Type 'Object' is not assignable to type 'i8': + Index signature is missing in type 'Object'. +tests/cases/compiler/intTypeCheck.ts(196,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(197,5): error TS2322: Type 'Base' is not assignable to type 'i8': + Index signature is missing in type 'Base'. +tests/cases/compiler/intTypeCheck.ts(199,5): error TS2322: Type '() => void' is not assignable to type 'i8': + Index signature is missing in type '() => void'. +tests/cases/compiler/intTypeCheck.ts(202,5): error TS2322: Type 'boolean' is not assignable to type 'i8': + Index signature is missing in type 'Boolean'. +tests/cases/compiler/intTypeCheck.ts(202,22): error TS2304: Cannot find name 'i8'. +tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. + + ==== tests/cases/compiler/intTypeCheck.ts (73 errors) ==== interface i1 { //Property Signatures @@ -35,13 +128,13 @@ //Index Signatures [p]; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [p1: string]; ~~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [p2: string, p3: number]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. } interface i5 extends i1 { } interface i6 extends i2 { } @@ -76,13 +169,13 @@ //Index Signatures [p]; ~ -!!! An index signature parameter must have a type annotation. +!!! error TS1022: An index signature parameter must have a type annotation. [p1: string]; ~~~~~~~~~~~~ -!!! An index signature must have a type annotation. +!!! error TS1021: An index signature must have a type annotation. [p2: string, p3: number]; ~~ -!!! An index signature must have exactly one parameter. +!!! error TS1096: An index signature must have exactly one parameter. //Property Signatures p; @@ -95,7 +188,7 @@ p7(pa1, pa2): void; p7? (pa1, pa2): void; ~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. } var anyVar: any; @@ -111,93 +204,93 @@ }; var obj2: i1 = new Object(); ~~~~ -!!! Type 'Object' is not assignable to type 'i1': -!!! Property 'p' is missing in type 'Object'. +!!! error TS2322: Type 'Object' is not assignable to type 'i1': +!!! error TS2322: Property 'p' is missing in type 'Object'. var obj3: i1 = new obj0; ~~~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. var obj4: i1 = new Base; ~~~~ -!!! Type 'Base' is not assignable to type 'i1': -!!! Property 'p' is missing in type 'Base'. +!!! error TS2322: Type 'Base' is not assignable to type 'i1': +!!! error TS2322: Property 'p' is missing in type 'Base'. var obj5: i1 = null; var obj6: i1 = function () { }; ~~~~ -!!! Type '() => void' is not assignable to type 'i1': -!!! Property 'p' is missing in type '() => void'. +!!! error TS2322: Type '() => void' is not assignable to type 'i1': +!!! error TS2322: Property 'p' is missing in type '() => void'. //var obj7: i1 = function foo() { }; var obj8: i1 = anyVar; var obj9: i1 = new anyVar; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~ -!!! Type 'boolean' is not assignable to type 'i1': -!!! Property 'p' is missing in type 'Boolean'. +!!! error TS2322: Type 'boolean' is not assignable to type 'i1': +!!! error TS2322: Property 'p' is missing in type 'Boolean'. ~~ -!!! Cannot find name 'i1'. +!!! error TS2304: Cannot find name 'i1'. var obj10: i1 = new {}; ~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. // // Call signatures // var obj11: i2; var obj12: i2 = {}; ~~~~~ -!!! Type '{}' is not assignable to type 'i2'. +!!! error TS2323: Type '{}' is not assignable to type 'i2'. var obj13: i2 = new Object(); ~~~~~ -!!! Type 'Object' is not assignable to type 'i2'. +!!! error TS2323: Type 'Object' is not assignable to type 'i2'. var obj14: i2 = new obj11; ~~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. +!!! error TS2350: Only a void function can be called with the 'new' keyword. var obj15: i2 = new Base; ~~~~~ -!!! Type 'Base' is not assignable to type 'i2'. +!!! error TS2323: Type 'Base' is not assignable to type 'i2'. var obj16: i2 = null; var obj17: i2 = function ():any { return 0; }; //var obj18: i2 = function foo() { }; var obj19: i2 = anyVar; var obj20: i2 = new anyVar; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~ -!!! Type 'boolean' is not assignable to type 'i2'. +!!! error TS2323: Type 'boolean' is not assignable to type 'i2'. ~~ -!!! Cannot find name 'i2'. +!!! error TS2304: Cannot find name 'i2'. var obj21: i2 = new {}; ~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. // // Construct Signatures // var obj22: i3; var obj23: i3 = {}; ~~~~~ -!!! Type '{}' is not assignable to type 'i3'. +!!! error TS2323: Type '{}' is not assignable to type 'i3'. var obj24: i3 = new Object(); ~~~~~ -!!! Type 'Object' is not assignable to type 'i3'. +!!! error TS2323: Type 'Object' is not assignable to type 'i3'. var obj25: i3 = new obj22; var obj26: i3 = new Base; ~~~~~ -!!! Type 'Base' is not assignable to type 'i3'. +!!! error TS2323: Type 'Base' is not assignable to type 'i3'. var obj27: i3 = null; var obj28: i3 = function () { }; ~~~~~ -!!! Type '() => void' is not assignable to type 'i3'. +!!! error TS2323: Type '() => void' is not assignable to type 'i3'. //var obj29: i3 = function foo() { }; var obj30: i3 = anyVar; var obj31: i3 = new anyVar; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~ -!!! Type 'boolean' is not assignable to type 'i3'. +!!! error TS2323: Type 'boolean' is not assignable to type 'i3'. ~~ -!!! Cannot find name 'i3'. +!!! error TS2304: Cannot find name 'i3'. var obj32: i3 = new {}; ~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. // // Index Signatures // @@ -205,133 +298,133 @@ var obj34: i4 = {}; var obj35: i4 = new Object(); ~~~~~ -!!! Type 'Object' is not assignable to type 'i4': -!!! Index signature is missing in type 'Object'. +!!! error TS2322: Type 'Object' is not assignable to type 'i4': +!!! error TS2322: Index signature is missing in type 'Object'. var obj36: i4 = new obj33; ~~~~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. var obj37: i4 = new Base; ~~~~~ -!!! Type 'Base' is not assignable to type 'i4': -!!! Index signature is missing in type 'Base'. +!!! error TS2322: Type 'Base' is not assignable to type 'i4': +!!! error TS2322: Index signature is missing in type 'Base'. var obj38: i4 = null; var obj39: i4 = function () { }; ~~~~~ -!!! Type '() => void' is not assignable to type 'i4': -!!! Index signature is missing in type '() => void'. +!!! error TS2322: Type '() => void' is not assignable to type 'i4': +!!! error TS2322: Index signature is missing in type '() => void'. //var obj40: i4 = function foo() { }; var obj41: i4 = anyVar; var obj42: i4 = new anyVar; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~ -!!! Type 'boolean' is not assignable to type 'i4': -!!! Index signature is missing in type 'Boolean'. +!!! error TS2322: Type 'boolean' is not assignable to type 'i4': +!!! error TS2322: Index signature is missing in type 'Boolean'. ~~ -!!! Cannot find name 'i4'. +!!! error TS2304: Cannot find name 'i4'. var obj43: i4 = new {}; ~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. // // Interface Derived I1 // var obj44: i5; var obj45: i5 = {}; ~~~~~ -!!! Type '{}' is not assignable to type 'i5': -!!! Property 'p' is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type 'i5': +!!! error TS2322: Property 'p' is missing in type '{}'. var obj46: i5 = new Object(); ~~~~~ -!!! Type 'Object' is not assignable to type 'i5': -!!! Property 'p' is missing in type 'Object'. +!!! error TS2322: Type 'Object' is not assignable to type 'i5': +!!! error TS2322: Property 'p' is missing in type 'Object'. var obj47: i5 = new obj44; ~~~~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. var obj48: i5 = new Base; ~~~~~ -!!! Type 'Base' is not assignable to type 'i5': -!!! Property 'p' is missing in type 'Base'. +!!! error TS2322: Type 'Base' is not assignable to type 'i5': +!!! error TS2322: Property 'p' is missing in type 'Base'. var obj49: i5 = null; var obj50: i5 = function () { }; ~~~~~ -!!! Type '() => void' is not assignable to type 'i5': -!!! Property 'p' is missing in type '() => void'. +!!! error TS2322: Type '() => void' is not assignable to type 'i5': +!!! error TS2322: Property 'p' is missing in type '() => void'. //var obj51: i5 = function foo() { }; var obj52: i5 = anyVar; var obj53: i5 = new anyVar; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~ -!!! Type 'boolean' is not assignable to type 'i5': -!!! Property 'p' is missing in type 'Boolean'. +!!! error TS2322: Type 'boolean' is not assignable to type 'i5': +!!! error TS2322: Property 'p' is missing in type 'Boolean'. ~~ -!!! Cannot find name 'i5'. +!!! error TS2304: Cannot find name 'i5'. var obj54: i5 = new {}; ~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. // // Interface Derived I2 // var obj55: i6; var obj56: i6 = {}; ~~~~~ -!!! Type '{}' is not assignable to type 'i6'. +!!! error TS2323: Type '{}' is not assignable to type 'i6'. var obj57: i6 = new Object(); ~~~~~ -!!! Type 'Object' is not assignable to type 'i6'. +!!! error TS2323: Type 'Object' is not assignable to type 'i6'. var obj58: i6 = new obj55; ~~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. +!!! error TS2350: Only a void function can be called with the 'new' keyword. var obj59: i6 = new Base; ~~~~~ -!!! Type 'Base' is not assignable to type 'i6'. +!!! error TS2323: Type 'Base' is not assignable to type 'i6'. var obj60: i6 = null; var obj61: i6 = function () { }; ~~~~~ -!!! Type '() => void' is not assignable to type 'i6': -!!! Type 'void' is not assignable to type 'number'. +!!! error TS2322: Type '() => void' is not assignable to type 'i6': +!!! error TS2322: Type 'void' is not assignable to type 'number'. //var obj62: i6 = function foo() { }; var obj63: i6 = anyVar; var obj64: i6 = new anyVar; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~ -!!! Type 'boolean' is not assignable to type 'i6'. +!!! error TS2323: Type 'boolean' is not assignable to type 'i6'. ~~ -!!! Cannot find name 'i6'. +!!! error TS2304: Cannot find name 'i6'. var obj65: i6 = new {}; ~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. // // Interface Derived I3 // var obj66: i7; var obj67: i7 = {}; ~~~~~ -!!! Type '{}' is not assignable to type 'i7'. +!!! error TS2323: Type '{}' is not assignable to type 'i7'. var obj68: i7 = new Object(); ~~~~~ -!!! Type 'Object' is not assignable to type 'i7'. +!!! error TS2323: Type 'Object' is not assignable to type 'i7'. var obj69: i7 = new obj66; var obj70: i7 = new Base; ~~~~~~~~~~~~ -!!! Neither type 'Base' nor type 'i7' is assignable to the other. +!!! error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. var obj71: i7 = null; var obj72: i7 = function () { }; ~~~~~ -!!! Type '() => void' is not assignable to type 'i7'. +!!! error TS2323: Type '() => void' is not assignable to type 'i7'. //var obj73: i7 = function foo() { }; var obj74: i7 = anyVar; var obj75: i7 = new anyVar; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~ -!!! Type 'boolean' is not assignable to type 'i7'. +!!! error TS2323: Type 'boolean' is not assignable to type 'i7'. ~~ -!!! Cannot find name 'i7'. +!!! error TS2304: Cannot find name 'i7'. var obj76: i7 = new {}; ~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. // // Interface Derived I4 // @@ -339,30 +432,30 @@ var obj78: i8 = {}; var obj79: i8 = new Object(); ~~~~~ -!!! Type 'Object' is not assignable to type 'i8': -!!! Index signature is missing in type 'Object'. +!!! error TS2322: Type 'Object' is not assignable to type 'i8': +!!! error TS2322: Index signature is missing in type 'Object'. var obj80: i8 = new obj77; ~~~~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. var obj81: i8 = new Base; ~~~~~ -!!! Type 'Base' is not assignable to type 'i8': -!!! Index signature is missing in type 'Base'. +!!! error TS2322: Type 'Base' is not assignable to type 'i8': +!!! error TS2322: Index signature is missing in type 'Base'. var obj82: i8 = null; var obj83: i8 = function () { }; ~~~~~ -!!! Type '() => void' is not assignable to type 'i8': -!!! Index signature is missing in type '() => void'. +!!! error TS2322: Type '() => void' is not assignable to type 'i8': +!!! error TS2322: Index signature is missing in type '() => void'. //var obj84: i8 = function foo() { }; var obj85: i8 = anyVar; var obj86: i8 = new anyVar; ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~ -!!! Type 'boolean' is not assignable to type 'i8': -!!! Index signature is missing in type 'Boolean'. +!!! error TS2322: Type 'boolean' is not assignable to type 'i8': +!!! error TS2322: Index signature is missing in type 'Boolean'. ~~ -!!! Cannot find name 'i8'. +!!! error TS2304: Cannot find name 'i8'. var obj87: i8 = new {}; ~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt index 663cb9a56ca..bd5a7a46f91 100644 --- a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt +++ b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/interfaceAssignmentCompat.ts(32,18): error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'. +tests/cases/compiler/interfaceAssignmentCompat.ts(37,29): error TS2339: Property '_map' does not exist on type 'typeof Color'. +tests/cases/compiler/interfaceAssignmentCompat.ts(42,13): error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye': + Property 'coleur' is missing in type 'IEye'. +tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEye[]' is not assignable to type 'IFrenchEye[]': + Type 'IEye' is not assignable to type 'IFrenchEye'. + + ==== tests/cases/compiler/interfaceAssignmentCompat.ts (4 errors) ==== module M { export enum Color { @@ -32,27 +40,27 @@ x=x.sort(CompareYeux); // parameter mismatch ~~~~~~~~~~~ -!!! Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'. +!!! error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'. // type of z inferred from specialized array type var z=x.sort(CompareEyes); // ok for (var i=0,len=z.length;i=0;j--) { eeks[j]=z[j]; // nope: element assignment ~~~~~~~ -!!! Type 'IEye' is not assignable to type 'IFrenchEye': -!!! Property 'coleur' is missing in type 'IEye'. +!!! error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye': +!!! error TS2322: Property 'coleur' is missing in type 'IEye'. } eeks=z; // nope: array assignment ~~~~ -!!! Type 'IEye[]' is not assignable to type 'IFrenchEye[]': -!!! Type 'IEye' is not assignable to type 'IFrenchEye'. +!!! error TS2322: Type 'IEye[]' is not assignable to type 'IFrenchEye[]': +!!! error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'. return result; } } diff --git a/tests/baselines/reference/interfaceContextualType.types b/tests/baselines/reference/interfaceContextualType.types index 88ba9dcbc24..3078ecfdfa4 100644 --- a/tests/baselines/reference/interfaceContextualType.types +++ b/tests/baselines/reference/interfaceContextualType.types @@ -27,11 +27,11 @@ class Bug { >ok : () => void this.values = {}; ->this.values = {} : { [x: string]: IOptions; } +>this.values = {} : { [x: string]: undefined; } >this.values : IMap >this : Bug >values : IMap ->{} : { [x: string]: IOptions; } +>{} : { [x: string]: undefined; } this.values['comments'] = { italic: true }; >this.values['comments'] = { italic: true } : { italic: boolean; } @@ -46,11 +46,11 @@ class Bug { >shouldBeOK : () => void this.values = { ->this.values = { comments: { italic: true } } : { [x: string]: IOptions; comments: { italic: boolean; }; } +>this.values = { comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; } >this.values : IMap >this : Bug >values : IMap ->{ comments: { italic: true } } : { [x: string]: IOptions; comments: { italic: boolean; }; } +>{ comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; } comments: { italic: true } >comments : { italic: boolean; } diff --git a/tests/baselines/reference/interfaceDeclaration1.errors.txt b/tests/baselines/reference/interfaceDeclaration1.errors.txt index 512f49776e2..3d7fcb86784 100644 --- a/tests/baselines/reference/interfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt @@ -1,16 +1,32 @@ -==== tests/cases/compiler/interfaceDeclaration1.ts (6 errors) ==== +tests/cases/compiler/interfaceDeclaration1.ts(2,5): error TS2300: Duplicate identifier 'item'. +tests/cases/compiler/interfaceDeclaration1.ts(3,5): error TS2300: Duplicate identifier 'item'. +tests/cases/compiler/interfaceDeclaration1.ts(7,5): error TS2300: Duplicate identifier 'item'. +tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2300: Duplicate identifier 'item'. +tests/cases/compiler/interfaceDeclaration1.ts(22,11): error TS2310: Type 'I5' recursively references itself as a base type. +tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2421: Class 'C1' incorrectly implements interface 'I3': + Property 'prototype' is missing in type 'C1'. +tests/cases/compiler/interfaceDeclaration1.ts(41,11): error TS2310: Type 'i8' recursively references itself as a base type. +tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11': + Named properties 'foo' of types 'i10' and 'i11' are not identical. + + +==== tests/cases/compiler/interfaceDeclaration1.ts (8 errors) ==== interface I1 { item:number; + ~~~~ +!!! error TS2300: Duplicate identifier 'item'. item:number; ~~~~ -!!! Duplicate identifier 'item'. +!!! error TS2300: Duplicate identifier 'item'. } interface I2 { item:any; + ~~~~ +!!! error TS2300: Duplicate identifier 'item'. item:number; ~~~~ -!!! Duplicate identifier 'item'. +!!! error TS2300: Duplicate identifier 'item'. } interface I3 { @@ -26,7 +42,7 @@ interface I5 extends I5 { ~~ -!!! Type 'I5' recursively references itself as a base type. +!!! error TS2310: Type 'I5' recursively references itself as a base type. foo():void; } @@ -41,8 +57,8 @@ class C1 implements I3 { ~~ -!!! Class 'C1' incorrectly implements interface 'I3': -!!! Property 'prototype' is missing in type 'C1'. +!!! error TS2421: Class 'C1' incorrectly implements interface 'I3': +!!! error TS2421: Property 'prototype' is missing in type 'C1'. constructor() { var prototype: number = 3; } @@ -50,7 +66,7 @@ interface i8 extends i9 { } ~~ -!!! Type 'i8' recursively references itself as a base type. +!!! error TS2310: Type 'i8' recursively references itself as a base type. interface i9 extends i8 { } interface i10 { @@ -63,6 +79,6 @@ interface i12 extends i10, i11 { } ~~~ -!!! Interface 'i12' cannot simultaneously extend types 'i10' and 'i11': -!!! Named properties 'foo' of types 'i10' and 'i11' are not identical. +!!! error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11': +!!! error TS2320: Named properties 'foo' of types 'i10' and 'i11' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceDeclaration2.errors.txt b/tests/baselines/reference/interfaceDeclaration2.errors.txt index a7ee7796372..9739d946bc5 100644 --- a/tests/baselines/reference/interfaceDeclaration2.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration2.errors.txt @@ -1,11 +1,17 @@ -==== tests/cases/compiler/interfaceDeclaration2.ts (1 errors) ==== +tests/cases/compiler/interfaceDeclaration2.ts(4,11): error TS2300: Duplicate identifier 'I2'. +tests/cases/compiler/interfaceDeclaration2.ts(5,7): error TS2300: Duplicate identifier 'I2'. + + +==== tests/cases/compiler/interfaceDeclaration2.ts (2 errors) ==== interface I1 { } module I1 { } interface I2 { } + ~~ +!!! error TS2300: Duplicate identifier 'I2'. class I2 { } ~~ -!!! Duplicate identifier 'I2'. +!!! error TS2300: Duplicate identifier 'I2'. interface I3 { } function I3() { } diff --git a/tests/baselines/reference/interfaceDeclaration3.errors.txt b/tests/baselines/reference/interfaceDeclaration3.errors.txt index f3a861a849b..d58a77b2e12 100644 --- a/tests/baselines/reference/interfaceDeclaration3.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration3.errors.txt @@ -1,3 +1,14 @@ +tests/cases/compiler/interfaceDeclaration3.ts(6,11): error TS2421: Class 'C1' incorrectly implements interface 'I1': + Types of property 'item' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/interfaceDeclaration3.ts(31,11): error TS2421: Class 'C1' incorrectly implements interface 'I1': + Types of property 'item' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/interfaceDeclaration3.ts(54,11): error TS2429: Interface 'I2' incorrectly extends interface 'I1': + Types of property 'item' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/interfaceDeclaration3.ts (3 errors) ==== interface I1 { item:number; } @@ -6,9 +17,9 @@ interface I2 { item:number; } class C1 implements I1 { ~~ -!!! Class 'C1' incorrectly implements interface 'I1': -!!! Types of property 'item' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2421: Class 'C1' incorrectly implements interface 'I1': +!!! error TS2421: Types of property 'item' are incompatible: +!!! error TS2421: Type 'number' is not assignable to type 'string'. public item:number; } class C2 implements I1 { @@ -35,9 +46,9 @@ } class C1 implements I1 { ~~ -!!! Class 'C1' incorrectly implements interface 'I1': -!!! Types of property 'item' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2421: Class 'C1' incorrectly implements interface 'I1': +!!! error TS2421: Types of property 'item' are incompatible: +!!! error TS2421: Type 'number' is not assignable to type 'string'. public item:number; } class C2 implements I1 { @@ -62,7 +73,7 @@ interface I2 extends I1 { item:string; } ~~ -!!! Interface 'I2' incorrectly extends interface 'I1': -!!! Types of property 'item' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2429: Interface 'I2' incorrectly extends interface 'I1': +!!! error TS2429: Types of property 'item' are incompatible: +!!! error TS2429: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceDeclaration4.errors.txt b/tests/baselines/reference/interfaceDeclaration4.errors.txt index 3f81ffba644..7092cda3dc2 100644 --- a/tests/baselines/reference/interfaceDeclaration4.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration4.errors.txt @@ -1,3 +1,15 @@ +tests/cases/compiler/interfaceDeclaration4.ts(39,14): error TS1005: '{' expected. +tests/cases/compiler/interfaceDeclaration4.ts(39,18): error TS1005: ';' expected. +tests/cases/compiler/interfaceDeclaration4.ts(18,11): error TS2429: Interface 'I3' incorrectly extends interface 'I1': + Types of property 'item' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/interfaceDeclaration4.ts(27,7): error TS2421: Class 'C2' incorrectly implements interface 'I4': + Property 'item' is missing in type 'C2'. +tests/cases/compiler/interfaceDeclaration4.ts(36,7): error TS2421: Class 'C3' incorrectly implements interface 'I1': + Property 'item' is missing in type 'C3'. +tests/cases/compiler/interfaceDeclaration4.ts(39,15): error TS2304: Cannot find name 'I1'. + + ==== tests/cases/compiler/interfaceDeclaration4.ts (6 errors) ==== // Import this module when test harness supports external modules. Also remove the internal module below. // import Foo = require("interfaceDeclaration5") @@ -18,9 +30,9 @@ // Negative Case interface I3 extends Foo.I1 { ~~ -!!! Interface 'I3' incorrectly extends interface 'I1': -!!! Types of property 'item' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2429: Interface 'I3' incorrectly extends interface 'I1': +!!! error TS2429: Types of property 'item' are incompatible: +!!! error TS2429: Type 'number' is not assignable to type 'string'. item:number; } @@ -31,8 +43,8 @@ // Err - not implemented item class C2 implements I4 { ~~ -!!! Class 'C2' incorrectly implements interface 'I4': -!!! Property 'item' is missing in type 'C2'. +!!! error TS2421: Class 'C2' incorrectly implements interface 'I4': +!!! error TS2421: Property 'item' is missing in type 'C2'. public token: string; } @@ -43,15 +55,15 @@ class C3 implements Foo.I1 { } ~~ -!!! Class 'C3' incorrectly implements interface 'I1': -!!! Property 'item' is missing in type 'C3'. +!!! error TS2421: Class 'C3' incorrectly implements interface 'I1': +!!! error TS2421: Property 'item' is missing in type 'C3'. // Negative case interface Foo.I1 { } ~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~ -!!! Cannot find name 'I1'. +!!! error TS2304: Cannot find name 'I1'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceDeclaration6.errors.txt b/tests/baselines/reference/interfaceDeclaration6.errors.txt index a517250e9b9..9cf0606d8bf 100644 --- a/tests/baselines/reference/interfaceDeclaration6.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration6.errors.txt @@ -1,11 +1,16 @@ +tests/cases/compiler/interfaceDeclaration6.ts(3,11): error TS2429: Interface 'i3' incorrectly extends interface 'i1': + Types of property 'foo' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/interfaceDeclaration6.ts (1 errors) ==== interface i1 { foo: number; }; interface i2 extends i1 { foo: number; }; interface i3 extends i1 { foo: string; }; ~~ -!!! Interface 'i3' incorrectly extends interface 'i1': -!!! Types of property 'foo' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2429: Interface 'i3' incorrectly extends interface 'i1': +!!! error TS2429: Types of property 'foo' are incompatible: +!!! error TS2429: Type 'string' is not assignable to type 'number'. interface i4 { bar():any; bar():any; diff --git a/tests/baselines/reference/interfaceExtendingClass.errors.txt b/tests/baselines/reference/interfaceExtendingClass.errors.txt index 7600d983fd7..66a75a1c998 100644 --- a/tests/baselines/reference/interfaceExtendingClass.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClass.errors.txt @@ -1,10 +1,13 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass.ts (1 errors) ==== class Foo { x: string; y() { } get Z() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 1; } [x: string]: Object; diff --git a/tests/baselines/reference/interfaceExtendingClass2.errors.txt b/tests/baselines/reference/interfaceExtendingClass2.errors.txt index 7bd8509ee2f..bff97f4c088 100644 --- a/tests/baselines/reference/interfaceExtendingClass2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClass2.errors.txt @@ -1,10 +1,18 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(13,13): error TS1108: A 'return' statement can only be used within a function body. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(13,13): error TS1131: Property or signature expected. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(14,9): error TS1128: Declaration or statement expected. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(15,5): error TS1128: Declaration or statement expected. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(11,5): error TS2411: Property 'a' of type '{ toString: () => {}; }' is not assignable to string index type 'Object'. + + ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts (6 errors) ==== class Foo { x: string; y() { } get Z() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 1; } [x: string]: Object; @@ -15,15 +23,15 @@ ~~~~ toString: () => { ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Property 'a' of type '{ toString: () => {}; }' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'a' of type '{ toString: () => {}; }' is not assignable to string index type 'Object'. return 1; ~~~~~~ -!!! A 'return' statement can only be used within a function body. +!!! error TS1108: A 'return' statement can only be used within a function body. ~~~~~~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. }; ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. } ~ -!!! Declaration or statement expected. \ No newline at end of file +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt index 525f9e2d517..93d8b7cfa57 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts(5,11): error TS2429: Interface 'I' incorrectly extends interface 'Foo': + Property 'x' is private in type 'Foo' but not in type 'I'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts(15,10): error TS2341: Property 'x' is private and only accessible within class 'Foo'. + + ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts (2 errors) ==== class Foo { private x: string; @@ -5,8 +10,8 @@ interface I extends Foo { // error ~ -!!! Interface 'I' incorrectly extends interface 'Foo': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2429: Interface 'I' incorrectly extends interface 'Foo': +!!! error TS2429: Property 'x' is private in type 'Foo' but not in type 'I'. x: string; } @@ -18,4 +23,4 @@ var r = i.y; var r2 = i.x; // error ~~~ -!!! Property 'Foo.x' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'x' is private and only accessible within class 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt index 9af19f5f67e..f17a1ef3485 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar': + Named properties 'x' of types 'Foo' and 'Bar' are not identical. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2429: Interface 'I4' incorrectly extends interface 'Bar': + Property 'x' is private in type 'Bar' but not in type 'I4'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2429: Interface 'I4' incorrectly extends interface 'Foo': + Property 'x' is private in type 'Foo' but not in type 'I4'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(26,10): error TS2341: Property 'x' is private and only accessible within class 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(27,10): error TS2341: Property 'y' is private and only accessible within class 'Baz'. + + ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts (5 errors) ==== class Foo { private x: string; @@ -9,17 +19,17 @@ interface I3 extends Foo, Bar { // error ~~ -!!! Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar': -!!! Named properties 'x' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar': +!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. } interface I4 extends Foo, Bar { // error ~~ -!!! Interface 'I4' incorrectly extends interface 'Bar': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2429: Interface 'I4' incorrectly extends interface 'Bar': +!!! error TS2429: Property 'x' is private in type 'Bar' but not in type 'I4'. ~~ -!!! Interface 'I4' incorrectly extends interface 'Foo': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2429: Interface 'I4' incorrectly extends interface 'Foo': +!!! error TS2429: Property 'x' is private in type 'Foo' but not in type 'I4'. x: string; } @@ -35,7 +45,7 @@ var r: string = i.z; var r2 = i.x; // error ~~~ -!!! Property 'Foo.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'Foo'. var r3 = i.y; // error ~~~ -!!! Property 'Baz.y' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'y' is private and only accessible within class 'Baz'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithProtecteds.errors.txt new file mode 100644 index 00000000000..1cbc921e1ac --- /dev/null +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts(5,11): error TS2429: Interface 'I' incorrectly extends interface 'Foo': + Property 'x' is protected but type 'I' is not a class derived from 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts(15,10): error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. + + +==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts (2 errors) ==== + class Foo { + protected x: string; + } + + interface I extends Foo { // error + ~ +!!! error TS2429: Interface 'I' incorrectly extends interface 'Foo': +!!! error TS2429: Property 'x' is protected but type 'I' is not a class derived from 'Foo'. + x: string; + } + + interface I2 extends Foo { + y: string; + } + + var i: I2; + var r = i.y; + var r2 = i.x; // error + ~~~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/interfaceExtendingClassWithProtecteds.js new file mode 100644 index 00000000000..f2d95812fd2 --- /dev/null +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds.js @@ -0,0 +1,26 @@ +//// [interfaceExtendingClassWithProtecteds.ts] +class Foo { + protected x: string; +} + +interface I extends Foo { // error + x: string; +} + +interface I2 extends Foo { + y: string; +} + +var i: I2; +var r = i.y; +var r2 = i.x; // error + +//// [interfaceExtendingClassWithProtecteds.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var i; +var r = i.y; +var r2 = i.x; // error diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt new file mode 100644 index 00000000000..4e5b6364010 --- /dev/null +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt @@ -0,0 +1,51 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar': + Named properties 'x' of types 'Foo' and 'Bar' are not identical. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2429: Interface 'I4' incorrectly extends interface 'Bar': + Property 'x' is protected but type 'I4' is not a class derived from 'Bar'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2429: Interface 'I4' incorrectly extends interface 'Foo': + Property 'x' is protected but type 'I4' is not a class derived from 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(26,10): error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(27,10): error TS2445: Property 'y' is protected and only accessible within class 'Baz' and its subclasses. + + +==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts (5 errors) ==== + class Foo { + protected x: string; + } + + class Bar { + protected x: string; + } + + interface I3 extends Foo, Bar { // error + ~~ +!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar': +!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. + } + + interface I4 extends Foo, Bar { // error + ~~ +!!! error TS2429: Interface 'I4' incorrectly extends interface 'Bar': +!!! error TS2429: Property 'x' is protected but type 'I4' is not a class derived from 'Bar'. + ~~ +!!! error TS2429: Interface 'I4' incorrectly extends interface 'Foo': +!!! error TS2429: Property 'x' is protected but type 'I4' is not a class derived from 'Foo'. + x: string; + } + + class Baz { + protected y: string; + } + + interface I5 extends Foo, Baz { + z: string; + } + + var i: I5; + var r: string = i.z; + var r2 = i.x; // error + ~~~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. + var r3 = i.y; // error + ~~~ +!!! error TS2445: Property 'y' is protected and only accessible within class 'Baz' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.js b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.js new file mode 100644 index 00000000000..277c32a10c1 --- /dev/null +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.js @@ -0,0 +1,49 @@ +//// [interfaceExtendingClassWithProtecteds2.ts] +class Foo { + protected x: string; +} + +class Bar { + protected x: string; +} + +interface I3 extends Foo, Bar { // error +} + +interface I4 extends Foo, Bar { // error + x: string; +} + +class Baz { + protected y: string; +} + +interface I5 extends Foo, Baz { + z: string; +} + +var i: I5; +var r: string = i.z; +var r2 = i.x; // error +var r3 = i.y; // error + +//// [interfaceExtendingClassWithProtecteds2.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +var Baz = (function () { + function Baz() { + } + return Baz; +})(); +var i; +var r = i.z; +var r2 = i.x; // error +var r3 = i.y; // error diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.errors.txt b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.errors.txt index e9864c85b6b..919bdaea17d 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.errors.txt +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/interfaceExtendsClassWithPrivate1.ts(21,1): error TS2322: Type 'C' is not assignable to type 'I': + Property 'other' is missing in type 'C'. +tests/cases/compiler/interfaceExtendsClassWithPrivate1.ts(24,1): error TS2322: Type 'I' is not assignable to type 'D': + Property 'bar' is missing in type 'I'. +tests/cases/compiler/interfaceExtendsClassWithPrivate1.ts(27,1): error TS2322: Type 'C' is not assignable to type 'D': + Property 'other' is missing in type 'C'. + + ==== tests/cases/compiler/interfaceExtendsClassWithPrivate1.ts (3 errors) ==== class C { public foo(x: any) { return x; } @@ -21,17 +29,17 @@ c = i; i = c; // error ~ -!!! Type 'C' is not assignable to type 'I': -!!! Property 'other' is missing in type 'C'. +!!! error TS2322: Type 'C' is not assignable to type 'I': +!!! error TS2322: Property 'other' is missing in type 'C'. i = d; d = i; // error ~ -!!! Type 'I' is not assignable to type 'D': -!!! Property 'bar' is missing in type 'I'. +!!! error TS2322: Type 'I' is not assignable to type 'D': +!!! error TS2322: Property 'bar' is missing in type 'I'. c = d; d = c; // error ~ -!!! Type 'C' is not assignable to type 'D': -!!! Property 'other' is missing in type 'C'. \ No newline at end of file +!!! error TS2322: Type 'C' is not assignable to type 'D': +!!! error TS2322: Property 'other' is missing in type 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.errors.txt b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.errors.txt index 54d0ebef980..a965d7003bb 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.errors.txt +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.errors.txt @@ -1,3 +1,13 @@ +tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts(10,7): error TS2416: Class 'D' incorrectly extends base class 'C': + Types have separate declarations of a private property 'x'. +tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts(10,7): error TS2421: Class 'D' incorrectly implements interface 'I': + Types have separate declarations of a private property 'x'. +tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts(18,7): error TS2416: Class 'D2' incorrectly extends base class 'C': + Types have separate declarations of a private property 'x'. +tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts(18,7): error TS2421: Class 'D2' incorrectly implements interface 'I': + Types have separate declarations of a private property 'x'. + + ==== tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts (4 errors) ==== class C { public foo(x: any) { return x; } @@ -10,11 +20,11 @@ class D extends C implements I { // error ~ -!!! Class 'D' incorrectly extends base class 'C': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2416: Class 'D' incorrectly extends base class 'C': +!!! error TS2416: Types have separate declarations of a private property 'x'. ~ -!!! Class 'D' incorrectly implements interface 'I': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'D' incorrectly implements interface 'I': +!!! error TS2421: Types have separate declarations of a private property 'x'. public foo(x: any) { return x; } private x = 2; private y = 3; @@ -24,11 +34,11 @@ class D2 extends C implements I { // error ~~ -!!! Class 'D2' incorrectly extends base class 'C': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2416: Class 'D2' incorrectly extends base class 'C': +!!! error TS2416: Types have separate declarations of a private property 'x'. ~~ -!!! Class 'D2' incorrectly implements interface 'I': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'D2' incorrectly implements interface 'I': +!!! error TS2421: Types have separate declarations of a private property 'x'. public foo(x: any) { return x; } private x = ""; other(x: any) { return x; } diff --git a/tests/baselines/reference/interfaceImplementation1.errors.txt b/tests/baselines/reference/interfaceImplementation1.errors.txt index f278e160227..59a81e66957 100644 --- a/tests/baselines/reference/interfaceImplementation1.errors.txt +++ b/tests/baselines/reference/interfaceImplementation1.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2421: Class 'C1' incorrectly implements interface 'I1': + Property 'iObj' is private in type 'C1' but not in type 'I1'. +tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2421: Class 'C1' incorrectly implements interface 'I2': + Property 'iFn' is private in type 'C1' but not in type 'I2'. +tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2323: Type '() => C2' is not assignable to type 'I4'. + + ==== tests/cases/compiler/interfaceImplementation1.ts (3 errors) ==== interface I1 { iObj:{ }; @@ -12,11 +19,11 @@ class C1 implements I1,I2 { ~~ -!!! Class 'C1' incorrectly implements interface 'I1': -!!! Private property 'iObj' cannot be reimplemented. +!!! error TS2421: Class 'C1' incorrectly implements interface 'I1': +!!! error TS2421: Property 'iObj' is private in type 'C1' but not in type 'I1'. ~~ -!!! Class 'C1' incorrectly implements interface 'I2': -!!! Private property 'iFn' cannot be reimplemented. +!!! error TS2421: Class 'C1' incorrectly implements interface 'I2': +!!! error TS2421: Property 'iFn' is private in type 'C1' but not in type 'I2'. private iFn(); private iFn(n?:number, s?:string) { } private iAny:any; @@ -40,7 +47,7 @@ var a:I4 = function(){ ~ -!!! Type '() => C2' is not assignable to type 'I4'. +!!! error TS2323: Type '() => C2' is not assignable to type 'I4'. return new C2(); } new a(); diff --git a/tests/baselines/reference/interfaceImplementation2.errors.txt b/tests/baselines/reference/interfaceImplementation2.errors.txt index 3e050e9b056..d723549d8be 100644 --- a/tests/baselines/reference/interfaceImplementation2.errors.txt +++ b/tests/baselines/reference/interfaceImplementation2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/interfaceImplementation2.ts(8,7): error TS2421: Class 'C3' incorrectly implements interface 'I1': + Property 'iFn' is missing in type 'C3'. + + ==== tests/cases/compiler/interfaceImplementation2.ts (1 errors) ==== interface I1 { iObj:{ }; @@ -8,8 +12,8 @@ class C3 implements I1 { ~~ -!!! Class 'C3' incorrectly implements interface 'I1': -!!! Property 'iFn' is missing in type 'C3'. +!!! error TS2421: Class 'C3' incorrectly implements interface 'I1': +!!! error TS2421: Property 'iFn' is missing in type 'C3'. public iObj:{ }; public iNum:number; public iAny:any; diff --git a/tests/baselines/reference/interfaceImplementation3.errors.txt b/tests/baselines/reference/interfaceImplementation3.errors.txt index b89b58fc379..1e5073ac2ee 100644 --- a/tests/baselines/reference/interfaceImplementation3.errors.txt +++ b/tests/baselines/reference/interfaceImplementation3.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/interfaceImplementation3.ts(8,7): error TS2421: Class 'C4' incorrectly implements interface 'I1': + Property 'iAny' is missing in type 'C4'. + + ==== tests/cases/compiler/interfaceImplementation3.ts (1 errors) ==== interface I1 { iObj:{ }; @@ -8,8 +12,8 @@ class C4 implements I1 { ~~ -!!! Class 'C4' incorrectly implements interface 'I1': -!!! Property 'iAny' is missing in type 'C4'. +!!! error TS2421: Class 'C4' incorrectly implements interface 'I1': +!!! error TS2421: Property 'iAny' is missing in type 'C4'. public iObj:{ }; public iNum:number; public iFn() { } diff --git a/tests/baselines/reference/interfaceImplementation4.errors.txt b/tests/baselines/reference/interfaceImplementation4.errors.txt index e2af897853d..8a08026b0bb 100644 --- a/tests/baselines/reference/interfaceImplementation4.errors.txt +++ b/tests/baselines/reference/interfaceImplementation4.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/interfaceImplementation4.ts(8,7): error TS2421: Class 'C5' incorrectly implements interface 'I1': + Property 'iObj' is missing in type 'C5'. + + ==== tests/cases/compiler/interfaceImplementation4.ts (1 errors) ==== interface I1 { iObj:{ }; @@ -8,8 +12,8 @@ class C5 implements I1 { ~~ -!!! Class 'C5' incorrectly implements interface 'I1': -!!! Property 'iObj' is missing in type 'C5'. +!!! error TS2421: Class 'C5' incorrectly implements interface 'I1': +!!! error TS2421: Property 'iObj' is missing in type 'C5'. public iNum:number; public iAny:any; public iFn() { } diff --git a/tests/baselines/reference/interfaceImplementation5.errors.txt b/tests/baselines/reference/interfaceImplementation5.errors.txt index de49d201e68..882d8516121 100644 --- a/tests/baselines/reference/interfaceImplementation5.errors.txt +++ b/tests/baselines/reference/interfaceImplementation5.errors.txt @@ -1,3 +1,13 @@ +tests/cases/compiler/interfaceImplementation5.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/interfaceImplementation5.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/interfaceImplementation5.ts(14,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/interfaceImplementation5.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/interfaceImplementation5.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/interfaceImplementation5.ts(23,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/interfaceImplementation5.ts(27,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/interfaceImplementation5.ts(28,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/interfaceImplementation5.ts (8 errors) ==== interface I1 { getset1:number; @@ -6,43 +16,43 @@ class C1 implements I1 { public get getset1(){return 1;} ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } class C2 implements I1 { public set getset1(baz:number){} ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } class C3 implements I1 { public get getset1(){return 1;} ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public set getset1(baz:number){} ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } class C4 implements I1 { public get getset1(){var x:any; return x;} ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } class C5 implements I1 { public set getset1(baz:any){} ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } class C6 implements I1 { public set getset1(baz:any){} ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. public get getset1(){var x:any; return x;} ~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceImplementation6.errors.txt b/tests/baselines/reference/interfaceImplementation6.errors.txt index a935fa60c7d..0965a1c6019 100644 --- a/tests/baselines/reference/interfaceImplementation6.errors.txt +++ b/tests/baselines/reference/interfaceImplementation6.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/interfaceImplementation6.ts(9,7): error TS2421: Class 'C2' incorrectly implements interface 'I1': + Property 'item' is private in type 'C2' but not in type 'I1'. +tests/cases/compiler/interfaceImplementation6.ts(13,7): error TS2421: Class 'C3' incorrectly implements interface 'I1': + Property 'item' is missing in type 'C3'. + + ==== tests/cases/compiler/interfaceImplementation6.ts (2 errors) ==== interface I1 { item:number; @@ -9,15 +15,15 @@ class C2 implements I1 { ~~ -!!! Class 'C2' incorrectly implements interface 'I1': -!!! Private property 'item' cannot be reimplemented. +!!! error TS2421: Class 'C2' incorrectly implements interface 'I1': +!!! error TS2421: Property 'item' is private in type 'C2' but not in type 'I1'. private item:number; } class C3 implements I1 { ~~ -!!! Class 'C3' incorrectly implements interface 'I1': -!!! Property 'item' is missing in type 'C3'. +!!! error TS2421: Class 'C3' incorrectly implements interface 'I1': +!!! error TS2421: Property 'item' is missing in type 'C3'. constructor() { var item: number; } diff --git a/tests/baselines/reference/interfaceImplementation7.errors.txt b/tests/baselines/reference/interfaceImplementation7.errors.txt index c39158df66c..9e04892215d 100644 --- a/tests/baselines/reference/interfaceImplementation7.errors.txt +++ b/tests/baselines/reference/interfaceImplementation7.errors.txt @@ -1,20 +1,29 @@ +tests/cases/compiler/interfaceImplementation7.ts(4,11): error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2': + Named properties 'name' of types 'i1' and 'i2' are not identical. +tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2421: Class 'C1' incorrectly implements interface 'i4': + Types of property 'name' are incompatible: + Type '() => string' is not assignable to type '() => { s: string; n: number; }': + Type 'string' is not assignable to type '{ s: string; n: number; }': + Property 's' is missing in type 'String'. + + ==== tests/cases/compiler/interfaceImplementation7.ts (2 errors) ==== interface i1{ name(): { s: string; }; } interface i2{ name(): { n: number; }; } interface i3 extends i1, i2 { } ~~ -!!! Interface 'i3' cannot simultaneously extend types 'i1' and 'i2': -!!! Named properties 'name' of types 'i1' and 'i2' are not identical. +!!! error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2': +!!! error TS2320: Named properties 'name' of types 'i1' and 'i2' are not identical. interface i4 extends i1, i2 { name(): { s: string; n: number; }; } class C1 implements i4 { ~~ -!!! Class 'C1' incorrectly implements interface 'i4': -!!! Types of property 'name' are incompatible: -!!! Type '() => string' is not assignable to type '() => { s: string; n: number; }': -!!! Type 'string' is not assignable to type '{ s: string; n: number; }': -!!! Property 's' is missing in type 'String'. +!!! error TS2421: Class 'C1' incorrectly implements interface 'i4': +!!! error TS2421: Types of property 'name' are incompatible: +!!! error TS2421: Type '() => string' is not assignable to type '() => { s: string; n: number; }': +!!! error TS2421: Type 'string' is not assignable to type '{ s: string; n: number; }': +!!! error TS2421: Property 's' is missing in type 'String'. public name(): string { return ""; } } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceImplementation8.errors.txt b/tests/baselines/reference/interfaceImplementation8.errors.txt index 6218ecd6a5e..4d0d06042a1 100644 --- a/tests/baselines/reference/interfaceImplementation8.errors.txt +++ b/tests/baselines/reference/interfaceImplementation8.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/interfaceImplementation8.ts(12,7): error TS2421: Class 'C2' incorrectly implements interface 'i1': + Property 'name' is private in type 'C2' but not in type 'i1'. +tests/cases/compiler/interfaceImplementation8.ts(21,7): error TS2421: Class 'C5' incorrectly implements interface 'i1': + Property 'name' is private in type 'C5' but not in type 'i1'. +tests/cases/compiler/interfaceImplementation8.ts(22,7): error TS2421: Class 'C6' incorrectly implements interface 'i1': + Property 'name' is private in type 'C6' but not in type 'i1'. + + ==== tests/cases/compiler/interfaceImplementation8.ts (3 errors) ==== /* 1 @@ -12,8 +20,8 @@ class C2 implements i1 { ~~ -!!! Class 'C2' incorrectly implements interface 'i1': -!!! Private property 'name' cannot be reimplemented. +!!! error TS2421: Class 'C2' incorrectly implements interface 'i1': +!!! error TS2421: Property 'name' is private in type 'C2' but not in type 'i1'. private name:string; } @@ -24,12 +32,12 @@ class C4 extends C1 implements i1{ } class C5 extends C2 implements i1{ } ~~ -!!! Class 'C5' incorrectly implements interface 'i1': -!!! Private property 'name' cannot be reimplemented. +!!! error TS2421: Class 'C5' incorrectly implements interface 'i1': +!!! error TS2421: Property 'name' is private in type 'C5' but not in type 'i1'. class C6 extends C3 implements i1{ } ~~ -!!! Class 'C6' incorrectly implements interface 'i1': -!!! Private property 'name' cannot be reimplemented. +!!! error TS2421: Class 'C6' incorrectly implements interface 'i1': +!!! error TS2421: Property 'name' is private in type 'C6' but not in type 'i1'. /* 2 diff --git a/tests/baselines/reference/interfaceInheritance.errors.txt b/tests/baselines/reference/interfaceInheritance.errors.txt index f8ef8d0861e..e192d0fa2e9 100644 --- a/tests/baselines/reference/interfaceInheritance.errors.txt +++ b/tests/baselines/reference/interfaceInheritance.errors.txt @@ -1,3 +1,15 @@ +tests/cases/compiler/interfaceInheritance.ts(22,7): error TS2421: Class 'C1' incorrectly implements interface 'I2': + Property 'i1P1' is missing in type 'C1'. +tests/cases/compiler/interfaceInheritance.ts(30,1): error TS2322: Type 'I3' is not assignable to type 'I2': + Property 'i1P1' is missing in type 'I3'. +tests/cases/compiler/interfaceInheritance.ts(37,1): error TS2322: Type 'I5' is not assignable to type 'I4': + Types of property 'one' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/interfaceInheritance.ts(38,1): error TS2322: Type 'I4' is not assignable to type 'I5': + Types of property 'one' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/interfaceInheritance.ts (4 errors) ==== interface I1 { i1P1: number; @@ -22,8 +34,8 @@ class C1 implements I2 { // should be an error - it doesn't implement the members of I1 ~~ -!!! Class 'C1' incorrectly implements interface 'I2': -!!! Property 'i1P1' is missing in type 'C1'. +!!! error TS2421: Class 'C1' incorrectly implements interface 'I2': +!!! error TS2421: Property 'i1P1' is missing in type 'C1'. public i2P1: string; } @@ -33,8 +45,8 @@ i1 = i2; i2 = i3; // should be an error - i3 does not implement the members of i1 ~~ -!!! Type 'I3' is not assignable to type 'I2': -!!! Property 'i1P1' is missing in type 'I3'. +!!! error TS2322: Type 'I3' is not assignable to type 'I2': +!!! error TS2322: Property 'i1P1' is missing in type 'I3'. var c1: C1; @@ -43,13 +55,13 @@ i4 = i5; // should be an error ~~ -!!! Type 'I5' is not assignable to type 'I4': -!!! Types of property 'one' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'I5' is not assignable to type 'I4': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. i5 = i4; // should be an error ~~ -!!! Type 'I4' is not assignable to type 'I5': -!!! Types of property 'one' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'I4' is not assignable to type 'I5': +!!! error TS2322: Types of property 'one' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt b/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt index a1644c4a282..06abf0987d6 100644 --- a/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt +++ b/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,29): error TS1005: ',' expected. +tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,32): error TS1005: '=>' expected. + + ==== tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts (2 errors) ==== interface color {} interface blue extends color() { // error ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceMemberValidation.errors.txt b/tests/baselines/reference/interfaceMemberValidation.errors.txt index c6ce933777c..ed8b119bbdd 100644 --- a/tests/baselines/reference/interfaceMemberValidation.errors.txt +++ b/tests/baselines/reference/interfaceMemberValidation.errors.txt @@ -1,20 +1,27 @@ +tests/cases/compiler/interfaceMemberValidation.ts(2,11): error TS2429: Interface 'i2' incorrectly extends interface 'i1': + Types of property 'name' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/interfaceMemberValidation.ts(5,2): error TS2411: Property 'bar' of type '{ (): any; (): any; }' is not assignable to string index type 'number'. +tests/cases/compiler/interfaceMemberValidation.ts(10,2): error TS2374: Duplicate string index signature. + + ==== tests/cases/compiler/interfaceMemberValidation.ts (3 errors) ==== interface i1 { name: string; } interface i2 extends i1 { name: number; yo: string; } ~~ -!!! Interface 'i2' incorrectly extends interface 'i1': -!!! Types of property 'name' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2429: Interface 'i2' incorrectly extends interface 'i1': +!!! error TS2429: Types of property 'name' are incompatible: +!!! error TS2429: Type 'number' is not assignable to type 'string'. interface foo { bar():any; ~~~~~~~~~~ -!!! Property 'bar' of type '{ (): any; (): any; }' is not assignable to string index type 'number'. +!!! error TS2411: Property 'bar' of type '{ (): any; (): any; }' is not assignable to string index type 'number'. bar():any; new():void; new():void; [s:string]:number; [s:string]:number; ~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceNameAsIdentifier.errors.txt b/tests/baselines/reference/interfaceNameAsIdentifier.errors.txt index 055940a5e2e..4be4d858d7b 100644 --- a/tests/baselines/reference/interfaceNameAsIdentifier.errors.txt +++ b/tests/baselines/reference/interfaceNameAsIdentifier.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/interfaceNameAsIdentifier.ts(4,1): error TS2304: Cannot find name 'C'. +tests/cases/compiler/interfaceNameAsIdentifier.ts(12,1): error TS2304: Cannot find name 'm2'. + + ==== tests/cases/compiler/interfaceNameAsIdentifier.ts (2 errors) ==== interface C { (): void; } C(); ~ -!!! Cannot find name 'C'. +!!! error TS2304: Cannot find name 'C'. module m2 { export interface C { @@ -14,5 +18,5 @@ m2.C(); ~~ -!!! Cannot find name 'm2'. +!!! error TS2304: Cannot find name 'm2'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceNaming1.errors.txt b/tests/baselines/reference/interfaceNaming1.errors.txt index 8f341f0e4ce..67158ce6109 100644 --- a/tests/baselines/reference/interfaceNaming1.errors.txt +++ b/tests/baselines/reference/interfaceNaming1.errors.txt @@ -1,13 +1,19 @@ +tests/cases/compiler/interfaceNaming1.ts(1,11): error TS1005: ';' expected. +tests/cases/compiler/interfaceNaming1.ts(1,1): error TS2304: Cannot find name 'interface'. +tests/cases/compiler/interfaceNaming1.ts(3,1): error TS2304: Cannot find name 'interface'. +tests/cases/compiler/interfaceNaming1.ts(3,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/compiler/interfaceNaming1.ts (4 errors) ==== interface { } ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~~~~ -!!! Cannot find name 'interface'. +!!! error TS2304: Cannot find name 'interface'. interface interface{ } interface & { } ~~~~~~~~~ -!!! Cannot find name 'interface'. +!!! error TS2304: Cannot find name 'interface'. ~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt b/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt index bf5dead7037..82d4a755d2a 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt +++ b/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/interfacePropertiesWithSameName2.ts(10,11): error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker': + Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker': + Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. + + ==== tests/cases/compiler/interfacePropertiesWithSameName2.ts (2 errors) ==== interface Mover { move(): void; @@ -10,8 +16,8 @@ interface MoverShaker extends Mover, Shaker { ~~~~~~~~~~~ -!!! Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker': -!!! Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +!!! error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker': +!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. } @@ -29,8 +35,8 @@ interface MoverShaker2 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { } // error ~~~~~~~~~~~~ -!!! Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker': -!!! Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +!!! error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker': +!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. interface MoverShaker3 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { getStatus(): { speed: number; frequency: number; }; // ok because this getStatus overrides the conflicting ones above diff --git a/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt b/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt index 92a1f5782d1..136a2460b5e 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt +++ b/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt @@ -1,15 +1,21 @@ +tests/cases/compiler/interfacePropertiesWithSameName3.ts(3,11): error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D': + Named properties 'a' of types 'E' and 'D' are not identical. +tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2': + Named properties 'a' of types 'E2' and 'D2' are not identical. + + ==== tests/cases/compiler/interfacePropertiesWithSameName3.ts (2 errors) ==== interface D { a: number; } interface E { a: string; } interface F extends E, D { } // error ~ -!!! Interface 'F' cannot simultaneously extend types 'E' and 'D': -!!! Named properties 'a' of types 'E' and 'D' are not identical. +!!! error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D': +!!! error TS2320: Named properties 'a' of types 'E' and 'D' are not identical. class D2 { a: number; } class E2 { a: string; } interface F2 extends E2, D2 { } // error ~~ -!!! Interface 'F2' cannot simultaneously extend types 'E2' and 'D2': -!!! Named properties 'a' of types 'E2' and 'D2' are not identical. +!!! error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2': +!!! error TS2320: Named properties 'a' of types 'E2' and 'D2' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceThatHidesBaseProperty2.errors.txt b/tests/baselines/reference/interfaceThatHidesBaseProperty2.errors.txt index 456ed18e007..dafff4336ba 100644 --- a/tests/baselines/reference/interfaceThatHidesBaseProperty2.errors.txt +++ b/tests/baselines/reference/interfaceThatHidesBaseProperty2.errors.txt @@ -1,3 +1,10 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatHidesBaseProperty2.ts(5,11): error TS2429: Interface 'Derived' incorrectly extends interface 'Base': + Types of property 'x' are incompatible: + Type '{ a: string; }' is not assignable to type '{ a: number; }': + Types of property 'a' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatHidesBaseProperty2.ts (1 errors) ==== interface Base { x: { a: number }; @@ -5,11 +12,11 @@ interface Derived extends Base { // error ~~~~~~~ -!!! Interface 'Derived' incorrectly extends interface 'Base': -!!! Types of property 'x' are incompatible: -!!! Type '{ a: string; }' is not assignable to type '{ a: number; }': -!!! Types of property 'a' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2429: Interface 'Derived' incorrectly extends interface 'Base': +!!! error TS2429: Types of property 'x' are incompatible: +!!! error TS2429: Type '{ a: string; }' is not assignable to type '{ a: number; }': +!!! error TS2429: Types of property 'a' are incompatible: +!!! error TS2429: Type 'string' is not assignable to type 'number'. x: { a: string; }; diff --git a/tests/baselines/reference/interfaceThatIndirectlyInheritsFromItself.errors.txt b/tests/baselines/reference/interfaceThatIndirectlyInheritsFromItself.errors.txt index d13ee9de95e..3749cae8682 100644 --- a/tests/baselines/reference/interfaceThatIndirectlyInheritsFromItself.errors.txt +++ b/tests/baselines/reference/interfaceThatIndirectlyInheritsFromItself.errors.txt @@ -1,7 +1,11 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatIndirectlyInheritsFromItself.ts(1,11): error TS2310: Type 'Base' recursively references itself as a base type. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatIndirectlyInheritsFromItself.ts(14,15): error TS2310: Type 'Base' recursively references itself as a base type. + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatIndirectlyInheritsFromItself.ts (2 errors) ==== interface Base extends Derived2 { // error ~~~~ -!!! Type 'Base' recursively references itself as a base type. +!!! error TS2310: Type 'Base' recursively references itself as a base type. x: string; } @@ -16,7 +20,7 @@ module Generic { interface Base extends Derived2 { // error ~~~~ -!!! Type 'Base' recursively references itself as a base type. +!!! error TS2310: Type 'Base' recursively references itself as a base type. x: string; } diff --git a/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt b/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt index b88f09304af..7aa5cc04a87 100644 --- a/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt +++ b/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt @@ -1,30 +1,40 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(10,15): error TS1005: '{' expected. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(10,26): error TS1005: ';' expected. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(10,30): error TS1005: ';' expected. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(1,11): error TS2310: Type 'Foo' recursively references itself as a base type. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(4,11): error TS2310: Type 'Foo2' recursively references itself as a base type. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(7,11): error TS2310: Type 'Foo3' recursively references itself as a base type. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(10,15): error TS2304: Cannot find name 'implements'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(10,26): error TS2304: Cannot find name 'Bar'. + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts (8 errors) ==== interface Foo extends Foo { // error ~~~ -!!! Type 'Foo' recursively references itself as a base type. +!!! error TS2310: Type 'Foo' recursively references itself as a base type. } interface Foo2 extends Foo2 { // error ~~~~ -!!! Type 'Foo2' recursively references itself as a base type. +!!! error TS2310: Type 'Foo2' recursively references itself as a base type. } interface Foo3 extends Foo3 { // error ~~~~ -!!! Type 'Foo3' recursively references itself as a base type. +!!! error TS2310: Type 'Foo3' recursively references itself as a base type. } interface Bar implements Bar { // error ~~~~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~~~~~ -!!! Cannot find name 'implements'. +!!! error TS2304: Cannot find name 'implements'. ~~~ -!!! Cannot find name 'Bar'. +!!! error TS2304: Cannot find name 'Bar'. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithAccessibilityModifiers.errors.txt b/tests/baselines/reference/interfaceWithAccessibilityModifiers.errors.txt new file mode 100644 index 00000000000..ecf803d522b --- /dev/null +++ b/tests/baselines/reference/interfaceWithAccessibilityModifiers.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts(3,5): error TS1131: Property or signature expected. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts(4,5): error TS1131: Property or signature expected. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts(5,5): error TS1131: Property or signature expected. + + +==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithAccessibilityModifiers.ts (3 errors) ==== + // Errors + interface Foo { + public a: any; + ~~~~~~ +!!! error TS1131: Property or signature expected. + private b: any; + ~~~~~~~ +!!! error TS1131: Property or signature expected. + protected c: any; + ~~~~~~~~~ +!!! error TS1131: Property or signature expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithImplements1.errors.txt b/tests/baselines/reference/interfaceWithImplements1.errors.txt index b2b1fdc3954..bb9465712d8 100644 --- a/tests/baselines/reference/interfaceWithImplements1.errors.txt +++ b/tests/baselines/reference/interfaceWithImplements1.errors.txt @@ -1,15 +1,22 @@ +tests/cases/compiler/interfaceWithImplements1.ts(3,16): error TS1005: '{' expected. +tests/cases/compiler/interfaceWithImplements1.ts(3,27): error TS1005: ';' expected. +tests/cases/compiler/interfaceWithImplements1.ts(3,32): error TS1005: ';' expected. +tests/cases/compiler/interfaceWithImplements1.ts(3,16): error TS2304: Cannot find name 'implements'. +tests/cases/compiler/interfaceWithImplements1.ts(3,27): error TS2304: Cannot find name 'IFoo'. + + ==== tests/cases/compiler/interfaceWithImplements1.ts (5 errors) ==== interface IFoo { } interface IBar implements IFoo { ~~~~~~~~~~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~~~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~~~~~ -!!! Cannot find name 'implements'. +!!! error TS2304: Cannot find name 'implements'. ~~~~ -!!! Cannot find name 'IFoo'. +!!! error TS2304: Cannot find name 'IFoo'. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt index d96a8d33a63..85351b191ec 100644 --- a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt @@ -1,3 +1,30 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(21,11): error TS2429: Interface 'Derived2' incorrectly extends interface 'Base2': + Types of property 'x' are incompatible: + Type '{ a: string; b: number; }' is not assignable to type '{ b: string; }': + Types of property 'b' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(52,15): error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2': + Named properties 'x' of types 'Base1' and 'Base2' are not identical. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2429: Interface 'Derived4' incorrectly extends interface 'Base1': + Types of property 'x' are incompatible: + Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }': + Types of property 'a' are incompatible: + Type 'T' is not assignable to type 'number'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2429: Interface 'Derived4' incorrectly extends interface 'Base2': + Types of property 'x' are incompatible: + Type '{ a: T; b: T; }' is not assignable to type '{ b: number; }': + Types of property 'b' are incompatible: + Type 'T' is not assignable to type 'number'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(60,15): error TS2429: Interface 'Derived5' incorrectly extends interface 'Base1': + Types of property 'x' are incompatible: + Type 'T' is not assignable to type '{ a: T; }': + Property 'a' is missing in type '{}'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(60,15): error TS2429: Interface 'Derived5' incorrectly extends interface 'Base2': + Types of property 'x' are incompatible: + Type 'T' is not assignable to type '{ b: T; }': + Property 'b' is missing in type '{}'. + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts (6 errors) ==== // an interface may have multiple bases with properties of the same name as long as the interface's implementation satisfies all base type versions @@ -21,11 +48,11 @@ interface Derived2 extends Base1, Base2 { // error ~~~~~~~~ -!!! Interface 'Derived2' incorrectly extends interface 'Base2': -!!! Types of property 'x' are incompatible: -!!! Type '{ a: string; b: number; }' is not assignable to type '{ b: string; }': -!!! Types of property 'b' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2429: Interface 'Derived2' incorrectly extends interface 'Base2': +!!! error TS2429: Types of property 'x' are incompatible: +!!! error TS2429: Type '{ a: string; b: number; }' is not assignable to type '{ b: string; }': +!!! error TS2429: Types of property 'b' are incompatible: +!!! error TS2429: Type 'number' is not assignable to type 'string'. x: { a: string; b: number; } @@ -58,22 +85,22 @@ interface Derived3 extends Base1, Base2 { } // error ~~~~~~~~ -!!! Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2': -!!! Named properties 'x' of types 'Base1' and 'Base2' are not identical. +!!! error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2': +!!! error TS2320: Named properties 'x' of types 'Base1' and 'Base2' are not identical. interface Derived4 extends Base1, Base2 { // error ~~~~~~~~ -!!! Interface 'Derived4' incorrectly extends interface 'Base1': -!!! Types of property 'x' are incompatible: -!!! Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }': -!!! Types of property 'a' are incompatible: -!!! Type 'T' is not assignable to type 'number'. +!!! error TS2429: Interface 'Derived4' incorrectly extends interface 'Base1': +!!! error TS2429: Types of property 'x' are incompatible: +!!! error TS2429: Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }': +!!! error TS2429: Types of property 'a' are incompatible: +!!! error TS2429: Type 'T' is not assignable to type 'number'. ~~~~~~~~ -!!! Interface 'Derived4' incorrectly extends interface 'Base2': -!!! Types of property 'x' are incompatible: -!!! Type '{ a: T; b: T; }' is not assignable to type '{ b: number; }': -!!! Types of property 'b' are incompatible: -!!! Type 'T' is not assignable to type 'number'. +!!! error TS2429: Interface 'Derived4' incorrectly extends interface 'Base2': +!!! error TS2429: Types of property 'x' are incompatible: +!!! error TS2429: Type '{ a: T; b: T; }' is not assignable to type '{ b: number; }': +!!! error TS2429: Types of property 'b' are incompatible: +!!! error TS2429: Type 'T' is not assignable to type 'number'. x: { a: T; b: T; } @@ -81,15 +108,15 @@ interface Derived5 extends Base1, Base2 { // error ~~~~~~~~ -!!! Interface 'Derived5' incorrectly extends interface 'Base1': -!!! Types of property 'x' are incompatible: -!!! Type 'T' is not assignable to type '{ a: T; }': -!!! Property 'a' is missing in type '{}'. +!!! error TS2429: Interface 'Derived5' incorrectly extends interface 'Base1': +!!! error TS2429: Types of property 'x' are incompatible: +!!! error TS2429: Type 'T' is not assignable to type '{ a: T; }': +!!! error TS2429: Property 'a' is missing in type '{}'. ~~~~~~~~ -!!! Interface 'Derived5' incorrectly extends interface 'Base2': -!!! Types of property 'x' are incompatible: -!!! Type 'T' is not assignable to type '{ b: T; }': -!!! Property 'b' is missing in type '{}'. +!!! error TS2429: Interface 'Derived5' incorrectly extends interface 'Base2': +!!! error TS2429: Types of property 'x' are incompatible: +!!! error TS2429: Type 'T' is not assignable to type '{ b: T; }': +!!! error TS2429: Property 'b' is missing in type '{}'. x: T; } } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithMultipleBaseTypes2.errors.txt b/tests/baselines/reference/interfaceWithMultipleBaseTypes2.errors.txt index 1ade49844d0..9d60afede0a 100644 --- a/tests/baselines/reference/interfaceWithMultipleBaseTypes2.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleBaseTypes2.errors.txt @@ -1,3 +1,10 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes2.ts(17,11): error TS2429: Interface 'Derived2' incorrectly extends interface 'Base': + Types of property 'x' are incompatible: + Type '{ a: number; b: string; }' is not assignable to type '{ a?: string; b: string; }': + Types of property 'a' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes2.ts (1 errors) ==== interface Base { x: { @@ -17,11 +24,11 @@ interface Derived2 extends Base, Base2 { // error ~~~~~~~~ -!!! Interface 'Derived2' incorrectly extends interface 'Base': -!!! Types of property 'x' are incompatible: -!!! Type '{ a: number; b: string; }' is not assignable to type '{ a?: string; b: string; }': -!!! Types of property 'a' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2429: Interface 'Derived2' incorrectly extends interface 'Base': +!!! error TS2429: Types of property 'x' are incompatible: +!!! error TS2429: Type '{ a: number; b: string; }' is not assignable to type '{ a?: string; b: string; }': +!!! error TS2429: Types of property 'a' are incompatible: +!!! error TS2429: Type 'number' is not assignable to type 'string'. x: { a: number; b: string } } diff --git a/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt b/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt index 0297e7966f5..9afd0d37733 100644 --- a/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt @@ -1,68 +1,85 @@ +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(3,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(11,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(16,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(18,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(20,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(22,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(24,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(34,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(36,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/interfaceWithMultipleDeclarations.ts (15 errors) ==== interface I1 { } interface I1 { // Name mismatch ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } interface I1 { // constraint present ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } interface I1 { // Length mismatch ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. } interface I2 { } interface I2 string> { // constraint mismatch ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. } interface I2 { // constraint absent ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. } interface I2 { // name mismatch ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. } interface I2 { // length mismatch ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. } interface I2 { // length mismatch ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. } interface I3 { } interface I3 { // length mismatch ~~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. } class Foo { } interface I4> { ~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } interface I4> { // Should not be error ~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithPrivateMember.errors.txt b/tests/baselines/reference/interfaceWithPrivateMember.errors.txt index b0c2e9fcfd2..e019ff9d9a1 100644 --- a/tests/baselines/reference/interfaceWithPrivateMember.errors.txt +++ b/tests/baselines/reference/interfaceWithPrivateMember.errors.txt @@ -1,24 +1,31 @@ +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(4,5): error TS1131: Property or signature expected. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(8,5): error TS1131: Property or signature expected. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(12,5): error TS1131: Property or signature expected. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(13,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(12,16): error TS2304: Cannot find name 'string'. + + ==== tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts (5 errors) ==== // interfaces do not permit private members, these are errors interface I { private x: string; ~~~~~~~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. } interface I2 { private y: T; ~~~~~~~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. } var x: { private y: string; ~~~~~~~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. ~~~~~~ -!!! Cannot find name 'string'. +!!! error TS2304: Cannot find name 'string'. } ~ -!!! Declaration or statement expected. \ No newline at end of file +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType.errors.txt b/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType.errors.txt index 543e7fc9ce8..60c917d0fbc 100644 --- a/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType.errors.txt +++ b/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType.ts(5,11): error TS2429: Interface 'Foo' incorrectly extends interface 'Base': + Property 'x' is private in type 'Base' but not in type 'Foo'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType.ts(13,11): error TS2429: Interface 'Foo2' incorrectly extends interface 'Base2': + Property 'x' is private in type 'Base2' but not in type 'Foo2'. + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType.ts (2 errors) ==== class Base { private x: number; @@ -5,8 +11,8 @@ interface Foo extends Base { // error ~~~ -!!! Interface 'Foo' incorrectly extends interface 'Base': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2429: Interface 'Foo' incorrectly extends interface 'Base': +!!! error TS2429: Property 'x' is private in type 'Base' but not in type 'Foo'. x: number; } @@ -16,7 +22,7 @@ interface Foo2 extends Base2 { // error ~~~~ -!!! Interface 'Foo2' incorrectly extends interface 'Base2': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2429: Interface 'Foo2' incorrectly extends interface 'Base2': +!!! error TS2429: Property 'x' is private in type 'Base2' but not in type 'Foo2'. x: number; } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType2.errors.txt b/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType2.errors.txt index f056d65fe16..4ee4bf8709f 100644 --- a/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType2.errors.txt +++ b/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType2.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType2.ts(5,11): error TS2429: Interface 'Foo' incorrectly extends interface 'Base': + Property 'x' is private in type 'Base' but not in type 'Foo'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType2.ts(13,11): error TS2429: Interface 'Foo2' incorrectly extends interface 'Base2': + Property 'x' is private in type 'Base2' but not in type 'Foo2'. + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType2.ts (2 errors) ==== class Base { private x() {} @@ -5,8 +11,8 @@ interface Foo extends Base { // error ~~~ -!!! Interface 'Foo' incorrectly extends interface 'Base': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2429: Interface 'Foo' incorrectly extends interface 'Base': +!!! error TS2429: Property 'x' is private in type 'Base' but not in type 'Foo'. x(): any; } @@ -16,7 +22,7 @@ interface Foo2 extends Base2 { // error ~~~~ -!!! Interface 'Foo2' incorrectly extends interface 'Base2': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2429: Interface 'Foo2' incorrectly extends interface 'Base2': +!!! error TS2429: Property 'x' is private in type 'Base2' but not in type 'Foo2'. x(): any; } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer.errors.txt b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer.errors.txt index b93e0479e10..40dc5668eb2 100644 --- a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer.errors.txt +++ b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithStringIndexerHidingBaseTypeIndexer.ts(13,5): error TS2411: Property 'y' of type '{ a: number; }' is not assignable to string index type '{ a: number; b: number; }'. + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithStringIndexerHidingBaseTypeIndexer.ts (1 errors) ==== interface Base { [x: string]: { a: number } @@ -17,5 +20,5 @@ ~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! Property 'y' of type '{ a: number; }' is not assignable to string index type '{ a: number; b: number; }'. +!!! error TS2411: Property 'y' of type '{ a: number; }' is not assignable to string index type '{ a: number; b: number; }'. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer2.errors.txt b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer2.errors.txt index 965cba84565..ac66d08a83a 100644 --- a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer2.errors.txt +++ b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithStringIndexerHidingBaseTypeIndexer2.ts(17,5): error TS2412: Property '1' of type '{ a: number; }' is not assignable to numeric index type '{ a: number; b: number; }'. + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithStringIndexerHidingBaseTypeIndexer2.ts (1 errors) ==== interface Base { [x: number]: { a: number; b: number } @@ -21,5 +24,5 @@ ~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! Property '1' of type '{ a: number; }' is not assignable to numeric index type '{ a: number; b: number; }'. +!!! error TS2412: Property '1' of type '{ a: number; }' is not assignable to numeric index type '{ a: number; b: number; }'. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer3.errors.txt b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer3.errors.txt index 080ffc7fb76..932780aaa1a 100644 --- a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer3.errors.txt +++ b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer3.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithStringIndexerHidingBaseTypeIndexer3.ts(13,5): error TS2412: Property '2' of type '{ a: number; }' is not assignable to numeric index type '{ a: number; b: number; }'. + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithStringIndexerHidingBaseTypeIndexer3.ts (1 errors) ==== interface Base { [x: number]: { a: number } @@ -17,5 +20,5 @@ ~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! Property '2' of type '{ a: number; }' is not assignable to numeric index type '{ a: number; b: number; }'. +!!! error TS2412: Property '2' of type '{ a: number; }' is not assignable to numeric index type '{ a: number; b: number; }'. } \ No newline at end of file diff --git a/tests/baselines/reference/interfacedeclWithIndexerErrors.errors.txt b/tests/baselines/reference/interfacedeclWithIndexerErrors.errors.txt index 118e4c20911..3eff7ad420c 100644 --- a/tests/baselines/reference/interfacedeclWithIndexerErrors.errors.txt +++ b/tests/baselines/reference/interfacedeclWithIndexerErrors.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/interfacedeclWithIndexerErrors.ts(12,5): error TS2411: Property 'p2' of type 'string' is not assignable to string index type '() => string'. +tests/cases/compiler/interfacedeclWithIndexerErrors.ts(14,5): error TS2411: Property 'p4' of type 'number' is not assignable to string index type '() => string'. +tests/cases/compiler/interfacedeclWithIndexerErrors.ts(15,5): error TS2411: Property 'p5' of type '(s: number) => string' is not assignable to string index type '() => string'. +tests/cases/compiler/interfacedeclWithIndexerErrors.ts(19,5): error TS2411: Property 'f3' of type '(a: string) => number' is not assignable to string index type '() => string'. +tests/cases/compiler/interfacedeclWithIndexerErrors.ts(20,5): error TS2411: Property 'f4' of type '(s: number) => string' is not assignable to string index type '() => string'. + + ==== tests/cases/compiler/interfacedeclWithIndexerErrors.ts (5 errors) ==== interface a0 { (): string; @@ -12,23 +19,23 @@ p1; p2: string; ~~~~~~~~~~~ -!!! Property 'p2' of type 'string' is not assignable to string index type '() => string'. +!!! error TS2411: Property 'p2' of type 'string' is not assignable to string index type '() => string'. p3?; p4?: number; ~~~~~~~~~~~~ -!!! Property 'p4' of type 'number' is not assignable to string index type '() => string'. +!!! error TS2411: Property 'p4' of type 'number' is not assignable to string index type '() => string'. p5: (s: number) =>string; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Property 'p5' of type '(s: number) => string' is not assignable to string index type '() => string'. +!!! error TS2411: Property 'p5' of type '(s: number) => string' is not assignable to string index type '() => string'. f1(); f2? (); f3(a: string): number; ~~~~~~~~~~~~~~~~~~~~~~ -!!! Property 'f3' of type '(a: string) => number' is not assignable to string index type '() => string'. +!!! error TS2411: Property 'f3' of type '(a: string) => number' is not assignable to string index type '() => string'. f4? (s: number): string; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Property 'f4' of type '(s: number) => string' is not assignable to string index type '() => string'. +!!! error TS2411: Property 'f4' of type '(s: number) => string' is not assignable to string index type '() => string'. } diff --git a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt index 5daed96e71f..20ef6f7a39d 100644 --- a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt +++ b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt @@ -1,16 +1,23 @@ +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,11): error TS1003: Identifier expected. +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(1,11): error TS2427: Interface name cannot be 'any' +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(2,11): error TS2427: Interface name cannot be 'number' +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(3,11): error TS2427: Interface name cannot be 'string' +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(4,11): error TS2427: Interface name cannot be 'boolean' + + ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts (5 errors) ==== interface any { } ~~~ -!!! Interface name cannot be 'any' +!!! error TS2427: Interface name cannot be 'any' interface number { } ~~~~~~ -!!! Interface name cannot be 'number' +!!! error TS2427: Interface name cannot be 'number' interface string { } ~~~~~~ -!!! Interface name cannot be 'string' +!!! error TS2427: Interface name cannot be 'string' interface boolean { } ~~~~~~~ -!!! Interface name cannot be 'boolean' +!!! error TS2427: Interface name cannot be 'boolean' interface void {} ~~~~ -!!! Identifier expected. \ No newline at end of file +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExportAccessError.errors.txt b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExportAccessError.errors.txt index 88f24934256..ee6a580ef40 100644 --- a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExportAccessError.errors.txt +++ b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExportAccessError.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/internalAliasClassInsideLocalModuleWithoutExportAccessError.ts(17,26): error TS2339: Property 'c' does not exist on type 'typeof m3'. + + ==== tests/cases/compiler/internalAliasClassInsideLocalModuleWithoutExportAccessError.ts (1 errors) ==== export module x { export class c { @@ -17,4 +20,4 @@ export var d = new m2.m3.c(); ~ -!!! Property 'c' does not exist on type 'typeof m3'. \ No newline at end of file +!!! error TS2339: Property 'c' does not exist on type 'typeof m3'. \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExportAccessError.errors.txt b/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExportAccessError.errors.txt index 0c2d7780a14..ff1739be202 100644 --- a/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExportAccessError.errors.txt +++ b/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExportAccessError.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/internalAliasEnumInsideLocalModuleWithoutExportAccessError.ts(14,21): error TS2339: Property 'b' does not exist on type 'typeof c'. + + ==== tests/cases/compiler/internalAliasEnumInsideLocalModuleWithoutExportAccessError.ts (1 errors) ==== export module a { export enum weekend { @@ -14,4 +17,4 @@ var happyFriday = c.b.Friday; ~ -!!! Property 'b' does not exist on type 'typeof c'. \ No newline at end of file +!!! error TS2339: Property 'b' does not exist on type 'typeof c'. \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithoutExportAccessError.errors.txt b/tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithoutExportAccessError.errors.txt index 3fd6a4f97cf..c28842aee7f 100644 --- a/tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithoutExportAccessError.errors.txt +++ b/tests/baselines/reference/internalAliasFunctionInsideLocalModuleWithoutExportAccessError.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/internalAliasFunctionInsideLocalModuleWithoutExportAccessError.ts(12,11): error TS2339: Property 'b' does not exist on type 'typeof c'. + + ==== tests/cases/compiler/internalAliasFunctionInsideLocalModuleWithoutExportAccessError.ts (1 errors) ==== export module a { export function foo(x: number) { @@ -12,4 +15,4 @@ } var d = c.b(11); ~ -!!! Property 'b' does not exist on type 'typeof c'. \ No newline at end of file +!!! error TS2339: Property 'b' does not exist on type 'typeof c'. \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithoutExportAccessError.errors.txt b/tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithoutExportAccessError.errors.txt index 34496189449..7997eb2b3ae 100644 --- a/tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithoutExportAccessError.errors.txt +++ b/tests/baselines/reference/internalAliasInitializedModuleInsideLocalModuleWithoutExportAccessError.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/internalAliasInitializedModuleInsideLocalModuleWithoutExportAccessError.ts(13,22): error TS2339: Property 'b' does not exist on type 'typeof c'. + + ==== tests/cases/compiler/internalAliasInitializedModuleInsideLocalModuleWithoutExportAccessError.ts (1 errors) ==== export module a { export module b { @@ -13,4 +16,4 @@ export var d = new c.b.c(); ~ -!!! Property 'b' does not exist on type 'typeof c'. \ No newline at end of file +!!! error TS2339: Property 'b' does not exist on type 'typeof c'. \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.errors.txt b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.errors.txt index eba8ac44484..9b5bf66844d 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.errors.txt +++ b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.ts(11,8): error TS2305: Module '"tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError".c' has no exported member 'b'. + + ==== tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.ts (1 errors) ==== export module a { export interface I { @@ -11,4 +14,4 @@ var x: c.b; ~~~ -!!! Module '"tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError".c' has no exported member 'b'. \ No newline at end of file +!!! error TS2305: Module '"tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError".c' has no exported member 'b'. \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.errors.txt b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.errors.txt index b8b04cfc224..33bb8f16331 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.errors.txt +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.ts(16,15): error TS2305: Module '"tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError".c' has no exported member 'b'. + + ==== tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.ts (1 errors) ==== export module a { export module b { @@ -16,4 +19,4 @@ export var z: c.b.I; ~~~~~ -!!! Module '"tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError".c' has no exported member 'b'. \ No newline at end of file +!!! error TS2305: Module '"tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError".c' has no exported member 'b'. \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasVarInsideLocalModuleWithoutExportAccessError.errors.txt b/tests/baselines/reference/internalAliasVarInsideLocalModuleWithoutExportAccessError.errors.txt index 90723aaa157..6c00ac57794 100644 --- a/tests/baselines/reference/internalAliasVarInsideLocalModuleWithoutExportAccessError.errors.txt +++ b/tests/baselines/reference/internalAliasVarInsideLocalModuleWithoutExportAccessError.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/internalAliasVarInsideLocalModuleWithoutExportAccessError.ts(10,18): error TS2339: Property 'b' does not exist on type 'typeof c'. + + ==== tests/cases/compiler/internalAliasVarInsideLocalModuleWithoutExportAccessError.ts (1 errors) ==== export module a { export var x = 10; @@ -10,4 +13,4 @@ export var z = c.b; ~ -!!! Property 'b' does not exist on type 'typeof c'. \ No newline at end of file +!!! error TS2339: Property 'b' does not exist on type 'typeof c'. \ No newline at end of file diff --git a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt index 64d2e92bdd4..1292efd8a08 100644 --- a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt +++ b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.ts(11,16): error TS2437: Module 'A' is hidden by a local declaration with the same name + + ==== tests/cases/compiler/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.ts (1 errors) ==== class A { aProp: string; @@ -11,6 +14,6 @@ var A = 1; import Y = A; ~ -!!! Module 'A' is hidden by a local declaration with the same name +!!! error TS2437: Module 'A' is hidden by a local declaration with the same name } \ No newline at end of file diff --git a/tests/baselines/reference/internalImportInstantiatedModuleNotReferencingInstance.errors.txt b/tests/baselines/reference/internalImportInstantiatedModuleNotReferencingInstance.errors.txt index 3cbb49c6809..5146966c3a4 100644 --- a/tests/baselines/reference/internalImportInstantiatedModuleNotReferencingInstance.errors.txt +++ b/tests/baselines/reference/internalImportInstantiatedModuleNotReferencingInstance.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/internalImportInstantiatedModuleNotReferencingInstance.ts(8,16): error TS2437: Module 'A' is hidden by a local declaration with the same name + + ==== tests/cases/compiler/internalImportInstantiatedModuleNotReferencingInstance.ts (1 errors) ==== module A { export interface X { s: string } @@ -8,6 +11,6 @@ var A = 1; import Y = A; ~ -!!! Module 'A' is hidden by a local declaration with the same name +!!! error TS2437: Module 'A' is hidden by a local declaration with the same name } \ No newline at end of file diff --git a/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt b/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt index 3e50f2be298..9f5cba24873 100644 --- a/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt +++ b/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.ts(10,16): error TS2437: Module 'A' is hidden by a local declaration with the same name + + ==== tests/cases/compiler/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.ts (1 errors) ==== class A { aProp: string; @@ -10,6 +13,6 @@ var A = 1; import Y = A; ~ -!!! Module 'A' is hidden by a local declaration with the same name +!!! error TS2437: Module 'A' is hidden by a local declaration with the same name } \ No newline at end of file diff --git a/tests/baselines/reference/intrinsics.errors.txt b/tests/baselines/reference/intrinsics.errors.txt index c2ffc5a2fc9..e9529d4b9f0 100644 --- a/tests/baselines/reference/intrinsics.errors.txt +++ b/tests/baselines/reference/intrinsics.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/intrinsics.ts(2,21): error TS2304: Cannot find name 'hasOwnProperty'. +tests/cases/compiler/intrinsics.ts(11,1): error TS2304: Cannot find name '__proto__'. + + ==== tests/cases/compiler/intrinsics.ts (2 errors) ==== var hasOwnProperty: hasOwnProperty; // Error ~~~~~~~~~~~~~~ -!!! Cannot find name 'hasOwnProperty'. +!!! error TS2304: Cannot find name 'hasOwnProperty'. module m1 { export var __proto__; @@ -13,7 +17,7 @@ __proto__ = 0; // Error, __proto__ not defined ~~~~~~~~~ -!!! Cannot find name '__proto__'. +!!! error TS2304: Cannot find name '__proto__'. m1.__proto__ = 0; class Foo<__proto__> { } diff --git a/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt b/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt index a89539e5da3..2d800b4befd 100644 --- a/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt +++ b/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt @@ -1,43 +1,55 @@ +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(2,1): error TS2323: Type 'number' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(3,1): error TS2323: Type 'boolean' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(4,1): error TS2323: Type 'string' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(5,1): error TS2323: Type '{}' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(9,1): error TS2323: Type 'typeof C' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(10,1): error TS2323: Type 'C' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(14,1): error TS2323: Type 'I' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(17,1): error TS2323: Type 'typeof M' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(20,5): error TS2323: Type 'T' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(22,1): error TS2323: Type '(a: T) => void' is not assignable to type 'void'. + + ==== tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts (10 errors) ==== var x: void; x = 1; ~ -!!! Type 'number' is not assignable to type 'void'. +!!! error TS2323: Type 'number' is not assignable to type 'void'. x = true; ~ -!!! Type 'boolean' is not assignable to type 'void'. +!!! error TS2323: Type 'boolean' is not assignable to type 'void'. x = ''; ~ -!!! Type 'string' is not assignable to type 'void'. +!!! error TS2323: Type 'string' is not assignable to type 'void'. x = {} ~ -!!! Type '{}' is not assignable to type 'void'. +!!! error TS2323: Type '{}' is not assignable to type 'void'. class C { foo: string; } var c: C; x = C; ~ -!!! Type 'typeof C' is not assignable to type 'void'. +!!! error TS2323: Type 'typeof C' is not assignable to type 'void'. x = c; ~ -!!! Type 'C' is not assignable to type 'void'. +!!! error TS2323: Type 'C' is not assignable to type 'void'. interface I { foo: string; } var i: I; x = i; ~ -!!! Type 'I' is not assignable to type 'void'. +!!! error TS2323: Type 'I' is not assignable to type 'void'. module M { export var x = 1; } x = M; ~ -!!! Type 'typeof M' is not assignable to type 'void'. +!!! error TS2323: Type 'typeof M' is not assignable to type 'void'. function f(a: T) { x = a; ~ -!!! Type 'T' is not assignable to type 'void'. +!!! error TS2323: Type 'T' is not assignable to type 'void'. } x = f; ~ -!!! Type '(a: T) => void' is not assignable to type 'void'. \ No newline at end of file +!!! error TS2323: Type '(a: T) => void' is not assignable to type 'void'. \ No newline at end of file diff --git a/tests/baselines/reference/invalidBooleanAssignments.errors.txt b/tests/baselines/reference/invalidBooleanAssignments.errors.txt index 8da60d2e27a..d7642fa4ace 100644 --- a/tests/baselines/reference/invalidBooleanAssignments.errors.txt +++ b/tests/baselines/reference/invalidBooleanAssignments.errors.txt @@ -1,49 +1,63 @@ +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(3,5): error TS2323: Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(4,5): error TS2323: Type 'boolean' is not assignable to type 'string'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(5,5): error TS2323: Type 'boolean' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(9,5): error TS2323: Type 'boolean' is not assignable to type 'E'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(12,5): error TS2322: Type 'boolean' is not assignable to type 'C': + Property 'foo' is missing in type 'Boolean'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(15,5): error TS2322: Type 'boolean' is not assignable to type 'I': + Property 'bar' is missing in type 'Boolean'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(17,5): error TS2323: Type 'boolean' is not assignable to type '() => string'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(21,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(24,5): error TS2323: Type 'boolean' is not assignable to type 'T'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(26,1): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts (10 errors) ==== var x = true; var a: number = x; ~ -!!! Type 'boolean' is not assignable to type 'number'. +!!! error TS2323: Type 'boolean' is not assignable to type 'number'. var b: string = x; ~ -!!! Type 'boolean' is not assignable to type 'string'. +!!! error TS2323: Type 'boolean' is not assignable to type 'string'. var c: void = x; ~ -!!! Type 'boolean' is not assignable to type 'void'. +!!! error TS2323: Type 'boolean' is not assignable to type 'void'. var d: typeof undefined = x; enum E { A } var e: E = x; ~ -!!! Type 'boolean' is not assignable to type 'E'. +!!! error TS2323: Type 'boolean' is not assignable to type 'E'. class C { foo: string } var f: C = x; ~ -!!! Type 'boolean' is not assignable to type 'C': -!!! Property 'foo' is missing in type 'Boolean'. +!!! error TS2322: Type 'boolean' is not assignable to type 'C': +!!! error TS2322: Property 'foo' is missing in type 'Boolean'. interface I { bar: string } var g: I = x; ~ -!!! Type 'boolean' is not assignable to type 'I': -!!! Property 'bar' is missing in type 'Boolean'. +!!! error TS2322: Type 'boolean' is not assignable to type 'I': +!!! error TS2322: Property 'bar' is missing in type 'Boolean'. var h: { (): string } = x; ~ -!!! Type 'boolean' is not assignable to type '() => string'. +!!! error TS2323: Type 'boolean' is not assignable to type '() => string'. var h2: { toString(): string } = x; // no error module M { export var a = 1; } M = x; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. function i(a: T) { a = x; ~ -!!! Type 'boolean' is not assignable to type 'T'. +!!! error TS2323: Type 'boolean' is not assignable to type 'T'. } i = x; ~ -!!! Invalid left-hand side of assignment expression. \ No newline at end of file +!!! error TS2364: Invalid left-hand side of assignment expression. \ No newline at end of file diff --git a/tests/baselines/reference/invalidConstraint1.errors.txt b/tests/baselines/reference/invalidConstraint1.errors.txt index c38b126504c..bac8f805c0f 100644 --- a/tests/baselines/reference/invalidConstraint1.errors.txt +++ b/tests/baselines/reference/invalidConstraint1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/invalidConstraint1.ts(1,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/invalidConstraint1.ts (1 errors) ==== function f() { ~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. return undefined; } f(); // should error diff --git a/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt b/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt index 9b526d3c219..65fd55b763b 100644 --- a/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt @@ -1,16 +1,24 @@ +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(8,4): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(37,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. + + ==== tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts (6 errors) ==== // All errors // naked break not allowed break; ~~~~~~ -!!! A 'break' statement can only be used within an enclosing iteration or switch statement. +!!! error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. // non-existent label ONE: do break TWO; while (true) ~~~~~~~~~~ -!!! A 'break' statement can only jump to a label of an enclosing statement. +!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. // break from inside function TWO: @@ -18,7 +26,7 @@ var x = () => { break TWO; ~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } }while (true) @@ -27,7 +35,7 @@ var fn = function () { break THREE; ~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } }while (true) @@ -35,7 +43,7 @@ do { break FIVE; ~~~~~~~~~~~ -!!! A 'break' statement can only jump to a label of an enclosing statement. +!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. FIVE: do { } while (true) }while (true) @@ -47,5 +55,5 @@ do { break NINE; ~~~~~~~~~~~ -!!! A 'break' statement can only jump to a label of an enclosing statement. +!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. }while (true) \ No newline at end of file diff --git a/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt b/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt index 38c54104d39..e9643394d12 100644 --- a/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt @@ -1,16 +1,24 @@ +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(4,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(8,4): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(27,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(37,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. + + ==== tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts (6 errors) ==== // All errors // naked continue not allowed continue; ~~~~~~~~~ -!!! A 'continue' statement can only be used within an enclosing iteration statement. +!!! error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. // non-existent label ONE: do continue TWO; while (true) ~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. // continue from inside function TWO: @@ -18,7 +26,7 @@ var x = () => { continue TWO; ~~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } }while (true) @@ -27,7 +35,7 @@ var fn = function () { continue THREE; ~~~~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } }while (true) @@ -35,7 +43,7 @@ do { continue FIVE; ~~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. FIVE: do { } while (true) }while (true) @@ -47,5 +55,5 @@ do { continue NINE; ~~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. }while (true) \ No newline at end of file diff --git a/tests/baselines/reference/invalidEnumAssignments.errors.txt b/tests/baselines/reference/invalidEnumAssignments.errors.txt index cfbc67c3390..6e9c46d4239 100644 --- a/tests/baselines/reference/invalidEnumAssignments.errors.txt +++ b/tests/baselines/reference/invalidEnumAssignments.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(14,1): error TS2323: Type 'E2' is not assignable to type 'E'. +tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(15,1): error TS2323: Type 'E' is not assignable to type 'E2'. +tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(16,1): error TS2323: Type 'void' is not assignable to type 'E'. +tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(17,1): error TS2323: Type '{}' is not assignable to type 'E'. +tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(18,1): error TS2323: Type 'string' is not assignable to type 'E'. +tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(21,5): error TS2323: Type 'T' is not assignable to type 'E'. + + ==== tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts (6 errors) ==== enum E { A, @@ -14,22 +22,22 @@ e = E2.A; ~ -!!! Type 'E2' is not assignable to type 'E'. +!!! error TS2323: Type 'E2' is not assignable to type 'E'. e2 = E.A; ~~ -!!! Type 'E' is not assignable to type 'E2'. +!!! error TS2323: Type 'E' is not assignable to type 'E2'. e = null; ~ -!!! Type 'void' is not assignable to type 'E'. +!!! error TS2323: Type 'void' is not assignable to type 'E'. e = {}; ~ -!!! Type '{}' is not assignable to type 'E'. +!!! error TS2323: Type '{}' is not assignable to type 'E'. e = ''; ~ -!!! Type 'string' is not assignable to type 'E'. +!!! error TS2323: Type 'string' is not assignable to type 'E'. function f(a: T) { e = a; ~ -!!! Type 'T' is not assignable to type 'E'. +!!! error TS2323: Type 'T' is not assignable to type 'E'. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidForBreakStatements.errors.txt b/tests/baselines/reference/invalidForBreakStatements.errors.txt index 28c110b1105..50e4013c0ea 100644 --- a/tests/baselines/reference/invalidForBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidForBreakStatements.errors.txt @@ -1,16 +1,24 @@ +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(8,9): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(36,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. + + ==== tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts (6 errors) ==== // All errors // naked break not allowed break; ~~~~~~ -!!! A 'break' statement can only be used within an enclosing iteration or switch statement. +!!! error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. // non-existent label ONE: for(;;) break TWO; ~~~~~~~~~~ -!!! A 'break' statement can only jump to a label of an enclosing statement. +!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. // break from inside function TWO: @@ -18,7 +26,7 @@ var x = () => { break TWO; ~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } @@ -27,7 +35,7 @@ var fn = function () { break THREE; ~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } @@ -35,7 +43,7 @@ for(;;) { break FIVE; ~~~~~~~~~~~ -!!! A 'break' statement can only jump to a label of an enclosing statement. +!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. FIVE: for (; ;) { } } @@ -46,5 +54,5 @@ for(;;) { break NINE; ~~~~~~~~~~~ -!!! A 'break' statement can only jump to a label of an enclosing statement. +!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidForContinueStatements.errors.txt b/tests/baselines/reference/invalidForContinueStatements.errors.txt index d3aadb0b694..3af47370df1 100644 --- a/tests/baselines/reference/invalidForContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidForContinueStatements.errors.txt @@ -1,16 +1,24 @@ +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(4,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(8,9): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(27,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(36,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. + + ==== tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts (6 errors) ==== // All errors // naked continue not allowed continue; ~~~~~~~~~ -!!! A 'continue' statement can only be used within an enclosing iteration statement. +!!! error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. // non-existent label ONE: for(;;) continue TWO; ~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. // continue from inside function TWO: @@ -18,7 +26,7 @@ var x = () => { continue TWO; ~~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } @@ -27,7 +35,7 @@ var fn = function () { continue THREE; ~~~~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } @@ -35,7 +43,7 @@ for(;;) { continue FIVE; ~~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. FIVE: for (; ;) { } } @@ -46,5 +54,5 @@ for(;;) { continue NINE; ~~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidForInBreakStatements.errors.txt b/tests/baselines/reference/invalidForInBreakStatements.errors.txt index 6e29ea04c8e..d83304ab1c6 100644 --- a/tests/baselines/reference/invalidForInBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidForInBreakStatements.errors.txt @@ -1,16 +1,24 @@ +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(8,19): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(37,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. + + ==== tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts (6 errors) ==== // All errors // naked break not allowed break; ~~~~~~ -!!! A 'break' statement can only be used within an enclosing iteration or switch statement. +!!! error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. // non-existent label ONE: for (var x in {}) break TWO; ~~~~~~~~~~ -!!! A 'break' statement can only jump to a label of an enclosing statement. +!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. // break from inside function TWO: @@ -18,7 +26,7 @@ var fn = () => { break TWO; ~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } @@ -27,7 +35,7 @@ var fn = function () { break THREE; ~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } @@ -35,7 +43,7 @@ for (var x in {}) { break FIVE; ~~~~~~~~~~~ -!!! A 'break' statement can only jump to a label of an enclosing statement. +!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. FIVE: for (var x in {}) { } } @@ -47,5 +55,5 @@ for (var x in {}) { break NINE; ~~~~~~~~~~~ -!!! A 'break' statement can only jump to a label of an enclosing statement. +!!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidForInContinueStatements.errors.txt b/tests/baselines/reference/invalidForInContinueStatements.errors.txt index f9cf403c975..7353a22d9cd 100644 --- a/tests/baselines/reference/invalidForInContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidForInContinueStatements.errors.txt @@ -1,16 +1,24 @@ +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(4,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(8,19): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(27,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(37,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. + + ==== tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts (6 errors) ==== // All errors // naked continue not allowed continue; ~~~~~~~~~ -!!! A 'continue' statement can only be used within an enclosing iteration statement. +!!! error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. // non-existent label ONE: for (var x in {}) continue TWO; ~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. // continue from inside function TWO: @@ -18,7 +26,7 @@ var fn = () => { continue TWO; ~~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } @@ -27,7 +35,7 @@ var fn = function () { continue THREE; ~~~~~~~~~~~~~~~ -!!! Jump target cannot cross function boundary. +!!! error TS1107: Jump target cannot cross function boundary. } } @@ -35,7 +43,7 @@ for (var x in {}) { continue FIVE; ~~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. FIVE: for (var x in {}) { } } @@ -47,5 +55,5 @@ for (var x in {}) { continue NINE; ~~~~~~~~~~~~~~ -!!! A 'continue' statement can only jump to a label of an enclosing iteration statement. +!!! error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt b/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt index 0248c590eb8..ea582635856 100644 --- a/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt +++ b/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(5,1): error TS2304: Cannot find name 'V'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(11,1): error TS2304: Cannot find name 'C'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(17,1): error TS2304: Cannot find name 'E'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,1): error TS2304: Cannot find name 'I'. + + ==== tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts (4 errors) ==== // none of these should work, since non are actually modules @@ -5,7 +11,7 @@ import v = V; ~~~~~~~~~~~~~ -!!! Cannot find name 'V'. +!!! error TS2304: Cannot find name 'V'. class C { name: string; @@ -13,7 +19,7 @@ import c = C; ~~~~~~~~~~~~~ -!!! Cannot find name 'C'. +!!! error TS2304: Cannot find name 'C'. enum E { Red, Blue @@ -21,7 +27,7 @@ import e = E; ~~~~~~~~~~~~~ -!!! Cannot find name 'E'. +!!! error TS2304: Cannot find name 'E'. interface I { id: number; @@ -29,5 +35,5 @@ import i = I; ~~~~~~~~~~~~~ -!!! Cannot find name 'I'. +!!! error TS2304: Cannot find name 'I'. \ No newline at end of file diff --git a/tests/baselines/reference/invalidInstantiatedModule.errors.txt b/tests/baselines/reference/invalidInstantiatedModule.errors.txt index ed5ae704038..5a8ac069803 100644 --- a/tests/baselines/reference/invalidInstantiatedModule.errors.txt +++ b/tests/baselines/reference/invalidInstantiatedModule.errors.txt @@ -1,9 +1,16 @@ -==== tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts (2 errors) ==== +tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(2,18): error TS2300: Duplicate identifier 'Point'. +tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(3,16): error TS2300: Duplicate identifier 'Point'. +tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(12,8): error TS2304: Cannot find name 'm'. + + +==== tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts (3 errors) ==== module M { export class Point { x: number; y: number } + ~~~~~ +!!! error TS2300: Duplicate identifier 'Point'. export var Point = 1; // Error ~~~~~ -!!! Duplicate identifier 'Point'. +!!! error TS2300: Duplicate identifier 'Point'. } module M2 { @@ -14,7 +21,7 @@ var m = M2; var p: m.Point; // Error ~~~~~~~ -!!! Cannot find name 'm'. +!!! error TS2304: Cannot find name 'm'. \ No newline at end of file diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt index a9707aedc84..101ee0124cc 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt @@ -1,14 +1,37 @@ +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module element. + + ==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts (21 errors) ==== // All of these should be an error module Y { public class A { s: string } ~~~~~~ -!!! 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module element. public class BB extends A { ~~~~~~ -!!! 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module element. id: number; } } @@ -16,20 +39,20 @@ module Y2 { public class AA { s: T } ~~~~~~ -!!! 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module element. public interface I { id: number } ~~~~~~ -!!! 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module element. public class B extends AA implements I { id: number } ~~~~~~ -!!! 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module element. } module Y3 { public module Module { ~~~~~~ -!!! 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module element. class A { s: string } } } @@ -37,17 +60,17 @@ module Y4 { public enum Color { Blue, Red } ~~~~~~ -!!! 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module element. } module YY { private class A { s: string } ~~~~~~~ -!!! 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module element. private class BB extends A { ~~~~~~~ -!!! 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module element. id: number; } } @@ -55,20 +78,20 @@ module YY2 { private class AA { s: T } ~~~~~~~ -!!! 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module element. private interface I { id: number } ~~~~~~~ -!!! 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module element. private class B extends AA implements I { id: number } ~~~~~~~ -!!! 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module element. } module YY3 { private module Module { ~~~~~~~ -!!! 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module element. class A { s: string } } } @@ -76,18 +99,18 @@ module YY4 { private enum Color { Blue, Red } ~~~~~~~ -!!! 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module element. } module YYY { static class A { s: string } ~~~~~~ -!!! 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module element. static class BB extends A { ~~~~~~ -!!! 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module element. id: number; } } @@ -95,20 +118,20 @@ module YYY2 { static class AA { s: T } ~~~~~~ -!!! 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module element. static interface I { id: number } ~~~~~~ -!!! 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module element. static class B extends AA implements I { id: number } ~~~~~~ -!!! 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module element. } module YYY3 { static module Module { ~~~~~~ -!!! 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module element. class A { s: string } } } @@ -116,6 +139,6 @@ module YYY4 { static enum Color { Blue, Red } ~~~~~~ -!!! 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module element. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt index 80f516a2f66..ad8d457670a 100644 --- a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt +++ b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt @@ -1,40 +1,48 @@ +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module element. + + ==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts (6 errors) ==== // All of these should be an error module Y { public var x: number = 0; ~~~~~~ -!!! 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module element. } module Y2 { public function fn(x: string) { } ~~~~~~ -!!! 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module element. } module Y4 { static var x: number = 0; ~~~~~~ -!!! 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module element. } module YY { static function fn(x: string) { } ~~~~~~ -!!! 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module element. } module YY2 { private var x: number = 0; ~~~~~~~ -!!! 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module element. } module YY3 { private function fn(x: string) { } ~~~~~~~ -!!! 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module element. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt index b09865a2f25..b82c82b9eb5 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt @@ -1,3 +1,17 @@ +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(32,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(33,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(34,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(35,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(36,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(39,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'Array>'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(50,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(53,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. + + ==== tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts (12 errors) ==== interface I { id: number; @@ -32,47 +46,47 @@ var a: any; var a = 1; ~ -!!! Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. var a = 'a string'; ~ -!!! Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. var a = new C(); ~ -!!! Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. var a = new D(); ~ -!!! Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. var a = M; ~ -!!! Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. var b: I; var b = new C(); ~ -!!! Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. var b = new C2(); ~ -!!! Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. var f = F; var f = (x: number) => ''; ~ -!!! Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. var arr: string[]; var arr = [1, 2, 3, 4]; ~~~ -!!! Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. var arr = [new C(), new C2(), new D()]; ~~~ -!!! Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '{}[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'Array>'. var arr2 = [new D()]; var arr2 = new Array>(); ~~~~ -!!! Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. var m: typeof M; var m = M.A; ~ -!!! Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. \ No newline at end of file diff --git a/tests/baselines/reference/invalidNestedModules.errors.txt b/tests/baselines/reference/invalidNestedModules.errors.txt index 31e8ad29177..972c177fc0e 100644 --- a/tests/baselines/reference/invalidNestedModules.errors.txt +++ b/tests/baselines/reference/invalidNestedModules.errors.txt @@ -1,7 +1,12 @@ -==== tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts (2 errors) ==== +tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts(1,12): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged +tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts(17,18): error TS2300: Duplicate identifier 'Point'. +tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts(24,20): error TS2300: Duplicate identifier 'Point'. + + +==== tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts (3 errors) ==== module A.B.C { ~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged export class Point { x: number; y: number; @@ -18,6 +23,8 @@ module M2.X { export class Point { + ~~~~~ +!!! error TS2300: Duplicate identifier 'Point'. x: number; y: number; } } @@ -26,7 +33,7 @@ export module X { export var Point: number; // Error ~~~~~ -!!! Duplicate identifier 'Point'. +!!! error TS2300: Duplicate identifier 'Point'. } } diff --git a/tests/baselines/reference/invalidNumberAssignments.errors.txt b/tests/baselines/reference/invalidNumberAssignments.errors.txt index 4bba247a5b8..641e02683e6 100644 --- a/tests/baselines/reference/invalidNumberAssignments.errors.txt +++ b/tests/baselines/reference/invalidNumberAssignments.errors.txt @@ -1,48 +1,64 @@ +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(3,5): error TS2323: Type 'number' is not assignable to type 'boolean'. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(4,5): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(5,5): error TS2323: Type 'number' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(9,5): error TS2322: Type 'number' is not assignable to type 'C': + Property 'foo' is missing in type 'Number'. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(12,5): error TS2322: Type 'number' is not assignable to type 'I': + Property 'bar' is missing in type 'Number'. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }': + Property 'baz' is missing in type 'Number'. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }': + Property '0' is missing in type 'Number'. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(18,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(21,5): error TS2323: Type 'number' is not assignable to type 'T'. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(23,1): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts (10 errors) ==== var x = 1; var a: boolean = x; ~ -!!! Type 'number' is not assignable to type 'boolean'. +!!! error TS2323: Type 'number' is not assignable to type 'boolean'. var b: string = x; ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. var c: void = x; ~ -!!! Type 'number' is not assignable to type 'void'. +!!! error TS2323: Type 'number' is not assignable to type 'void'. var d: typeof undefined = x; class C { foo: string; } var e: C = x; ~ -!!! Type 'number' is not assignable to type 'C': -!!! Property 'foo' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type 'C': +!!! error TS2322: Property 'foo' is missing in type 'Number'. interface I { bar: string; } var f: I = x; ~ -!!! Type 'number' is not assignable to type 'I': -!!! Property 'bar' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type 'I': +!!! error TS2322: Property 'bar' is missing in type 'Number'. var g: { baz: string } = 1; ~ -!!! Type 'number' is not assignable to type '{ baz: string; }': -!!! Property 'baz' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type '{ baz: string; }': +!!! error TS2322: Property 'baz' is missing in type 'Number'. var g2: { 0: number } = 1; ~~ -!!! Type 'number' is not assignable to type '{ 0: number; }': -!!! Property '0' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }': +!!! error TS2322: Property '0' is missing in type 'Number'. module M { export var x = 1; } M = x; ~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. function i(a: T) { a = x; ~ -!!! Type 'number' is not assignable to type 'T'. +!!! error TS2323: Type 'number' is not assignable to type 'T'. } i = x; ~ -!!! Invalid left-hand side of assignment expression. \ No newline at end of file +!!! error TS2364: Invalid left-hand side of assignment expression. \ No newline at end of file diff --git a/tests/baselines/reference/invalidReferenceSyntax1.errors.txt b/tests/baselines/reference/invalidReferenceSyntax1.errors.txt index cad7a35eb02..e7599c7a146 100644 --- a/tests/baselines/reference/invalidReferenceSyntax1.errors.txt +++ b/tests/baselines/reference/invalidReferenceSyntax1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/invalidReferenceSyntax1.ts(1,1): error TS1084: Invalid 'reference' directive syntax. + + ==== tests/cases/compiler/invalidReferenceSyntax1.ts (1 errors) ==== /// ()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. a.length; a.push(new C()); (new C()).prototype; ~~~~~~~~~ -!!! Property 'prototype' does not exist on type 'C'. +!!! error TS2339: Property 'prototype' does not exist on type 'C'. } \ No newline at end of file diff --git a/tests/baselines/reference/lift.errors.txt b/tests/baselines/reference/lift.errors.txt index 56f8a860211..ef8bddbf787 100644 --- a/tests/baselines/reference/lift.errors.txt +++ b/tests/baselines/reference/lift.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/lift.ts(14,32): error TS2304: Cannot find name 'x'. +tests/cases/compiler/lift.ts(14,34): error TS2304: Cannot find name 'z'. +tests/cases/compiler/lift.ts(15,37): error TS2304: Cannot find name 'x'. +tests/cases/compiler/lift.ts(15,39): error TS2304: Cannot find name 'z'. + + ==== tests/cases/compiler/lift.ts (4 errors) ==== class B { constructor(public y:number) { @@ -14,13 +20,13 @@ public liftxyz () { return x+z+this.y; } ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. ~ -!!! Cannot find name 'z'. +!!! error TS2304: Cannot find name 'z'. public liftxylocllz () { return x+z+this.y+this.ll; } ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. ~ -!!! Cannot find name 'z'. +!!! error TS2304: Cannot find name 'z'. } \ No newline at end of file diff --git a/tests/baselines/reference/literals-negative.errors.txt b/tests/baselines/reference/literals-negative.errors.txt index 276afb5a81d..d783e5dfa02 100644 --- a/tests/baselines/reference/literals-negative.errors.txt +++ b/tests/baselines/reference/literals-negative.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/literals-negative.ts(5,9): error TS2352: Neither type 'number' nor type 'boolean' is assignable to the other. + + ==== tests/cases/compiler/literals-negative.ts (1 errors) ==== // Type type of the null literal is the Null type. // Null can be converted to anything except Void @@ -5,7 +8,7 @@ var s = (null); var b = (n); ~~~~~~~~~~~~ -!!! Neither type 'number' nor type 'boolean' is assignable to the other. +!!! error TS2352: Neither type 'number' nor type 'boolean' is assignable to the other. function isVoid() : void { } diff --git a/tests/baselines/reference/literals.errors.txt b/tests/baselines/reference/literals.errors.txt index 3361dfd5c67..f33d26af7a4 100644 --- a/tests/baselines/reference/literals.errors.txt +++ b/tests/baselines/reference/literals.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/literals/literals.ts(9,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/literals/literals.ts(9,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/literals/literals.ts(10,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/conformance/expressions/literals/literals.ts (6 errors) ==== //typeof null is Null @@ -9,14 +17,14 @@ var nu = null / null; ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var u = undefined / undefined; ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var b: boolean; var b = true; @@ -28,14 +36,14 @@ var n = 1e4; var n = 001; // Error in ES5 ~~~ -!!! Octal literals are not available when targeting ECMAScript 5 and higher. +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. var n = 0x1; var n = -1; var n = -1.0; var n = -1e-4; var n = -003; // Error in ES5 ~~~ -!!! Octal literals are not available when targeting ECMAScript 5 and higher. +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. var n = -0x1; var s: string; diff --git a/tests/baselines/reference/logicalNotExpression1.errors.txt b/tests/baselines/reference/logicalNotExpression1.errors.txt index b38a05bb31f..cd2a3a0941d 100644 --- a/tests/baselines/reference/logicalNotExpression1.errors.txt +++ b/tests/baselines/reference/logicalNotExpression1.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/logicalNotExpression1.ts(1,2): error TS2304: Cannot find name 'foo'. + + ==== tests/cases/compiler/logicalNotExpression1.ts (1 errors) ==== !foo; ~~~ -!!! Cannot find name 'foo'. \ No newline at end of file +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt b/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt index 7b8e7de7d4e..3267d60a13a 100644 --- a/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(5,17): error TS1005: ',' expected. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(5,18): error TS1109: Expression expected. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(11,16): error TS1109: Expression expected. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(8,16): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'. + + ==== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts (4 errors) ==== // Unary operator ! var b: number; @@ -5,16 +11,16 @@ // operand before ! var BOOLEAN1 = b!; //expect error ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. // miss parentheses var BOOLEAN2 = !b + b; ~~~~~~ -!!! Operator '+' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'. // miss an operand var BOOLEAN3 =!; ~ -!!! Expression expected. \ No newline at end of file +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt index 07aa1630e9f..883f2ee5861 100644 --- a/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt @@ -1,3 +1,8 @@ +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(45,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(46,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(47,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + + ==== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts (3 errors) ==== // ! operator on any type @@ -45,13 +50,13 @@ var ResultIsBoolean16 = !(ANY + ANY1); var ResultIsBoolean17 = !(null + undefined); ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsBoolean18 = !(null + null); ~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var ResultIsBoolean19 = !(undefined + undefined); ~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. // multiple ! operators var ResultIsBoolean20 = !!ANY; diff --git a/tests/baselines/reference/logicalNotOperatorWithEnumType.js b/tests/baselines/reference/logicalNotOperatorWithEnumType.js index 19efcc979ad..69ea283051d 100644 --- a/tests/baselines/reference/logicalNotOperatorWithEnumType.js +++ b/tests/baselines/reference/logicalNotOperatorWithEnumType.js @@ -1,33 +1,33 @@ //// [logicalNotOperatorWithEnumType.ts] // ! operator on enum type -enum ENUM { 1, 2, 3 }; +enum ENUM { A, B, C }; enum ENUM1 { }; // enum type var var ResultIsBoolean1 = !ENUM; // enum type expressions -var ResultIsBoolean2 = !ENUM[1]; -var ResultIsBoolean3 = !(ENUM[1] + ENUM[2]); +var ResultIsBoolean2 = !ENUM["B"]; +var ResultIsBoolean3 = !(ENUM.B + ENUM["C"]); // multiple ! operators var ResultIsBoolean4 = !!ENUM; -var ResultIsBoolean5 = !!!(ENUM[1] + ENUM[2]); +var ResultIsBoolean5 = !!!(ENUM["B"] + ENUM.C); // miss assignment operators !ENUM; !ENUM1; -!ENUM[1]; +!ENUM.B; !ENUM, ENUM1; //// [logicalNotOperatorWithEnumType.js] // ! operator on enum type var ENUM; (function (ENUM) { - ENUM[ENUM["1"] = 0] = "1"; - ENUM[ENUM["2"] = 1] = "2"; - ENUM[ENUM["3"] = 2] = "3"; + ENUM[ENUM["A"] = 0] = "A"; + ENUM[ENUM["B"] = 1] = "B"; + ENUM[ENUM["C"] = 2] = "C"; })(ENUM || (ENUM = {})); ; var ENUM1; @@ -37,13 +37,13 @@ var ENUM1; // enum type var var ResultIsBoolean1 = !ENUM; // enum type expressions -var ResultIsBoolean2 = !ENUM[1]; -var ResultIsBoolean3 = !(ENUM[1] + ENUM[2]); +var ResultIsBoolean2 = !ENUM["B"]; +var ResultIsBoolean3 = !(1 /* B */ + ENUM["C"]); // multiple ! operators var ResultIsBoolean4 = !!ENUM; -var ResultIsBoolean5 = !!!(ENUM[1] + ENUM[2]); +var ResultIsBoolean5 = !!!(ENUM["B"] + 2 /* C */); // miss assignment operators !ENUM; !ENUM1; -!ENUM[1]; +!1 /* B */; !ENUM, ENUM1; diff --git a/tests/baselines/reference/logicalNotOperatorWithEnumType.types b/tests/baselines/reference/logicalNotOperatorWithEnumType.types index 27cbb24d3bb..f3c9d98c95b 100644 --- a/tests/baselines/reference/logicalNotOperatorWithEnumType.types +++ b/tests/baselines/reference/logicalNotOperatorWithEnumType.types @@ -1,8 +1,11 @@ === tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType.ts === // ! operator on enum type -enum ENUM { 1, 2, 3 }; +enum ENUM { A, B, C }; >ENUM : ENUM +>A : ENUM +>B : ENUM +>C : ENUM enum ENUM1 { }; >ENUM1 : ENUM1 @@ -14,20 +17,21 @@ var ResultIsBoolean1 = !ENUM; >ENUM : typeof ENUM // enum type expressions -var ResultIsBoolean2 = !ENUM[1]; +var ResultIsBoolean2 = !ENUM["B"]; >ResultIsBoolean2 : boolean ->!ENUM[1] : boolean ->ENUM[1] : ENUM +>!ENUM["B"] : boolean +>ENUM["B"] : ENUM >ENUM : typeof ENUM -var ResultIsBoolean3 = !(ENUM[1] + ENUM[2]); +var ResultIsBoolean3 = !(ENUM.B + ENUM["C"]); >ResultIsBoolean3 : boolean ->!(ENUM[1] + ENUM[2]) : boolean ->(ENUM[1] + ENUM[2]) : number ->ENUM[1] + ENUM[2] : number ->ENUM[1] : ENUM +>!(ENUM.B + ENUM["C"]) : boolean +>(ENUM.B + ENUM["C"]) : number +>ENUM.B + ENUM["C"] : number +>ENUM.B : ENUM >ENUM : typeof ENUM ->ENUM[2] : ENUM +>B : ENUM +>ENUM["C"] : ENUM >ENUM : typeof ENUM // multiple ! operators @@ -37,17 +41,18 @@ var ResultIsBoolean4 = !!ENUM; >!ENUM : boolean >ENUM : typeof ENUM -var ResultIsBoolean5 = !!!(ENUM[1] + ENUM[2]); +var ResultIsBoolean5 = !!!(ENUM["B"] + ENUM.C); >ResultIsBoolean5 : boolean ->!!!(ENUM[1] + ENUM[2]) : boolean ->!!(ENUM[1] + ENUM[2]) : boolean ->!(ENUM[1] + ENUM[2]) : boolean ->(ENUM[1] + ENUM[2]) : number ->ENUM[1] + ENUM[2] : number ->ENUM[1] : ENUM +>!!!(ENUM["B"] + ENUM.C) : boolean +>!!(ENUM["B"] + ENUM.C) : boolean +>!(ENUM["B"] + ENUM.C) : boolean +>(ENUM["B"] + ENUM.C) : number +>ENUM["B"] + ENUM.C : number +>ENUM["B"] : ENUM >ENUM : typeof ENUM ->ENUM[2] : ENUM +>ENUM.C : ENUM >ENUM : typeof ENUM +>C : ENUM // miss assignment operators !ENUM; @@ -58,10 +63,11 @@ var ResultIsBoolean5 = !!!(ENUM[1] + ENUM[2]); >!ENUM1 : boolean >ENUM1 : typeof ENUM1 -!ENUM[1]; ->!ENUM[1] : boolean ->ENUM[1] : ENUM +!ENUM.B; +>!ENUM.B : boolean +>ENUM.B : ENUM >ENUM : typeof ENUM +>B : ENUM !ENUM, ENUM1; >!ENUM, ENUM1 : typeof ENUM1 diff --git a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types index d44b220e818..95c9643c29a 100644 --- a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types +++ b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types @@ -7,7 +7,7 @@ var r: { a: string } = { a: '', b: 123 } || { a: '', b: true }; >r : { a: string; } >a : string ->{ a: '', b: 123 } || { a: '', b: true } : { a: string; } +>{ a: '', b: 123 } || { a: '', b: true } : { a: string; b: number; } | { a: string; b: boolean; } >{ a: '', b: 123 } : { a: string; b: number; } >a : string >b : number diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types b/tests/baselines/reference/logicalOrOperatorWithEveryType.types index 3cf0399f437..3e3b0dcf37f 100644 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.types +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.types @@ -108,38 +108,38 @@ var rb2 = a2 || a2; // boolean || boolean is boolean >a2 : boolean var rb3 = a3 || a2; // number || boolean is {} ->rb3 : {} ->a3 || a2 : {} +>rb3 : number | boolean +>a3 || a2 : number | boolean >a3 : number >a2 : boolean var rb4 = a4 || a2; // string || boolean is {} ->rb4 : {} ->a4 || a2 : {} +>rb4 : string | boolean +>a4 || a2 : string | boolean >a4 : string >a2 : boolean var rb5 = a5 || a2; // void || boolean is {} ->rb5 : {} ->a5 || a2 : {} +>rb5 : boolean | void +>a5 || a2 : boolean | void >a5 : void >a2 : boolean var rb6 = a6 || a2; // enum || boolean is {} ->rb6 : {} ->a6 || a2 : {} +>rb6 : boolean | E +>a6 || a2 : boolean | E >a6 : E >a2 : boolean var rb7 = a7 || a2; // object || boolean is {} ->rb7 : {} ->a7 || a2 : {} +>rb7 : boolean | { a: string; } +>a7 || a2 : boolean | { a: string; } >a7 : { a: string; } >a2 : boolean var rb8 = a8 || a2; // array || boolean is {} ->rb8 : {} ->a8 || a2 : {} +>rb8 : boolean | string[] +>a8 || a2 : boolean | string[] >a8 : string[] >a2 : boolean @@ -161,8 +161,8 @@ var rc1 = a1 || a3; // any || number is any >a3 : number var rc2 = a2 || a3; // boolean || number is {} ->rc2 : {} ->a2 || a3 : {} +>rc2 : number | boolean +>a2 || a3 : number | boolean >a2 : boolean >a3 : number @@ -173,14 +173,14 @@ var rc3 = a3 || a3; // number || number is number >a3 : number var rc4 = a4 || a3; // string || number is {} ->rc4 : {} ->a4 || a3 : {} +>rc4 : string | number +>a4 || a3 : string | number >a4 : string >a3 : number var rc5 = a5 || a3; // void || number is {} ->rc5 : {} ->a5 || a3 : {} +>rc5 : number | void +>a5 || a3 : number | void >a5 : void >a3 : number @@ -191,14 +191,14 @@ var rc6 = a6 || a3; // enum || number is number >a3 : number var rc7 = a7 || a3; // object || number is {} ->rc7 : {} ->a7 || a3 : {} +>rc7 : number | { a: string; } +>a7 || a3 : number | { a: string; } >a7 : { a: string; } >a3 : number var rc8 = a8 || a3; // array || number is {} ->rc8 : {} ->a8 || a3 : {} +>rc8 : number | string[] +>a8 || a3 : number | string[] >a8 : string[] >a3 : number @@ -220,14 +220,14 @@ var rd1 = a1 || a4; // any || string is any >a4 : string var rd2 = a2 || a4; // boolean || string is {} ->rd2 : {} ->a2 || a4 : {} +>rd2 : string | boolean +>a2 || a4 : string | boolean >a2 : boolean >a4 : string var rd3 = a3 || a4; // number || string is {} ->rd3 : {} ->a3 || a4 : {} +>rd3 : string | number +>a3 || a4 : string | number >a3 : number >a4 : string @@ -238,26 +238,26 @@ var rd4 = a4 || a4; // string || string is string >a4 : string var rd5 = a5 || a4; // void || string is {} ->rd5 : {} ->a5 || a4 : {} +>rd5 : string | void +>a5 || a4 : string | void >a5 : void >a4 : string var rd6 = a6 || a4; // enum || string is {} ->rd6 : {} ->a6 || a4 : {} +>rd6 : string | E +>a6 || a4 : string | E >a6 : E >a4 : string var rd7 = a7 || a4; // object || string is {} ->rd7 : {} ->a7 || a4 : {} +>rd7 : string | { a: string; } +>a7 || a4 : string | { a: string; } >a7 : { a: string; } >a4 : string var rd8 = a8 || a4; // array || string is {} ->rd8 : {} ->a8 || a4 : {} +>rd8 : string | string[] +>a8 || a4 : string | string[] >a8 : string[] >a4 : string @@ -279,20 +279,20 @@ var re1 = a1 || a5; // any || void is any >a5 : void var re2 = a2 || a5; // boolean || void is {} ->re2 : {} ->a2 || a5 : {} +>re2 : boolean | void +>a2 || a5 : boolean | void >a2 : boolean >a5 : void var re3 = a3 || a5; // number || void is {} ->re3 : {} ->a3 || a5 : {} +>re3 : number | void +>a3 || a5 : number | void >a3 : number >a5 : void var re4 = a4 || a5; // string || void is {} ->re4 : {} ->a4 || a5 : {} +>re4 : string | void +>a4 || a5 : string | void >a4 : string >a5 : void @@ -303,20 +303,20 @@ var re5 = a5 || a5; // void || void is void >a5 : void var re6 = a6 || a5; // enum || void is {} ->re6 : {} ->a6 || a5 : {} +>re6 : void | E +>a6 || a5 : void | E >a6 : E >a5 : void var re7 = a7 || a5; // object || void is {} ->re7 : {} ->a7 || a5 : {} +>re7 : void | { a: string; } +>a7 || a5 : void | { a: string; } >a7 : { a: string; } >a5 : void var re8 = a8 || a5; // array || void is {} ->re8 : {} ->a8 || a5 : {} +>re8 : void | string[] +>a8 || a5 : void | string[] >a8 : string[] >a5 : void @@ -338,8 +338,8 @@ var rg1 = a1 || a6; // any || enum is any >a6 : E var rg2 = a2 || a6; // boolean || enum is {} ->rg2 : {} ->a2 || a6 : {} +>rg2 : boolean | E +>a2 || a6 : boolean | E >a2 : boolean >a6 : E @@ -350,14 +350,14 @@ var rg3 = a3 || a6; // number || enum is number >a6 : E var rg4 = a4 || a6; // string || enum is {} ->rg4 : {} ->a4 || a6 : {} +>rg4 : string | E +>a4 || a6 : string | E >a4 : string >a6 : E var rg5 = a5 || a6; // void || enum is {} ->rg5 : {} ->a5 || a6 : {} +>rg5 : void | E +>a5 || a6 : void | E >a5 : void >a6 : E @@ -368,14 +368,14 @@ var rg6 = a6 || a6; // enum || enum is E >a6 : E var rg7 = a7 || a6; // object || enum is {} ->rg7 : {} ->a7 || a6 : {} +>rg7 : E | { a: string; } +>a7 || a6 : E | { a: string; } >a7 : { a: string; } >a6 : E var rg8 = a8 || a6; // array || enum is {} ->rg8 : {} ->a8 || a6 : {} +>rg8 : string[] | E +>a8 || a6 : string[] | E >a8 : string[] >a6 : E @@ -397,32 +397,32 @@ var rh1 = a1 || a7; // any || object is any >a7 : { a: string; } var rh2 = a2 || a7; // boolean || object is {} ->rh2 : {} ->a2 || a7 : {} +>rh2 : boolean | { a: string; } +>a2 || a7 : boolean | { a: string; } >a2 : boolean >a7 : { a: string; } var rh3 = a3 || a7; // number || object is {} ->rh3 : {} ->a3 || a7 : {} +>rh3 : number | { a: string; } +>a3 || a7 : number | { a: string; } >a3 : number >a7 : { a: string; } var rh4 = a4 || a7; // string || object is {} ->rh4 : {} ->a4 || a7 : {} +>rh4 : string | { a: string; } +>a4 || a7 : string | { a: string; } >a4 : string >a7 : { a: string; } var rh5 = a5 || a7; // void || object is {} ->rh5 : {} ->a5 || a7 : {} +>rh5 : void | { a: string; } +>a5 || a7 : void | { a: string; } >a5 : void >a7 : { a: string; } var rh6 = a6 || a7; // enum || object is {} ->rh6 : {} ->a6 || a7 : {} +>rh6 : E | { a: string; } +>a6 || a7 : E | { a: string; } >a6 : E >a7 : { a: string; } @@ -433,8 +433,8 @@ var rh7 = a7 || a7; // object || object is object >a7 : { a: string; } var rh8 = a8 || a7; // array || object is {} ->rh8 : {} ->a8 || a7 : {} +>rh8 : string[] | { a: string; } +>a8 || a7 : string[] | { a: string; } >a8 : string[] >a7 : { a: string; } @@ -456,38 +456,38 @@ var ri1 = a1 || a8; // any || array is any >a8 : string[] var ri2 = a2 || a8; // boolean || array is {} ->ri2 : {} ->a2 || a8 : {} +>ri2 : boolean | string[] +>a2 || a8 : boolean | string[] >a2 : boolean >a8 : string[] var ri3 = a3 || a8; // number || array is {} ->ri3 : {} ->a3 || a8 : {} +>ri3 : number | string[] +>a3 || a8 : number | string[] >a3 : number >a8 : string[] var ri4 = a4 || a8; // string || array is {} ->ri4 : {} ->a4 || a8 : {} +>ri4 : string | string[] +>a4 || a8 : string | string[] >a4 : string >a8 : string[] var ri5 = a5 || a8; // void || array is {} ->ri5 : {} ->a5 || a8 : {} +>ri5 : void | string[] +>a5 || a8 : void | string[] >a5 : void >a8 : string[] var ri6 = a6 || a8; // enum || array is {} ->ri6 : {} ->a6 || a8 : {} +>ri6 : string[] | E +>a6 || a8 : string[] | E >a6 : E >a8 : string[] var ri7 = a7 || a8; // object || array is {} ->ri7 : {} ->a7 || a8 : {} +>ri7 : string[] | { a: string; } +>a7 || a8 : string[] | { a: string; } >a7 : { a: string; } >a8 : string[] diff --git a/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types b/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types index ff0e0ce568a..4008fbbff50 100644 --- a/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types +++ b/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types @@ -22,14 +22,14 @@ function fn1(t: T, u: U) { >t : T var r3 = t || u; ->r3 : {} ->t || u : {} +>r3 : T | U +>t || u : T | U >t : T >u : U var r4: {} = t || u; >r4 : {} ->t || u : {} +>t || u : T | U >t : T >u : U } @@ -47,8 +47,8 @@ function fn2(t: T, u: U, v: V) { >V : V var r1 = t || u; ->r1 : {} ->t || u : {} +>r1 : T | U +>t || u : T | U >t : T >u : U @@ -67,14 +67,14 @@ function fn2(t: T, u: U, v: V) { >u : U var r5 = u || v; ->r5 : {} ->u || v : {} +>r5 : U | V +>u || v : U | V >u : U >v : V var r6: {} = u || v; >r6 : {} ->u || v : {} +>u || v : U | V >u : U >v : V @@ -95,14 +95,14 @@ function fn3U : U var r1 = t || u; ->r1 : {} ->t || u : {} +>r1 : T | U +>t || u : T | U >t : T >u : U var r2: {} = t || u; >r2 : {} ->t || u : {} +>t || u : T | U >t : T >u : U @@ -116,7 +116,7 @@ function fn3r4 : { a: string; } >a : string ->t || u : { a: string; } +>t || u : T | U >t : T >u : U } diff --git a/tests/baselines/reference/matchReturnTypeInAllBranches.errors.txt b/tests/baselines/reference/matchReturnTypeInAllBranches.errors.txt index 0daf93e9391..b273526b4f1 100644 --- a/tests/baselines/reference/matchReturnTypeInAllBranches.errors.txt +++ b/tests/baselines/reference/matchReturnTypeInAllBranches.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/matchReturnTypeInAllBranches.ts(30,20): error TS2323: Type 'number' is not assignable to type 'boolean'. + + ==== tests/cases/compiler/matchReturnTypeInAllBranches.ts (1 errors) ==== // Represents a monster who enjoys ice cream class IceCreamMonster { @@ -30,7 +33,7 @@ { return 12345; ~~~~~ -!!! Type 'number' is not assignable to type 'boolean'. +!!! error TS2323: Type 'number' is not assignable to type 'boolean'. } } } diff --git a/tests/baselines/reference/matchingOfObjectLiteralConstraints.errors.txt b/tests/baselines/reference/matchingOfObjectLiteralConstraints.errors.txt index 6c9c0f65d19..edd917a4602 100644 --- a/tests/baselines/reference/matchingOfObjectLiteralConstraints.errors.txt +++ b/tests/baselines/reference/matchingOfObjectLiteralConstraints.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/matchingOfObjectLiteralConstraints.ts(1,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/compiler/matchingOfObjectLiteralConstraints.ts (1 errors) ==== function foo2(x: U, z: T) { } ~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo2({ y: "foo" }, "foo"); \ No newline at end of file diff --git a/tests/baselines/reference/maxConstraints.errors.txt b/tests/baselines/reference/maxConstraints.errors.txt index 8a525d1a673..1c3844d6974 100644 --- a/tests/baselines/reference/maxConstraints.errors.txt +++ b/tests/baselines/reference/maxConstraints.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/maxConstraints.ts(5,6): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. + + ==== tests/cases/compiler/maxConstraints.ts (2 errors) ==== interface Comparable { compareTo(other: T): number; @@ -5,9 +9,9 @@ interface Comparer { >(x: T, y: T): T; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; var maxResult = max2(1, 2); ~ -!!! Argument of type 'number' is not assignable to parameter of type 'Comparable'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. \ No newline at end of file diff --git a/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt b/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt index d0b707c9ff1..624438cf054 100644 --- a/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt +++ b/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt @@ -1,36 +1,46 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts(3,12): error TS2388: Function overload must not be static. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts(3,12): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts(8,5): error TS2387: Function overload must be static. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts(8,5): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts(13,12): error TS2388: Function overload must not be static. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts(13,12): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts(18,5): error TS2387: Function overload must be static. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts(18,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts (8 errors) ==== class C { foo(); static foo(); // error ~~~ -!!! Function overload must not be static. +!!! error TS2388: Function overload must not be static. ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } class D { static foo(); foo(); // error ~~~ -!!! Function overload must be static. +!!! error TS2387: Function overload must be static. ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } class E { foo(x: T); static foo(x: number); // error ~~~ -!!! Function overload must not be static. +!!! error TS2388: Function overload must not be static. ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } class F { static foo(x: number); foo(x: T); // error ~~~ -!!! Function overload must be static. +!!! error TS2387: Function overload must be static. ~~~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt b/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt index 0a84fc1a751..d6c3d4a659c 100644 --- a/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt +++ b/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(43,9): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(46,10): error TS2341: Property 'foo' is private and only accessible within class 'D'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(48,10): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(49,10): error TS2341: Property 'bar' is private and only accessible within class 'D'. + + ==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts (4 errors) ==== class C { private foo(x: number); @@ -43,16 +49,16 @@ var c: C; var r = c.foo(1); // error ~~~~~ -!!! Property 'C.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'C'. var d: D; var r2 = d.foo(2); // error ~~~~~ -!!! Property 'D.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'D'. var r3 = C.foo(1); // error ~~~~~ -!!! Property 'C.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'C'. var r4 = D.bar(''); // error ~~~~~ -!!! Property 'D.bar' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'bar' is private and only accessible within class 'D'. \ No newline at end of file diff --git a/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt b/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt index 962a00d9534..64d2f3d3059 100644 --- a/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt +++ b/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt @@ -1,66 +1,110 @@ -==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts (10 errors) ==== +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(3,12): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(7,12): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(12,19): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(15,15): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(16,15): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(20,19): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(25,19): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(32,12): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(36,12): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(41,15): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(45,19): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(49,19): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(53,19): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(59,9): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(62,10): error TS2341: Property 'foo' is private and only accessible within class 'D'. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts (15 errors) ==== class C { private foo(x: number); public foo(x: number, y: string); // error ~~~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private foo(x: any, y?: any) { } private bar(x: 'hi'); public bar(x: string); // error ~~~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private bar(x: number, y: string); private bar(x: any, y?: any) { } private static foo(x: number); public static foo(x: number, y: string); // error ~~~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private static foo(x: any, y?: any) { } + protected baz(x: string); // error + ~~~ +!!! error TS2385: Overload signatures must all be public, private or protected. + protected baz(x: number, y: string); // error + ~~~ +!!! error TS2385: Overload signatures must all be public, private or protected. + private baz(x: any, y?: any) { } + private static bar(x: 'hi'); public static bar(x: string); // error ~~~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private static bar(x: number, y: string); private static bar(x: any, y?: any) { } + + protected static baz(x: 'hi'); + public static baz(x: string); // error + ~~~ +!!! error TS2385: Overload signatures must all be public, private or protected. + protected static baz(x: number, y: string); + protected static baz(x: any, y?: any) { } } class D { private foo(x: number); public foo(x: T, y: T); // error ~~~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private foo(x: any, y?: any) { } private bar(x: 'hi'); public bar(x: string); // error ~~~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private bar(x: T, y: T); private bar(x: any, y?: any) { } + private baz(x: string); + protected baz(x: number, y: string); // error + ~~~ +!!! error TS2385: Overload signatures must all be public, private or protected. + private baz(x: any, y?: any) { } + private static foo(x: number); public static foo(x: number, y: string); // error ~~~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private static foo(x: any, y?: any) { } private static bar(x: 'hi'); public static bar(x: string); // error ~~~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private static bar(x: number, y: string); private static bar(x: any, y?: any) { } + + public static baz(x: string); // error + ~~~ +!!! error TS2385: Overload signatures must all be public, private or protected. + protected static baz(x: number, y: string); + protected static baz(x: any, y?: any) { } } var c: C; var r = c.foo(1); // error ~~~~~ -!!! Property 'C.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'C'. var d: D; var r2 = d.foo(2); // error ~~~~~ -!!! Property 'D.foo' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'foo' is private and only accessible within class 'D'. \ No newline at end of file diff --git a/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.js b/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.js index 27e3bb5e85d..2726756c803 100644 --- a/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.js +++ b/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.js @@ -13,10 +13,19 @@ class C { public static foo(x: number, y: string); // error private static foo(x: any, y?: any) { } + protected baz(x: string); // error + protected baz(x: number, y: string); // error + private baz(x: any, y?: any) { } + private static bar(x: 'hi'); public static bar(x: string); // error private static bar(x: number, y: string); private static bar(x: any, y?: any) { } + + protected static baz(x: 'hi'); + public static baz(x: string); // error + protected static baz(x: number, y: string); + protected static baz(x: any, y?: any) { } } class D { @@ -29,6 +38,10 @@ class D { private bar(x: T, y: T); private bar(x: any, y?: any) { } + private baz(x: string); + protected baz(x: number, y: string); // error + private baz(x: any, y?: any) { } + private static foo(x: number); public static foo(x: number, y: string); // error private static foo(x: any, y?: any) { } @@ -37,6 +50,10 @@ class D { public static bar(x: string); // error private static bar(x: number, y: string); private static bar(x: any, y?: any) { } + + public static baz(x: string); // error + protected static baz(x: number, y: string); + protected static baz(x: any, y?: any) { } } var c: C; @@ -55,8 +72,12 @@ var C = (function () { }; C.foo = function (x, y) { }; + C.prototype.baz = function (x, y) { + }; C.bar = function (x, y) { }; + C.baz = function (x, y) { + }; return C; })(); var D = (function () { @@ -66,10 +87,14 @@ var D = (function () { }; D.prototype.bar = function (x, y) { }; + D.prototype.baz = function (x, y) { + }; D.foo = function (x, y) { }; D.bar = function (x, y) { }; + D.baz = function (x, y) { + }; return D; })(); var c; diff --git a/tests/baselines/reference/memberOverride.errors.txt b/tests/baselines/reference/memberOverride.errors.txt index 4b0b385829e..c63803f5aa1 100644 --- a/tests/baselines/reference/memberOverride.errors.txt +++ b/tests/baselines/reference/memberOverride.errors.txt @@ -1,13 +1,20 @@ -==== tests/cases/compiler/memberOverride.ts (2 errors) ==== +tests/cases/compiler/memberOverride.ts(4,5): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/memberOverride.ts(5,5): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/memberOverride.ts(8,5): error TS2323: Type 'string' is not assignable to type 'number'. + + +==== tests/cases/compiler/memberOverride.ts (3 errors) ==== // An object initialiser accepts the first definition for the same property with a different type signature // Should compile, since the second declaration of a overrides the first var x = { a: "", + ~ +!!! error TS2300: Duplicate identifier 'a'. a: 5 ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. } var n: number = x.a; ~ -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2323: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/memberScope.errors.txt b/tests/baselines/reference/memberScope.errors.txt index 8c059a077fb..017a28d5f71 100644 --- a/tests/baselines/reference/memberScope.errors.txt +++ b/tests/baselines/reference/memberScope.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/memberScope.ts(4,11): error TS2304: Cannot find name 'Basil'. + + ==== tests/cases/compiler/memberScope.ts (1 errors) ==== module Salt { export class Pepper {} export module Basil { } var z = Basil.Pepper; ~~~~~ -!!! Cannot find name 'Basil'. +!!! error TS2304: Cannot find name 'Basil'. } \ No newline at end of file diff --git a/tests/baselines/reference/memberVariableDeclarations1.types b/tests/baselines/reference/memberVariableDeclarations1.types index 10ec78d69dc..4dd68cdeb35 100644 --- a/tests/baselines/reference/memberVariableDeclarations1.types +++ b/tests/baselines/reference/memberVariableDeclarations1.types @@ -20,7 +20,7 @@ class Employee { public reports: Employee[] = []; >reports : Employee[] >Employee : Employee ->[] : Employee[] +>[] : undefined[] } class Employee2 { @@ -57,11 +57,11 @@ class Employee2 { >manager : Employee this.reports = []; ->this.reports = [] : Employee[] +>this.reports = [] : undefined[] >this.reports : Employee[] >this : Employee2 >reports : Employee[] ->[] : Employee[] +>[] : undefined[] } } diff --git a/tests/baselines/reference/mergedDeclarations2.errors.txt b/tests/baselines/reference/mergedDeclarations2.errors.txt index a7aad4319ea..0b3801872af 100644 --- a/tests/baselines/reference/mergedDeclarations2.errors.txt +++ b/tests/baselines/reference/mergedDeclarations2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/mergedDeclarations2.ts(9,20): error TS2304: Cannot find name 'b'. + + ==== tests/cases/compiler/mergedDeclarations2.ts (1 errors) ==== enum Foo { b @@ -9,5 +12,5 @@ module Foo { export var x = b ~ -!!! Cannot find name 'b'. +!!! error TS2304: Cannot find name 'b'. } \ No newline at end of file diff --git a/tests/baselines/reference/mergedDeclarations3.errors.txt b/tests/baselines/reference/mergedDeclarations3.errors.txt index 38922ad62f7..8478027913b 100644 --- a/tests/baselines/reference/mergedDeclarations3.errors.txt +++ b/tests/baselines/reference/mergedDeclarations3.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/mergedDeclarations3.ts(37,7): error TS2339: Property 'x' does not exist on type 'typeof foo'. +tests/cases/compiler/mergedDeclarations3.ts(39,7): error TS2339: Property 'z' does not exist on type 'typeof foo'. + + ==== tests/cases/compiler/mergedDeclarations3.ts (2 errors) ==== module M { export enum Color { @@ -37,8 +41,8 @@ M.foo() // ok M.foo.x // error ~ -!!! Property 'x' does not exist on type 'typeof foo'. +!!! error TS2339: Property 'x' does not exist on type 'typeof foo'. M.foo.y // ok M.foo.z // error ~ -!!! Property 'z' does not exist on type 'typeof foo'. \ No newline at end of file +!!! error TS2339: Property 'z' does not exist on type 'typeof foo'. \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt index cae2b5a7053..0b5984dcc6d 100644 --- a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt @@ -1,23 +1,35 @@ -==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts (3 errors) ==== +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(2,5): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(11,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(33,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2300: Duplicate identifier 'x'. + + +==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts (6 errors) ==== interface A { x: string; // error + ~ +!!! error TS2300: Duplicate identifier 'x'. } interface A { x: number; ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } module M { interface A { x: T; + ~ +!!! error TS2300: Duplicate identifier 'x'. } interface A { x: number; // error ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } } @@ -36,6 +48,8 @@ module M3 { export interface A { x: T; + ~ +!!! error TS2300: Duplicate identifier 'x'. } } @@ -43,6 +57,6 @@ export interface A { x: number; // error ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } } \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt index 6c2dd7b657e..d0a50f4ae69 100644 --- a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt @@ -1,23 +1,35 @@ -==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts (3 errors) ==== +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(2,5): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(6,5): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(11,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(15,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(33,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(39,9): error TS2300: Duplicate identifier 'x'. + + +==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts (6 errors) ==== interface A { x: string; // error + ~ +!!! error TS2300: Duplicate identifier 'x'. } interface A { x: string; // error ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } module M { interface A { x: T; + ~ +!!! error TS2300: Duplicate identifier 'x'. } interface A { x: T; // error ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } } @@ -36,6 +48,8 @@ module M3 { export interface A { x: T; + ~ +!!! error TS2300: Duplicate identifier 'x'. } } @@ -43,6 +57,6 @@ export interface A { x: T; // error ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. } } \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithIndexers2.errors.txt b/tests/baselines/reference/mergedInterfacesWithIndexers2.errors.txt index 89209f1a4dd..768abc0f9c0 100644 --- a/tests/baselines/reference/mergedInterfacesWithIndexers2.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithIndexers2.errors.txt @@ -1,10 +1,15 @@ +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithIndexers2.ts(4,5): error TS2413: Numeric index type 'string' is not assignable to string index type '{ length: string; }'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithIndexers2.ts(14,5): error TS2411: Property ''a'' of type 'number' is not assignable to string index type '{ length: number; }'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithIndexers2.ts(20,5): error TS2412: Property '1' of type '{ length: number; }' is not assignable to numeric index type 'string'. + + ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithIndexers2.ts (3 errors) ==== // indexers should behave like other members when merging interface declarations interface A { [x: number]: string; // error ~~~~~~~~~~~~~~~~~~~~ -!!! Numeric index type 'string' is not assignable to string index type '{ length: string; }'. +!!! error TS2413: Numeric index type 'string' is not assignable to string index type '{ length: string; }'. } @@ -16,7 +21,7 @@ [x: number]: string; 'a': number; //error ~~~~~~~~~~~~ -!!! Property ''a'' of type 'number' is not assignable to string index type '{ length: number; }'. +!!! error TS2411: Property ''a'' of type 'number' is not assignable to string index type '{ length: number; }'. } @@ -24,6 +29,6 @@ [x: string]: { length: number }; 1: { length: number }; // error ~~~~~~~~~~~~~~~~~~~~~~ -!!! Property '1' of type '{ length: number; }' is not assignable to numeric index type 'string'. +!!! error TS2412: Property '1' of type '{ length: number; }' is not assignable to numeric index type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt index 3ad843c7f17..f1ee1f383bf 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt @@ -1,3 +1,10 @@ +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(13,7): error TS2421: Class 'D' incorrectly implements interface 'A': + Types have separate declarations of a private property 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(19,7): error TS2421: Class 'E' incorrectly implements interface 'A': + Property 'x' is private in type 'A' but not in type 'E'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(26,9): error TS2341: Property 'x' is private and only accessible within class 'C'. + + ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts (3 errors) ==== class C { private x: number; @@ -13,8 +20,8 @@ class D implements A { // error ~ -!!! Class 'D' incorrectly implements interface 'A': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'D' incorrectly implements interface 'A': +!!! error TS2421: Types have separate declarations of a private property 'x'. private x: number; y: string; z: string; @@ -22,8 +29,8 @@ class E implements A { // error ~ -!!! Class 'E' incorrectly implements interface 'A': -!!! Private property 'x' cannot be reimplemented. +!!! error TS2421: Class 'E' incorrectly implements interface 'A': +!!! error TS2421: Property 'x' is private in type 'A' but not in type 'E'. x: number; y: string; z: string; @@ -32,4 +39,4 @@ var a: A; var r = a.x; // error ~~~ -!!! Property 'C.x' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt index 7ab40587207..0ca3b4c3aa2 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(17,7): error TS2421: Class 'D' incorrectly implements interface 'A': + Types have separate declarations of a private property 'w'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(23,7): error TS2416: Class 'E' incorrectly extends base class 'C2': + Property 'w' is private in type 'C2' but not in type 'E'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(23,7): error TS2421: Class 'E' incorrectly implements interface 'A': + Property 'x' is missing in type 'E'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(30,9): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(31,10): error TS2341: Property 'w' is private and only accessible within class 'C2'. + + ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts (5 errors) ==== class C { private x: number; @@ -17,8 +27,8 @@ class D extends C implements A { // error ~ -!!! Class 'D' incorrectly implements interface 'A': -!!! Private property 'w' cannot be reimplemented. +!!! error TS2421: Class 'D' incorrectly implements interface 'A': +!!! error TS2421: Types have separate declarations of a private property 'w'. private w: number; y: string; z: string; @@ -26,11 +36,11 @@ class E extends C2 implements A { // error ~ -!!! Class 'E' incorrectly extends base class 'C2': -!!! Private property 'w' cannot be reimplemented. +!!! error TS2416: Class 'E' incorrectly extends base class 'C2': +!!! error TS2416: Property 'w' is private in type 'C2' but not in type 'E'. ~ -!!! Class 'E' incorrectly implements interface 'A': -!!! Property 'x' is missing in type 'E'. +!!! error TS2421: Class 'E' incorrectly implements interface 'A': +!!! error TS2421: Property 'x' is missing in type 'E'. w: number; y: string; z: string; @@ -39,7 +49,7 @@ var a: A; var r = a.x; // error ~~~ -!!! Property 'C.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. var r2 = a.w; // error ~~~ -!!! Property 'C2.w' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'w' is private and only accessible within class 'C2'. \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt index 9956bb45dc8..0fadcfde588 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2': + Named properties 'x' of types 'C' and 'C2' are not identical. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(31,15): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2': + Named properties 'x' of types 'C' and 'C2' are not identical. + + ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts (2 errors) ==== class C { private x: number; @@ -9,8 +15,8 @@ interface A extends C { // error ~ -!!! Interface 'A' cannot simultaneously extend types 'C' and 'C2': -!!! Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2': +!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. y: string; } @@ -34,8 +40,8 @@ interface A extends C { // error, privates conflict ~ -!!! Interface 'A' cannot simultaneously extend types 'C' and 'C2': -!!! Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2': +!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. y: string; } diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt b/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt index 76f837f8369..3687a0b79e8 100644 --- a/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts(19,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C': + Named properties 'a' of types 'C' and 'C' are not identical. + + ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts (1 errors) ==== // merged interfaces behave as if all extends clauses from each declaration are merged together @@ -19,8 +23,8 @@ interface A extends C, C3 { // error ~ -!!! Interface 'A' cannot simultaneously extend types 'C' and 'C': -!!! Named properties 'a' of types 'C' and 'C' are not identical. +!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C': +!!! error TS2320: Named properties 'a' of types 'C' and 'C' are not identical. y: T; } diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt b/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt index 3cf329d427c..25000ce2f5c 100644 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/mergedModuleDeclarationCodeGen.ts(1,15): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/compiler/mergedModuleDeclarationCodeGen.ts (1 errors) ==== export module X { ~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. export module Y { class A { constructor(Y: any) { diff --git a/tests/baselines/reference/methodSignaturesWithOverloads.errors.txt b/tests/baselines/reference/methodSignaturesWithOverloads.errors.txt index f41e12db995..57b70489415 100644 --- a/tests/baselines/reference/methodSignaturesWithOverloads.errors.txt +++ b/tests/baselines/reference/methodSignaturesWithOverloads.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/methodSignaturesWithOverloads.ts(5,5): error TS2386: Overload signatures must all be optional or required. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/methodSignaturesWithOverloads.ts(14,5): error TS2386: Overload signatures must all be optional or required. + + ==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/methodSignaturesWithOverloads.ts (2 errors) ==== // Object type literals permit overloads with optionality but they must match @@ -5,7 +9,7 @@ func4?(x: number): number; func4(s: string): string; // error, mismatched optionality ~~~~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. func5?: { (x: number): number; (s: string): string; @@ -16,7 +20,7 @@ func4(x: T): number; func4? (s: T): string; // error, mismatched optionality ~~~~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. func5?: { (x: T): number; (s: T): string; diff --git a/tests/baselines/reference/mismatchedClassConstructorVariable.errors.txt b/tests/baselines/reference/mismatchedClassConstructorVariable.errors.txt index 450717d5124..8c81f7e34c8 100644 --- a/tests/baselines/reference/mismatchedClassConstructorVariable.errors.txt +++ b/tests/baselines/reference/mismatchedClassConstructorVariable.errors.txt @@ -1,6 +1,12 @@ -==== tests/cases/compiler/mismatchedClassConstructorVariable.ts (1 errors) ==== +tests/cases/compiler/mismatchedClassConstructorVariable.ts(1,5): error TS2300: Duplicate identifier 'baz'. +tests/cases/compiler/mismatchedClassConstructorVariable.ts(2,7): error TS2300: Duplicate identifier 'baz'. + + +==== tests/cases/compiler/mismatchedClassConstructorVariable.ts (2 errors) ==== var baz: foo; + ~~~ +!!! error TS2300: Duplicate identifier 'baz'. class baz { } ~~~ -!!! Duplicate identifier 'baz'. +!!! error TS2300: Duplicate identifier 'baz'. class foo { } \ No newline at end of file diff --git a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt index 6e2647bc45d..ed4f45ec1de 100644 --- a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt +++ b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type 'Array' is not assignable to parameter of type 'number[]'. + Type 'string | number' is not assignable to type 'number': + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts (2 errors) ==== function map(xs: T[], f: (x: T) => U) { var ys: U[] = []; @@ -10,9 +16,10 @@ var r6 = map([1, ""], (x) => x.toString()); var r7 = map([1, ""], (x) => x.toString()); // error ~~~~~~~ -!!! Argument of type '{}[]' is not assignable to parameter of type 'number[]'. -!!! Type '{}' is not assignable to type 'number'. +!!! error TS2345: Argument of type 'Array' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'string | number' is not assignable to type 'number': +!!! error TS2345: Type 'string' is not assignable to type 'number'. var r7b = map([1, ""], (x) => x.toString()); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. var r8 = map([1, ""], (x) => x.toString()); \ No newline at end of file diff --git a/tests/baselines/reference/missingRequiredDeclare.d.errors.txt b/tests/baselines/reference/missingRequiredDeclare.d.errors.txt index 932512ba8d8..dc713c86d89 100644 --- a/tests/baselines/reference/missingRequiredDeclare.d.errors.txt +++ b/tests/baselines/reference/missingRequiredDeclare.d.errors.txt @@ -1,6 +1,10 @@ +tests/cases/compiler/missingRequiredDeclare.d.ts(1,1): error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file. +tests/cases/compiler/missingRequiredDeclare.d.ts(1,7): error TS1039: Initializers are not allowed in ambient contexts. + + ==== tests/cases/compiler/missingRequiredDeclare.d.ts (2 errors) ==== var x = 1; ~~~ -!!! A 'declare' modifier is required for a top level declaration in a .d.ts file. +!!! error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file. ~ -!!! Initializers are not allowed in ambient contexts. \ No newline at end of file +!!! error TS1039: Initializers are not allowed in ambient contexts. \ No newline at end of file diff --git a/tests/baselines/reference/missingReturnStatement.errors.txt b/tests/baselines/reference/missingReturnStatement.errors.txt index 9a92adf4c03..c7cedd793de 100644 --- a/tests/baselines/reference/missingReturnStatement.errors.txt +++ b/tests/baselines/reference/missingReturnStatement.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/missingReturnStatement.ts(3,22): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. + + ==== tests/cases/compiler/missingReturnStatement.ts (1 errors) ==== module Test { export class Bug { public foo():string { ~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. } } } diff --git a/tests/baselines/reference/missingReturnStatement1.errors.txt b/tests/baselines/reference/missingReturnStatement1.errors.txt index d1d47368bb1..de471f90ac4 100644 --- a/tests/baselines/reference/missingReturnStatement1.errors.txt +++ b/tests/baselines/reference/missingReturnStatement1.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/missingReturnStatement1.ts(2,12): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. + + ==== tests/cases/compiler/missingReturnStatement1.ts (1 errors) ==== class Foo { foo(): number { ~~~~~~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. //return 4; } } diff --git a/tests/baselines/reference/missingTypeArguments1.errors.txt b/tests/baselines/reference/missingTypeArguments1.errors.txt index 87bb648a751..c0e0f3e18bb 100644 --- a/tests/baselines/reference/missingTypeArguments1.errors.txt +++ b/tests/baselines/reference/missingTypeArguments1.errors.txt @@ -1,73 +1,85 @@ +tests/cases/compiler/missingTypeArguments1.ts(4,15): error TS2314: Generic type 'X' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments1.ts(9,26): error TS2314: Generic type 'X2' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments1.ts(14,9): error TS2314: Generic type 'X3' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments1.ts(19,11): error TS2314: Generic type 'X4' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments1.ts(24,9): error TS2314: Generic type 'X5' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments1.ts(29,15): error TS2314: Generic type 'Y' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments1.ts(34,26): error TS2314: Generic type 'Y' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments1.ts(39,9): error TS2314: Generic type 'Y' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments1.ts(44,11): error TS2314: Generic type 'Y' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments1.ts(49,9): error TS2314: Generic type 'Y' requires 1 type argument(s). + + ==== tests/cases/compiler/missingTypeArguments1.ts (10 errors) ==== interface I { } class Y {} class X { p1: () => X; ~ -!!! Generic type 'X' requires 1 type argument(s). +!!! error TS2314: Generic type 'X' requires 1 type argument(s). } var a: X; class X2 { p2: { [idx: number]: X2 } ~~ -!!! Generic type 'X2' requires 1 type argument(s). +!!! error TS2314: Generic type 'X2' requires 1 type argument(s). } var a2: X2; class X3 { p3: X3[] ~~ -!!! Generic type 'X3' requires 1 type argument(s). +!!! error TS2314: Generic type 'X3' requires 1 type argument(s). } var a3: X3; class X4 { p4: I ~~ -!!! Generic type 'X4' requires 1 type argument(s). +!!! error TS2314: Generic type 'X4' requires 1 type argument(s). } var a4: X4; class X5 { p5: X5 ~~ -!!! Generic type 'X5' requires 1 type argument(s). +!!! error TS2314: Generic type 'X5' requires 1 type argument(s). } var a5: X5; class X6 { p6: () => Y; ~ -!!! Generic type 'Y' requires 1 type argument(s). +!!! error TS2314: Generic type 'Y' requires 1 type argument(s). } var a6: X6; class X7 { p7: { [idx: number]: Y } ~ -!!! Generic type 'Y' requires 1 type argument(s). +!!! error TS2314: Generic type 'Y' requires 1 type argument(s). } var a7: X7; class X8 { p8: Y[] ~ -!!! Generic type 'Y' requires 1 type argument(s). +!!! error TS2314: Generic type 'Y' requires 1 type argument(s). } var a8: X8; class X9 { p9: I ~ -!!! Generic type 'Y' requires 1 type argument(s). +!!! error TS2314: Generic type 'Y' requires 1 type argument(s). } var a9: X9; class X10 { pa: Y ~ -!!! Generic type 'Y' requires 1 type argument(s). +!!! error TS2314: Generic type 'Y' requires 1 type argument(s). } var a10: X10; diff --git a/tests/baselines/reference/missingTypeArguments2.errors.txt b/tests/baselines/reference/missingTypeArguments2.errors.txt index 34daf27e841..0b51f40c1ed 100644 --- a/tests/baselines/reference/missingTypeArguments2.errors.txt +++ b/tests/baselines/reference/missingTypeArguments2.errors.txt @@ -1,15 +1,21 @@ +tests/cases/compiler/missingTypeArguments2.ts(3,14): error TS2314: Generic type 'A' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments2.ts(4,5): error TS2314: Generic type 'A' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments2.ts(5,10): error TS2314: Generic type 'A' requires 1 type argument(s). +tests/cases/compiler/missingTypeArguments2.ts(6,5): error TS2314: Generic type 'A' requires 1 type argument(s). + + ==== tests/cases/compiler/missingTypeArguments2.ts (4 errors) ==== class A { } var x: () => A; ~ -!!! Generic type 'A' requires 1 type argument(s). +!!! error TS2314: Generic type 'A' requires 1 type argument(s). (a: A) => { }; ~ -!!! Generic type 'A' requires 1 type argument(s). +!!! error TS2314: Generic type 'A' requires 1 type argument(s). var y: A; ~ -!!! Generic type 'A' requires 1 type argument(s). +!!! error TS2314: Generic type 'A' requires 1 type argument(s). (): A => null; ~ -!!! Generic type 'A' requires 1 type argument(s). \ No newline at end of file +!!! error TS2314: Generic type 'A' requires 1 type argument(s). \ No newline at end of file diff --git a/tests/baselines/reference/mixingStaticAndInstanceOverloads.errors.txt b/tests/baselines/reference/mixingStaticAndInstanceOverloads.errors.txt index 300d9d0309f..96000c73536 100644 --- a/tests/baselines/reference/mixingStaticAndInstanceOverloads.errors.txt +++ b/tests/baselines/reference/mixingStaticAndInstanceOverloads.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/mixingStaticAndInstanceOverloads.ts(5,12): error TS2388: Function overload must not be static. +tests/cases/compiler/mixingStaticAndInstanceOverloads.ts(11,5): error TS2387: Function overload must be static. +tests/cases/compiler/mixingStaticAndInstanceOverloads.ts(16,12): error TS2388: Function overload must not be static. +tests/cases/compiler/mixingStaticAndInstanceOverloads.ts(17,5): error TS2387: Function overload must be static. +tests/cases/compiler/mixingStaticAndInstanceOverloads.ts(22,5): error TS2387: Function overload must be static. +tests/cases/compiler/mixingStaticAndInstanceOverloads.ts(23,12): error TS2388: Function overload must not be static. + + ==== tests/cases/compiler/mixingStaticAndInstanceOverloads.ts (6 errors) ==== class C1 { // ERROR @@ -5,7 +13,7 @@ foo1(s: string); static foo1(a) { } ~~~~ -!!! Function overload must not be static. +!!! error TS2388: Function overload must not be static. } class C2 { // ERROR @@ -13,27 +21,27 @@ static foo2(s: string); foo2(a) { } ~~~~ -!!! Function overload must be static. +!!! error TS2387: Function overload must be static. } class C3 { // ERROR foo3(n: number); static foo3(s: string); ~~~~ -!!! Function overload must not be static. +!!! error TS2388: Function overload must not be static. foo3(a) { } ~~~~ -!!! Function overload must be static. +!!! error TS2387: Function overload must be static. } class C4 { // ERROR static foo4(n: number); foo4(s: string); ~~~~ -!!! Function overload must be static. +!!! error TS2387: Function overload must be static. static foo4(a) { } ~~~~ -!!! Function overload must not be static. +!!! error TS2388: Function overload must not be static. } class C5 { // OK diff --git a/tests/baselines/reference/moduleAndInterfaceSharingName2.errors.txt b/tests/baselines/reference/moduleAndInterfaceSharingName2.errors.txt index 32368edf110..f69ff4d5cca 100644 --- a/tests/baselines/reference/moduleAndInterfaceSharingName2.errors.txt +++ b/tests/baselines/reference/moduleAndInterfaceSharingName2.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/moduleAndInterfaceSharingName2.ts(8,9): error TS2315: Type 'Y' is not generic. + + ==== tests/cases/compiler/moduleAndInterfaceSharingName2.ts (1 errors) ==== module X { export module Y { @@ -8,4 +11,4 @@ var z: X.Y.Z = null; var z2: X.Y; ~~~~~~~~~~~ -!!! Type 'Y' is not generic. \ No newline at end of file +!!! error TS2315: Type 'Y' is not generic. \ No newline at end of file diff --git a/tests/baselines/reference/moduleAndInterfaceWithSameName.errors.txt b/tests/baselines/reference/moduleAndInterfaceWithSameName.errors.txt index 7f8ffb11a01..60f36b92093 100644 --- a/tests/baselines/reference/moduleAndInterfaceWithSameName.errors.txt +++ b/tests/baselines/reference/moduleAndInterfaceWithSameName.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/moduleAndInterfaceWithSameName.ts(21,15): error TS2339: Property 'Bar' does not exist on type 'typeof Foo2'. + + ==== tests/cases/compiler/moduleAndInterfaceWithSameName.ts (1 errors) ==== module Foo1 { export module Bar { @@ -21,7 +24,7 @@ var z2 = Foo2.Bar.y; // Error for using interface name as a value. ~~~ -!!! Property 'Bar' does not exist on type 'typeof Foo2'. +!!! error TS2339: Property 'Bar' does not exist on type 'typeof Foo2'. module Foo3 { export module Bar { diff --git a/tests/baselines/reference/moduleAsBaseType.errors.txt b/tests/baselines/reference/moduleAsBaseType.errors.txt index 942efd23811..ffa30ad0ab3 100644 --- a/tests/baselines/reference/moduleAsBaseType.errors.txt +++ b/tests/baselines/reference/moduleAsBaseType.errors.txt @@ -1,11 +1,16 @@ +tests/cases/compiler/moduleAsBaseType.ts(2,17): error TS2304: Cannot find name 'M'. +tests/cases/compiler/moduleAsBaseType.ts(3,21): error TS2304: Cannot find name 'M'. +tests/cases/compiler/moduleAsBaseType.ts(4,21): error TS2304: Cannot find name 'M'. + + ==== tests/cases/compiler/moduleAsBaseType.ts (3 errors) ==== module M {} class C extends M {} ~ -!!! Cannot find name 'M'. +!!! error TS2304: Cannot find name 'M'. interface I extends M { } ~ -!!! Cannot find name 'M'. +!!! error TS2304: Cannot find name 'M'. class C2 implements M { } ~ -!!! Cannot find name 'M'. \ No newline at end of file +!!! error TS2304: Cannot find name 'M'. \ No newline at end of file diff --git a/tests/baselines/reference/moduleAssignmentCompat1.errors.txt b/tests/baselines/reference/moduleAssignmentCompat1.errors.txt index b23e908c086..5b4fe8d3c7c 100644 --- a/tests/baselines/reference/moduleAssignmentCompat1.errors.txt +++ b/tests/baselines/reference/moduleAssignmentCompat1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/moduleAssignmentCompat1.ts(9,8): error TS2304: Cannot find name 'A'. +tests/cases/compiler/moduleAssignmentCompat1.ts(10,8): error TS2304: Cannot find name 'B'. + + ==== tests/cases/compiler/moduleAssignmentCompat1.ts (2 errors) ==== module A { export class C { } @@ -9,10 +13,10 @@ var a: A; ~ -!!! Cannot find name 'A'. +!!! error TS2304: Cannot find name 'A'. var b: B; ~ -!!! Cannot find name 'B'. +!!! error TS2304: Cannot find name 'B'. // no error a = b; diff --git a/tests/baselines/reference/moduleAssignmentCompat2.errors.txt b/tests/baselines/reference/moduleAssignmentCompat2.errors.txt index 9e6e1421685..5a14ff03ead 100644 --- a/tests/baselines/reference/moduleAssignmentCompat2.errors.txt +++ b/tests/baselines/reference/moduleAssignmentCompat2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/moduleAssignmentCompat2.ts(9,8): error TS2304: Cannot find name 'A'. +tests/cases/compiler/moduleAssignmentCompat2.ts(10,8): error TS2304: Cannot find name 'B'. + + ==== tests/cases/compiler/moduleAssignmentCompat2.ts (2 errors) ==== module A { export class C { } @@ -9,10 +13,10 @@ var a: A; ~ -!!! Cannot find name 'A'. +!!! error TS2304: Cannot find name 'A'. var b: B; ~ -!!! Cannot find name 'B'. +!!! error TS2304: Cannot find name 'B'. a = b; b = a; // error \ No newline at end of file diff --git a/tests/baselines/reference/moduleAssignmentCompat3.errors.txt b/tests/baselines/reference/moduleAssignmentCompat3.errors.txt index c7f5b293da9..656fad20a7e 100644 --- a/tests/baselines/reference/moduleAssignmentCompat3.errors.txt +++ b/tests/baselines/reference/moduleAssignmentCompat3.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/moduleAssignmentCompat3.ts(8,8): error TS2304: Cannot find name 'A'. +tests/cases/compiler/moduleAssignmentCompat3.ts(9,8): error TS2304: Cannot find name 'B'. + + ==== tests/cases/compiler/moduleAssignmentCompat3.ts (2 errors) ==== module A { export var x = 1; @@ -8,10 +12,10 @@ var a: A; ~ -!!! Cannot find name 'A'. +!!! error TS2304: Cannot find name 'A'. var b: B; ~ -!!! Cannot find name 'B'. +!!! error TS2304: Cannot find name 'B'. // both errors a = b; diff --git a/tests/baselines/reference/moduleAssignmentCompat4.errors.txt b/tests/baselines/reference/moduleAssignmentCompat4.errors.txt index 02b7b9531c8..7d6204b53e1 100644 --- a/tests/baselines/reference/moduleAssignmentCompat4.errors.txt +++ b/tests/baselines/reference/moduleAssignmentCompat4.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/moduleAssignmentCompat4.ts(12,8): error TS2304: Cannot find name 'A'. +tests/cases/compiler/moduleAssignmentCompat4.ts(13,8): error TS2304: Cannot find name 'B'. + + ==== tests/cases/compiler/moduleAssignmentCompat4.ts (2 errors) ==== module A { export module M { @@ -12,10 +16,10 @@ var a: A; ~ -!!! Cannot find name 'A'. +!!! error TS2304: Cannot find name 'A'. var b: B; ~ -!!! Cannot find name 'B'. +!!! error TS2304: Cannot find name 'B'. a = b; b = a; // error \ No newline at end of file diff --git a/tests/baselines/reference/moduleClassArrayCodeGenTest.errors.txt b/tests/baselines/reference/moduleClassArrayCodeGenTest.errors.txt index 583d88c0b8b..3e52f51445d 100644 --- a/tests/baselines/reference/moduleClassArrayCodeGenTest.errors.txt +++ b/tests/baselines/reference/moduleClassArrayCodeGenTest.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/moduleClassArrayCodeGenTest.ts(10,9): error TS2305: Module 'M' has no exported member 'B'. + + ==== tests/cases/compiler/moduleClassArrayCodeGenTest.ts (1 errors) ==== // Invalid code gen for Array of Module class @@ -10,4 +13,4 @@ var t: M.A[] = []; var t2: M.B[] = []; ~~~ -!!! Module 'M' has no exported member 'B'. \ No newline at end of file +!!! error TS2305: Module 'M' has no exported member 'B'. \ No newline at end of file diff --git a/tests/baselines/reference/moduleCrashBug1.errors.txt b/tests/baselines/reference/moduleCrashBug1.errors.txt index 8f25fce0c20..e50e2a1c3e6 100644 --- a/tests/baselines/reference/moduleCrashBug1.errors.txt +++ b/tests/baselines/reference/moduleCrashBug1.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/moduleCrashBug1.ts(18,9): error TS2304: Cannot find name '_modes'. + + ==== tests/cases/compiler/moduleCrashBug1.ts (1 errors) ==== module _modes { export interface IMode { @@ -18,7 +21,7 @@ var m : _modes; ~~~~~~ -!!! Cannot find name '_modes'. +!!! error TS2304: Cannot find name '_modes'. \ No newline at end of file diff --git a/tests/baselines/reference/moduleExports1.errors.txt b/tests/baselines/reference/moduleExports1.errors.txt index e890f149c7f..18b65654cea 100644 --- a/tests/baselines/reference/moduleExports1.errors.txt +++ b/tests/baselines/reference/moduleExports1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/moduleExports1.ts(13,6): error TS2304: Cannot find name 'module'. +tests/cases/compiler/moduleExports1.ts(13,22): error TS2304: Cannot find name 'module'. + + ==== tests/cases/compiler/moduleExports1.ts (2 errors) ==== export module TypeScript.Strasse.Street { export class Rue { @@ -13,6 +17,6 @@ if (!module.exports) module.exports = ""; ~~~~~~ -!!! Cannot find name 'module'. +!!! error TS2304: Cannot find name 'module'. ~~~~~~ -!!! Cannot find name 'module'. \ No newline at end of file +!!! error TS2304: Cannot find name 'module'. \ No newline at end of file diff --git a/tests/baselines/reference/moduleImport.errors.txt b/tests/baselines/reference/moduleImport.errors.txt index 9a4e57bdc06..95163ef119f 100644 --- a/tests/baselines/reference/moduleImport.errors.txt +++ b/tests/baselines/reference/moduleImport.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/moduleImport.ts(2,2): error TS2305: Module 'X' has no exported member 'Y'. + + ==== tests/cases/compiler/moduleImport.ts (1 errors) ==== module A.B.C { import XYZ = X.Y.Z; ~~~~~~~~~~~~~~~~~~~ -!!! Module 'X' has no exported member 'Y'. +!!! error TS2305: Module 'X' has no exported member 'Y'. export function ping(x: number) { if (x>0) XYZ.pong (x-1); } diff --git a/tests/baselines/reference/moduleInTypePosition1.errors.txt b/tests/baselines/reference/moduleInTypePosition1.errors.txt index 7941093c10c..a5b5076e172 100644 --- a/tests/baselines/reference/moduleInTypePosition1.errors.txt +++ b/tests/baselines/reference/moduleInTypePosition1.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/moduleInTypePosition1_1.ts(3,14): error TS2304: Cannot find name 'WinJS'. + + ==== tests/cases/compiler/moduleInTypePosition1_1.ts (1 errors) ==== /// import WinJS = require('moduleInTypePosition1_0'); var x = (w1: WinJS) => { }; ~~~~~ -!!! Cannot find name 'WinJS'. +!!! error TS2304: Cannot find name 'WinJS'. ==== tests/cases/compiler/moduleInTypePosition1_0.ts (0 errors) ==== export class Promise { diff --git a/tests/baselines/reference/moduleKeywordRepeatError.errors.txt b/tests/baselines/reference/moduleKeywordRepeatError.errors.txt index 33bb480291f..d3f5924e193 100644 --- a/tests/baselines/reference/moduleKeywordRepeatError.errors.txt +++ b/tests/baselines/reference/moduleKeywordRepeatError.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/moduleKeywordRepeatError.ts(3,15): error TS1005: ';' expected. +tests/cases/compiler/moduleKeywordRepeatError.ts(3,1): error TS2304: Cannot find name 'module'. + + ==== tests/cases/compiler/moduleKeywordRepeatError.ts (2 errors) ==== // "module.module { }" should raise a syntax error module.module { } ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~ -!!! Cannot find name 'module'. \ No newline at end of file +!!! error TS2304: Cannot find name 'module'. \ No newline at end of file diff --git a/tests/baselines/reference/moduleNewExportBug.errors.txt b/tests/baselines/reference/moduleNewExportBug.errors.txt index dd89b135bdd..829fe83ae7b 100644 --- a/tests/baselines/reference/moduleNewExportBug.errors.txt +++ b/tests/baselines/reference/moduleNewExportBug.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/moduleNewExportBug.ts(10,9): error TS2305: Module 'mod1' has no exported member 'C'. + + ==== tests/cases/compiler/moduleNewExportBug.ts (1 errors) ==== module mod1 { interface mInt { @@ -10,7 +13,7 @@ var c : mod1.C; // ERROR: C should not be visible ~~~~~~ -!!! Module 'mod1' has no exported member 'C'. +!!! error TS2305: Module 'mod1' has no exported member 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/moduleProperty1.errors.txt b/tests/baselines/reference/moduleProperty1.errors.txt index 00ff0248b3f..65180c1d64b 100644 --- a/tests/baselines/reference/moduleProperty1.errors.txt +++ b/tests/baselines/reference/moduleProperty1.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/moduleProperty1.ts(9,5): error TS1128: Declaration or statement expected. +tests/cases/compiler/moduleProperty1.ts(9,13): error TS2304: Cannot find name 'y'. +tests/cases/compiler/moduleProperty1.ts(10,20): error TS2304: Cannot find name 'y'. + + ==== tests/cases/compiler/moduleProperty1.ts (3 errors) ==== module M { var x=10; // variable local to this module body @@ -9,10 +14,10 @@ var x = 10; // variable local to this module body private y = x; // can't use private in modules ~~~~~~~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. ~ -!!! Cannot find name 'y'. +!!! error TS2304: Cannot find name 'y'. export var z = y; // property visible to any code ~ -!!! Cannot find name 'y'. +!!! error TS2304: Cannot find name 'y'. } \ No newline at end of file diff --git a/tests/baselines/reference/moduleProperty2.errors.txt b/tests/baselines/reference/moduleProperty2.errors.txt index 8b658f7692a..7bb1cce608b 100644 --- a/tests/baselines/reference/moduleProperty2.errors.txt +++ b/tests/baselines/reference/moduleProperty2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/moduleProperty2.ts(7,15): error TS2304: Cannot find name 'x'. +tests/cases/compiler/moduleProperty2.ts(12,17): error TS2339: Property 'y' does not exist on type 'typeof M'. + + ==== tests/cases/compiler/moduleProperty2.ts (2 errors) ==== module M { function f() { @@ -7,13 +11,13 @@ export var z; var test1=x; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. var test2=y; // y visible because same module } module N { var test3=M.y; // nope y private property of M ~ -!!! Property 'y' does not exist on type 'typeof M'. +!!! error TS2339: Property 'y' does not exist on type 'typeof M'. var test4=M.z; // ok public property of M } \ No newline at end of file diff --git a/tests/baselines/reference/moduleScoping.errors.txt b/tests/baselines/reference/moduleScoping.errors.txt index d80f82e9443..1468d3e33bf 100644 --- a/tests/baselines/reference/moduleScoping.errors.txt +++ b/tests/baselines/reference/moduleScoping.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/externalModules/file3.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/conformance/externalModules/file1.ts (0 errors) ==== var v1 = "sausages"; // Global scope @@ -8,7 +11,7 @@ ==== tests/cases/conformance/externalModules/file3.ts (1 errors) ==== export var v3 = true; ~~~~~~~~~~~~~~~~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. var v2 = [1,2,3]; // Module scope. Should not appear in global scope ==== tests/cases/conformance/externalModules/file4.ts (0 errors) ==== diff --git a/tests/baselines/reference/moduleVisibilityTest2.errors.txt b/tests/baselines/reference/moduleVisibilityTest2.errors.txt index bed0b43505b..9620b48cdfb 100644 --- a/tests/baselines/reference/moduleVisibilityTest2.errors.txt +++ b/tests/baselines/reference/moduleVisibilityTest2.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/moduleVisibilityTest2.ts(57,17): error TS2304: Cannot find name 'x'. +tests/cases/compiler/moduleVisibilityTest2.ts(58,21): error TS2339: Property 'E' does not exist on type 'typeof M'. +tests/cases/compiler/moduleVisibilityTest2.ts(61,14): error TS2305: Module 'M' has no exported member 'I'. +tests/cases/compiler/moduleVisibilityTest2.ts(61,21): error TS2305: Module 'M' has no exported member 'I'. +tests/cases/compiler/moduleVisibilityTest2.ts(64,11): error TS2339: Property 'x' does not exist on type 'typeof M'. +tests/cases/compiler/moduleVisibilityTest2.ts(65,15): error TS2339: Property 'E' does not exist on type 'typeof M'. + + ==== tests/cases/compiler/moduleVisibilityTest2.ts (6 errors) ==== @@ -57,25 +65,25 @@ module M { export var c = x; ~ -!!! Cannot find name 'x'. +!!! error TS2304: Cannot find name 'x'. export var meb = M.E.B; ~ -!!! Property 'E' does not exist on type 'typeof M'. +!!! error TS2339: Property 'E' does not exist on type 'typeof M'. } var cprime : M.I = null; ~~~ -!!! Module 'M' has no exported member 'I'. +!!! error TS2305: Module 'M' has no exported member 'I'. ~~~ -!!! Module 'M' has no exported member 'I'. +!!! error TS2305: Module 'M' has no exported member 'I'. var c = new M.C(); var z = M.x; ~ -!!! Property 'x' does not exist on type 'typeof M'. +!!! error TS2339: Property 'x' does not exist on type 'typeof M'. var alpha = M.E.A; ~ -!!! Property 'E' does not exist on type 'typeof M'. +!!! error TS2339: Property 'E' does not exist on type 'typeof M'. var omega = M.exported_var; c.someMethodThatCallsAnOuterMethod(); \ No newline at end of file diff --git a/tests/baselines/reference/moduleVisibilityTest3.errors.txt b/tests/baselines/reference/moduleVisibilityTest3.errors.txt index d13c597d6ce..581d96fc1df 100644 --- a/tests/baselines/reference/moduleVisibilityTest3.errors.txt +++ b/tests/baselines/reference/moduleVisibilityTest3.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/moduleVisibilityTest3.ts(20,22): error TS2304: Cannot find name 'modes'. +tests/cases/compiler/moduleVisibilityTest3.ts(20,33): error TS2305: Module '_modes' has no exported member 'Mode'. +tests/cases/compiler/moduleVisibilityTest3.ts(21,16): error TS2305: Module '_modes' has no exported member 'Mode'. + + ==== tests/cases/compiler/moduleVisibilityTest3.ts (3 errors) ==== module _modes { export interface IMode { @@ -20,12 +25,12 @@ class Bug { constructor(p1: modes, p2: modes.Mode) {// should be an error on p2 - it's not exported ~~~~~ -!!! Cannot find name 'modes'. +!!! error TS2304: Cannot find name 'modes'. ~~~~~~~~~~ -!!! Module '_modes' has no exported member 'Mode'. +!!! error TS2305: Module '_modes' has no exported member 'Mode'. var x:modes.Mode; ~~~~~~~~~~ -!!! Module '_modes' has no exported member 'Mode'. +!!! error TS2305: Module '_modes' has no exported member 'Mode'. } } diff --git a/tests/baselines/reference/moduleWithNoValuesAsType.errors.txt b/tests/baselines/reference/moduleWithNoValuesAsType.errors.txt index e22bdb1c7f2..c387f5d62f4 100644 --- a/tests/baselines/reference/moduleWithNoValuesAsType.errors.txt +++ b/tests/baselines/reference/moduleWithNoValuesAsType.errors.txt @@ -1,15 +1,20 @@ +tests/cases/compiler/moduleWithNoValuesAsType.ts(2,8): error TS2304: Cannot find name 'A'. +tests/cases/compiler/moduleWithNoValuesAsType.ts(7,8): error TS2304: Cannot find name 'B'. +tests/cases/compiler/moduleWithNoValuesAsType.ts(15,8): error TS2304: Cannot find name 'C'. + + ==== tests/cases/compiler/moduleWithNoValuesAsType.ts (3 errors) ==== module A { } var a: A; // error ~ -!!! Cannot find name 'A'. +!!! error TS2304: Cannot find name 'A'. module B { interface I {} } var b: B; // error ~ -!!! Cannot find name 'B'. +!!! error TS2304: Cannot find name 'B'. module C { module M { @@ -19,4 +24,4 @@ var c: C; // error ~ -!!! Cannot find name 'C'. \ No newline at end of file +!!! error TS2304: Cannot find name 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/moduleWithValuesAsType.errors.txt b/tests/baselines/reference/moduleWithValuesAsType.errors.txt index cf496f76627..2bbb94f5076 100644 --- a/tests/baselines/reference/moduleWithValuesAsType.errors.txt +++ b/tests/baselines/reference/moduleWithValuesAsType.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/moduleWithValuesAsType.ts(5,8): error TS2304: Cannot find name 'A'. + + ==== tests/cases/compiler/moduleWithValuesAsType.ts (1 errors) ==== module A { var b = 1; @@ -5,4 +8,4 @@ var a: A; // no error ~ -!!! Cannot find name 'A'. \ No newline at end of file +!!! error TS2304: Cannot find name 'A'. \ No newline at end of file diff --git a/tests/baselines/reference/module_augmentExistingAmbientVariable.errors.txt b/tests/baselines/reference/module_augmentExistingAmbientVariable.errors.txt index c2abe8fc6b9..564da071648 100644 --- a/tests/baselines/reference/module_augmentExistingAmbientVariable.errors.txt +++ b/tests/baselines/reference/module_augmentExistingAmbientVariable.errors.txt @@ -1,8 +1,14 @@ -==== tests/cases/compiler/module_augmentExistingAmbientVariable.ts (1 errors) ==== +tests/cases/compiler/module_augmentExistingAmbientVariable.ts(1,13): error TS2300: Duplicate identifier 'console'. +tests/cases/compiler/module_augmentExistingAmbientVariable.ts(3,8): error TS2300: Duplicate identifier 'console'. + + +==== tests/cases/compiler/module_augmentExistingAmbientVariable.ts (2 errors) ==== declare var console: any; + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'console'. module console { ~~~~~~~ -!!! Duplicate identifier 'console'. +!!! error TS2300: Duplicate identifier 'console'. export var x = 2; } \ No newline at end of file diff --git a/tests/baselines/reference/module_augmentExistingVariable.errors.txt b/tests/baselines/reference/module_augmentExistingVariable.errors.txt index 25bd8b843fa..f1d17894077 100644 --- a/tests/baselines/reference/module_augmentExistingVariable.errors.txt +++ b/tests/baselines/reference/module_augmentExistingVariable.errors.txt @@ -1,8 +1,14 @@ -==== tests/cases/compiler/module_augmentExistingVariable.ts (1 errors) ==== +tests/cases/compiler/module_augmentExistingVariable.ts(1,5): error TS2300: Duplicate identifier 'console'. +tests/cases/compiler/module_augmentExistingVariable.ts(3,8): error TS2300: Duplicate identifier 'console'. + + +==== tests/cases/compiler/module_augmentExistingVariable.ts (2 errors) ==== var console: any; + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'console'. module console { ~~~~~~~ -!!! Duplicate identifier 'console'. +!!! error TS2300: Duplicate identifier 'console'. export var x = 2; } \ No newline at end of file diff --git a/tests/baselines/reference/moduledecl.errors.txt b/tests/baselines/reference/moduledecl.errors.txt index 927f143183e..2ef60f058c2 100644 --- a/tests/baselines/reference/moduledecl.errors.txt +++ b/tests/baselines/reference/moduledecl.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/moduledecl.ts(164,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/moduledecl.ts(172,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/moduledecl.ts (2 errors) ==== module a { } @@ -164,7 +168,7 @@ } private get c2() { ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return new C2_private(); } public getC1_public() { @@ -174,7 +178,7 @@ } public get c1() { ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return new C1_public(); } } diff --git a/tests/baselines/reference/multiExtendsSplitInterfaces1.errors.txt b/tests/baselines/reference/multiExtendsSplitInterfaces1.errors.txt index b412d2ea448..bc7f41ad0c7 100644 --- a/tests/baselines/reference/multiExtendsSplitInterfaces1.errors.txt +++ b/tests/baselines/reference/multiExtendsSplitInterfaces1.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/multiExtendsSplitInterfaces1.ts(1,1): error TS2304: Cannot find name 'self'. + + ==== tests/cases/compiler/multiExtendsSplitInterfaces1.ts (1 errors) ==== self.cancelAnimationFrame(0); ~~~~ -!!! Cannot find name 'self'. \ No newline at end of file +!!! error TS2304: Cannot find name 'self'. \ No newline at end of file diff --git a/tests/baselines/reference/multiLineErrors.errors.txt b/tests/baselines/reference/multiLineErrors.errors.txt index 911c07731e3..1f28f758c38 100644 --- a/tests/baselines/reference/multiLineErrors.errors.txt +++ b/tests/baselines/reference/multiLineErrors.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/multiLineErrors.ts(3,22): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +tests/cases/compiler/multiLineErrors.ts(21,1): error TS2322: Type 'A2' is not assignable to type 'A1': + Types of property 'x' are incompatible: + Type '{ y: string; }' is not assignable to type '{ y: number; }': + Types of property 'y' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/multiLineErrors.ts (2 errors) ==== var t = 32; @@ -9,7 +17,7 @@ ~~~~~~~~~~~~~~ } ~ -!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. { var x = 4; var y = 10; @@ -26,9 +34,9 @@ var t2: A2; t1 = t2; ~~ -!!! Type 'A2' is not assignable to type 'A1': -!!! Types of property 'x' are incompatible: -!!! Type '{ y: string; }' is not assignable to type '{ y: number; }': -!!! Types of property 'y' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'A2' is not assignable to type 'A1': +!!! error TS2322: Types of property 'x' are incompatible: +!!! error TS2322: Type '{ y: string; }' is not assignable to type '{ y: number; }': +!!! error TS2322: Types of property 'y' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt index 533cb8f2da6..d815861d7fb 100644 --- a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt +++ b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts(6,11): error TS2320: Interface 'C' cannot simultaneously extend types 'A' and 'A': + Named properties 'x' of types 'A' and 'A' are not identical. + + ==== tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts (1 errors) ==== interface A { @@ -6,6 +10,6 @@ interface C extends A, A { } ~ -!!! Interface 'C' cannot simultaneously extend types 'A' and 'A': -!!! Named properties 'x' of types 'A' and 'A' are not identical. +!!! error TS2320: Interface 'C' cannot simultaneously extend types 'A' and 'A': +!!! error TS2320: Named properties 'x' of types 'A' and 'A' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/multipleClassPropertyModifiers.errors.txt b/tests/baselines/reference/multipleClassPropertyModifiers.errors.txt index 09c39bdbcca..95a4d0c16c8 100644 --- a/tests/baselines/reference/multipleClassPropertyModifiers.errors.txt +++ b/tests/baselines/reference/multipleClassPropertyModifiers.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/multipleClassPropertyModifiers.ts(3,12): error TS1029: 'public' modifier must precede 'static' modifier. +tests/cases/compiler/multipleClassPropertyModifiers.ts(5,12): error TS1029: 'private' modifier must precede 'static' modifier. + + ==== tests/cases/compiler/multipleClassPropertyModifiers.ts (2 errors) ==== class C { public static p1; static public p2; ~~~~~~ -!!! 'public' modifier must precede 'static' modifier. +!!! error TS1029: 'public' modifier must precede 'static' modifier. private static p3; static private p4; ~~~~~~~ -!!! 'private' modifier must precede 'static' modifier. +!!! error TS1029: 'private' modifier must precede 'static' modifier. } \ No newline at end of file diff --git a/tests/baselines/reference/multipleClassPropertyModifiersErrors.errors.txt b/tests/baselines/reference/multipleClassPropertyModifiersErrors.errors.txt index dd5e4af8031..7705d40e1c8 100644 --- a/tests/baselines/reference/multipleClassPropertyModifiersErrors.errors.txt +++ b/tests/baselines/reference/multipleClassPropertyModifiersErrors.errors.txt @@ -1,20 +1,27 @@ +tests/cases/compiler/multipleClassPropertyModifiersErrors.ts(2,9): error TS1028: Accessibility modifier already seen. +tests/cases/compiler/multipleClassPropertyModifiersErrors.ts(3,10): error TS1028: Accessibility modifier already seen. +tests/cases/compiler/multipleClassPropertyModifiersErrors.ts(4,9): error TS1030: 'static' modifier already seen. +tests/cases/compiler/multipleClassPropertyModifiersErrors.ts(5,9): error TS1028: Accessibility modifier already seen. +tests/cases/compiler/multipleClassPropertyModifiersErrors.ts(6,10): error TS1028: Accessibility modifier already seen. + + ==== tests/cases/compiler/multipleClassPropertyModifiersErrors.ts (5 errors) ==== class C { public public p1; ~~~~~~ -!!! Accessibility modifier already seen. +!!! error TS1028: Accessibility modifier already seen. private private p2; ~~~~~~~ -!!! Accessibility modifier already seen. +!!! error TS1028: Accessibility modifier already seen. static static p3; ~~~~~~ -!!! 'static' modifier already seen. +!!! error TS1030: 'static' modifier already seen. public private p4; ~~~~~~~ -!!! Accessibility modifier already seen. +!!! error TS1028: Accessibility modifier already seen. private public p5; ~~~~~~ -!!! Accessibility modifier already seen. +!!! error TS1028: Accessibility modifier already seen. public static p6; private static p7; } \ No newline at end of file diff --git a/tests/baselines/reference/multipleExportAssignments.errors.txt b/tests/baselines/reference/multipleExportAssignments.errors.txt index 5f23f30c3e7..d5af20073c7 100644 --- a/tests/baselines/reference/multipleExportAssignments.errors.txt +++ b/tests/baselines/reference/multipleExportAssignments.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/multipleExportAssignments.ts(13,1): error TS2308: A module cannot have more than one export assignment. +tests/cases/compiler/multipleExportAssignments.ts(14,1): error TS2308: A module cannot have more than one export assignment. + + ==== tests/cases/compiler/multipleExportAssignments.ts (2 errors) ==== interface connectModule { (res, req, next): void; @@ -13,9 +17,9 @@ }; export = server; ~~~~~~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. export = connectExport; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. \ No newline at end of file diff --git a/tests/baselines/reference/multipleExportAssignmentsInAmbientDeclaration.errors.txt b/tests/baselines/reference/multipleExportAssignmentsInAmbientDeclaration.errors.txt index 8ec47acbc68..c2475f0ff14 100644 --- a/tests/baselines/reference/multipleExportAssignmentsInAmbientDeclaration.errors.txt +++ b/tests/baselines/reference/multipleExportAssignmentsInAmbientDeclaration.errors.txt @@ -1,11 +1,15 @@ +tests/cases/compiler/multipleExportAssignmentsInAmbientDeclaration.ts(4,5): error TS2308: A module cannot have more than one export assignment. +tests/cases/compiler/multipleExportAssignmentsInAmbientDeclaration.ts(5,5): error TS2308: A module cannot have more than one export assignment. + + ==== tests/cases/compiler/multipleExportAssignmentsInAmbientDeclaration.ts (2 errors) ==== declare module "m1" { var a: number var b: number; export = a; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. export = b; ~~~~~~~~~~~ -!!! A module cannot have more than one export assignment. +!!! error TS2308: A module cannot have more than one export assignment. } \ No newline at end of file diff --git a/tests/baselines/reference/multipleInheritance.errors.txt b/tests/baselines/reference/multipleInheritance.errors.txt index cb3e360fcc6..b482e0a125e 100644 --- a/tests/baselines/reference/multipleInheritance.errors.txt +++ b/tests/baselines/reference/multipleInheritance.errors.txt @@ -1,3 +1,13 @@ +tests/cases/compiler/multipleInheritance.ts(9,19): error TS1005: '{' expected. +tests/cases/compiler/multipleInheritance.ts(9,24): error TS1005: ';' expected. +tests/cases/compiler/multipleInheritance.ts(18,19): error TS1005: '{' expected. +tests/cases/compiler/multipleInheritance.ts(18,24): error TS1005: ';' expected. +tests/cases/compiler/multipleInheritance.ts(34,7): error TS2416: Class 'Baad' incorrectly extends base class 'Good': + Types of property 'g' are incompatible: + Type '(n: number) => number' is not assignable to type '() => number'. +tests/cases/compiler/multipleInheritance.ts(35,12): error TS2425: Class 'Good' defines instance member property 'f', but extended class 'Baad' defines it as instance member function. + + ==== tests/cases/compiler/multipleInheritance.ts (6 errors) ==== class B1 { public x; @@ -9,9 +19,9 @@ class C extends B1, B2 { // duplicate member ~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. } class D1 extends B1 { @@ -22,9 +32,9 @@ class E extends D1, D2 { // nope, duplicate member ~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. } class N { @@ -42,12 +52,12 @@ class Baad extends Good { ~~~~ -!!! Class 'Baad' incorrectly extends base class 'Good': -!!! Types of property 'g' are incompatible: -!!! Type '(n: number) => number' is not assignable to type '() => number'. +!!! error TS2416: Class 'Baad' incorrectly extends base class 'Good': +!!! error TS2416: Types of property 'g' are incompatible: +!!! error TS2416: Type '(n: number) => number' is not assignable to type '() => number'. public f(): number { return 0; } ~ -!!! Class 'Good' defines instance member property 'f', but extended class 'Baad' defines it as instance member function. +!!! error TS2425: Class 'Good' defines instance member property 'f', but extended class 'Baad' defines it as instance member function. public g(n:number) { return 0; } } \ No newline at end of file diff --git a/tests/baselines/reference/multipleNumericIndexers.errors.txt b/tests/baselines/reference/multipleNumericIndexers.errors.txt index 5ee665a4703..856fdbe47ff 100644 --- a/tests/baselines/reference/multipleNumericIndexers.errors.txt +++ b/tests/baselines/reference/multipleNumericIndexers.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(5,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(10,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(15,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(20,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(25,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(28,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(29,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(30,5): error TS2375: Duplicate number index signature. + + ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts (8 errors) ==== // Multiple indexers of the same type are an error @@ -5,45 +15,45 @@ [x: number]: string; [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } interface I { [x: number]: string; [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } var a: { [x: number]: string; [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } var b: { [x: number]: string; [x: number]: string ~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } = { 1: '', "2": '' } class C2 { [x: number]: string; [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } interface I { ~ -!!! All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations of an interface must have identical type parameters. [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/multipleStringIndexers.errors.txt b/tests/baselines/reference/multipleStringIndexers.errors.txt index b6328f2edca..6aa4172476b 100644 --- a/tests/baselines/reference/multipleStringIndexers.errors.txt +++ b/tests/baselines/reference/multipleStringIndexers.errors.txt @@ -1,3 +1,11 @@ +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleStringIndexers.ts(5,5): error TS2374: Duplicate string index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleStringIndexers.ts(10,5): error TS2374: Duplicate string index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleStringIndexers.ts(15,5): error TS2374: Duplicate string index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleStringIndexers.ts(20,5): error TS2374: Duplicate string index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleStringIndexers.ts(25,5): error TS2374: Duplicate string index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleStringIndexers.ts(30,5): error TS2374: Duplicate string index signature. + + ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleStringIndexers.ts (6 errors) ==== // Multiple indexers of the same type are an error @@ -5,40 +13,40 @@ [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } interface I { [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } var a: { [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } var b: { [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } = { y: '' } class C2 { [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } interface I2 { [x: string]: string; [x: string]: string; ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate string index signature. +!!! error TS2374: Duplicate string index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/multivar.errors.txt b/tests/baselines/reference/multivar.errors.txt index 655a5f42e6d..931e61de5ae 100644 --- a/tests/baselines/reference/multivar.errors.txt +++ b/tests/baselines/reference/multivar.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/multivar.ts(6,19): error TS2395: Individual declarations in merged declaration b2 must be all exported or all local. +tests/cases/compiler/multivar.ts(22,9): error TS2395: Individual declarations in merged declaration b2 must be all exported or all local. + + ==== tests/cases/compiler/multivar.ts (2 errors) ==== var a,b,c; var x=1,y=2,z=3; @@ -6,7 +10,7 @@ export var a, b2: number = 10, b; ~~ -!!! Individual declarations in merged declaration b2 must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration b2 must be all exported or all local. var m1; var a2, b22: number = 10, b222; var m3; @@ -24,7 +28,7 @@ declare var d1, d2; var b2; ~~ -!!! Individual declarations in merged declaration b2 must be all exported or all local. +!!! error TS2395: Individual declarations in merged declaration b2 must be all exported or all local. declare var v1; } diff --git a/tests/baselines/reference/nameCollisions.errors.txt b/tests/baselines/reference/nameCollisions.errors.txt index f6ac8c0bd67..baa7c6cbfd5 100644 --- a/tests/baselines/reference/nameCollisions.errors.txt +++ b/tests/baselines/reference/nameCollisions.errors.txt @@ -1,25 +1,48 @@ -==== tests/cases/compiler/nameCollisions.ts (9 errors) ==== +tests/cases/compiler/nameCollisions.ts(2,9): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/nameCollisions.ts(4,12): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/nameCollisions.ts(10,12): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/nameCollisions.ts(13,9): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/nameCollisions.ts(15,12): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/nameCollisions.ts(24,9): error TS2300: Duplicate identifier 'f'. +tests/cases/compiler/nameCollisions.ts(25,14): error TS2300: Duplicate identifier 'f'. +tests/cases/compiler/nameCollisions.ts(27,14): error TS2300: Duplicate identifier 'f2'. +tests/cases/compiler/nameCollisions.ts(28,9): error TS2300: Duplicate identifier 'f2'. +tests/cases/compiler/nameCollisions.ts(33,11): error TS2300: Duplicate identifier 'C'. +tests/cases/compiler/nameCollisions.ts(34,14): error TS2300: Duplicate identifier 'C'. +tests/cases/compiler/nameCollisions.ts(36,14): error TS2300: Duplicate identifier 'C2'. +tests/cases/compiler/nameCollisions.ts(37,11): error TS2300: Duplicate identifier 'C2'. +tests/cases/compiler/nameCollisions.ts(42,11): error TS2300: Duplicate identifier 'cli'. +tests/cases/compiler/nameCollisions.ts(43,15): error TS2300: Duplicate identifier 'cli'. +tests/cases/compiler/nameCollisions.ts(45,15): error TS2300: Duplicate identifier 'cli2'. +tests/cases/compiler/nameCollisions.ts(46,11): error TS2300: Duplicate identifier 'cli2'. + + +==== tests/cases/compiler/nameCollisions.ts (17 errors) ==== module T { var x = 2; + ~ +!!! error TS2300: Duplicate identifier 'x'. module x { // error ~ -!!! Duplicate identifier 'x'. +!!! error TS2300: Duplicate identifier 'x'. export class Bar { test: number; } } module z { + ~ +!!! error TS2300: Duplicate identifier 'z'. var t; } var z; // error ~ -!!! Duplicate identifier 'z'. +!!! error TS2300: Duplicate identifier 'z'. module y { ~ -!!! A module declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged var b; } @@ -29,38 +52,50 @@ module w { } //ok var f; + ~ +!!! error TS2300: Duplicate identifier 'f'. function f() { } //error ~ -!!! Duplicate identifier 'f'. +!!! error TS2300: Duplicate identifier 'f'. function f2() { } + ~~ +!!! error TS2300: Duplicate identifier 'f2'. var f2; // error ~~ -!!! Duplicate identifier 'f2'. +!!! error TS2300: Duplicate identifier 'f2'. var i; interface i { } //ok class C { } + ~ +!!! error TS2300: Duplicate identifier 'C'. function C() { } // error ~ -!!! Duplicate identifier 'C'. +!!! error TS2300: Duplicate identifier 'C'. function C2() { } + ~~ +!!! error TS2300: Duplicate identifier 'C2'. class C2 { } // error ~~ -!!! Duplicate identifier 'C2'. +!!! error TS2300: Duplicate identifier 'C2'. function fi() { } interface fi { } // ok class cli { } + ~~~ +!!! error TS2300: Duplicate identifier 'cli'. interface cli { } // error ~~~ -!!! Duplicate identifier 'cli'. +!!! error TS2300: Duplicate identifier 'cli'. interface cli2 { } + ~~~~ +!!! error TS2300: Duplicate identifier 'cli2'. class cli2 { } // error ~~~~ -!!! Duplicate identifier 'cli2'. +!!! error TS2300: Duplicate identifier 'cli2'. } \ No newline at end of file diff --git a/tests/baselines/reference/nameWithFileExtension.errors.txt b/tests/baselines/reference/nameWithFileExtension.errors.txt index 154ed8047ff..ed4a1165e7e 100644 --- a/tests/baselines/reference/nameWithFileExtension.errors.txt +++ b/tests/baselines/reference/nameWithFileExtension.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/externalModules/foo_1.ts(1,22): error TS2307: Cannot find external module './foo_0.js'. + + ==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ==== import foo = require('./foo_0.js'); ~~~~~~~~~~~~ -!!! Cannot find external module './foo_0.js'. +!!! error TS2307: Cannot find external module './foo_0.js'. var x = foo.foo + 42; ==== tests/cases/conformance/externalModules/foo_0.ts (0 errors) ==== diff --git a/tests/baselines/reference/namedFunctionExpressionCallErrors.errors.txt b/tests/baselines/reference/namedFunctionExpressionCallErrors.errors.txt index 22be4433c13..c928b002a1f 100644 --- a/tests/baselines/reference/namedFunctionExpressionCallErrors.errors.txt +++ b/tests/baselines/reference/namedFunctionExpressionCallErrors.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/namedFunctionExpressionCallErrors.ts(5,1): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/namedFunctionExpressionCallErrors.ts(12,5): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/namedFunctionExpressionCallErrors.ts(16,1): error TS2304: Cannot find name 'bar'. + + ==== tests/cases/compiler/namedFunctionExpressionCallErrors.ts (3 errors) ==== var recurser = function foo() { }; @@ -5,7 +10,7 @@ // Error: foo should not be visible here foo(); ~~~ -!!! Cannot find name 'foo'. +!!! error TS2304: Cannot find name 'foo'. // recurser should be recurser(); @@ -14,10 +19,10 @@ // Error: foo should not be visible here either foo(); ~~~ -!!! Cannot find name 'foo'. +!!! error TS2304: Cannot find name 'foo'. }); // Error: bar should not be visible bar(); ~~~ -!!! Cannot find name 'bar'. \ No newline at end of file +!!! error TS2304: Cannot find name 'bar'. \ No newline at end of file diff --git a/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt b/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt index f8dc0aeb6d8..ac59b71bbc3 100644 --- a/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt @@ -1,33 +1,45 @@ +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(4,15): error TS1109: Expression expected. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(4,25): error TS1005: '=' expected. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(4,26): error TS1109: Expression expected. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(12,14): error TS1109: Expression expected. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(7,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(7,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(8,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(8,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(9,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(9,29): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts (10 errors) ==== // Unary operator - // operand before - var NUMBER1 = var NUMBER-; //expect error ~~~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~ -!!! '=' expected. +!!! error TS1005: '=' expected. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. // invalid expressions var NUMBER2 = -(null - undefined); ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var NUMBER3 = -(null - null); ~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var NUMBER4 = -(undefined - undefined); ~~~~~~~~~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. // miss operand var NUMBER =-; ~ -!!! Expression expected. \ No newline at end of file +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/negateOperatorWithAnyOtherType.types b/tests/baselines/reference/negateOperatorWithAnyOtherType.types index 8785ab073b2..85a2d9c9233 100644 --- a/tests/baselines/reference/negateOperatorWithAnyOtherType.types +++ b/tests/baselines/reference/negateOperatorWithAnyOtherType.types @@ -9,7 +9,7 @@ var ANY1; var ANY2: any[] = ["", ""]; >ANY2 : any[] ->["", ""] : any[] +>["", ""] : string[] var obj: () => {} >obj : () => {} diff --git a/tests/baselines/reference/negateOperatorWithEnumType.js b/tests/baselines/reference/negateOperatorWithEnumType.js index a3235a3ccc0..876bed45cc2 100644 --- a/tests/baselines/reference/negateOperatorWithEnumType.js +++ b/tests/baselines/reference/negateOperatorWithEnumType.js @@ -2,19 +2,19 @@ // - operator on enum type enum ENUM { }; -enum ENUM1 { 1, 2, "" }; +enum ENUM1 { A, B, "" }; // enum type var var ResultIsNumber1 = -ENUM; // expressions -var ResultIsNumber2 = -ENUM1[1]; -var ResultIsNumber3 = -(ENUM1[1] + ENUM1[2]); +var ResultIsNumber2 = -ENUM1["B"]; +var ResultIsNumber3 = -(ENUM1.B + ENUM1[""]); // miss assignment operators -ENUM; -ENUM1; --ENUM1[1]; +-ENUM1["B"]; -ENUM, ENUM1; //// [negateOperatorWithEnumType.js] @@ -25,18 +25,18 @@ var ENUM; ; var ENUM1; (function (ENUM1) { - ENUM1[ENUM1["1"] = 0] = "1"; - ENUM1[ENUM1["2"] = 1] = "2"; + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = {})); ; // enum type var var ResultIsNumber1 = -ENUM; // expressions -var ResultIsNumber2 = -ENUM1[1]; -var ResultIsNumber3 = -(ENUM1[1] + ENUM1[2]); +var ResultIsNumber2 = -ENUM1["B"]; +var ResultIsNumber3 = -(1 /* B */ + ENUM1[""]); // miss assignment operators -ENUM; -ENUM1; --ENUM1[1]; +-ENUM1["B"]; -ENUM, ENUM1; diff --git a/tests/baselines/reference/negateOperatorWithEnumType.types b/tests/baselines/reference/negateOperatorWithEnumType.types index b2e0cb91c51..96a33ff4c6e 100644 --- a/tests/baselines/reference/negateOperatorWithEnumType.types +++ b/tests/baselines/reference/negateOperatorWithEnumType.types @@ -4,8 +4,10 @@ enum ENUM { }; >ENUM : ENUM -enum ENUM1 { 1, 2, "" }; +enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 +>A : ENUM1 +>B : ENUM1 // enum type var var ResultIsNumber1 = -ENUM; @@ -14,20 +16,21 @@ var ResultIsNumber1 = -ENUM; >ENUM : typeof ENUM // expressions -var ResultIsNumber2 = -ENUM1[1]; +var ResultIsNumber2 = -ENUM1["B"]; >ResultIsNumber2 : number ->-ENUM1[1] : number ->ENUM1[1] : ENUM1 +>-ENUM1["B"] : number +>ENUM1["B"] : ENUM1 >ENUM1 : typeof ENUM1 -var ResultIsNumber3 = -(ENUM1[1] + ENUM1[2]); +var ResultIsNumber3 = -(ENUM1.B + ENUM1[""]); >ResultIsNumber3 : number ->-(ENUM1[1] + ENUM1[2]) : number ->(ENUM1[1] + ENUM1[2]) : number ->ENUM1[1] + ENUM1[2] : number ->ENUM1[1] : ENUM1 +>-(ENUM1.B + ENUM1[""]) : number +>(ENUM1.B + ENUM1[""]) : number +>ENUM1.B + ENUM1[""] : number +>ENUM1.B : ENUM1 >ENUM1 : typeof ENUM1 ->ENUM1[2] : ENUM1 +>B : ENUM1 +>ENUM1[""] : ENUM1 >ENUM1 : typeof ENUM1 // miss assignment operators @@ -39,9 +42,9 @@ var ResultIsNumber3 = -(ENUM1[1] + ENUM1[2]); >-ENUM1 : number >ENUM1 : typeof ENUM1 --ENUM1[1]; ->-ENUM1[1] : number ->ENUM1[1] : ENUM1 +-ENUM1["B"]; +>-ENUM1["B"] : number +>ENUM1["B"] : ENUM1 >ENUM1 : typeof ENUM1 -ENUM, ENUM1; diff --git a/tests/baselines/reference/nestedClassDeclaration.errors.txt b/tests/baselines/reference/nestedClassDeclaration.errors.txt index 1e64dad4968..f3145467231 100644 --- a/tests/baselines/reference/nestedClassDeclaration.errors.txt +++ b/tests/baselines/reference/nestedClassDeclaration.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/classes/nestedClassDeclaration.ts(5,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/conformance/classes/nestedClassDeclaration.ts(7,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/classes/nestedClassDeclaration.ts(10,5): error TS1129: Statement expected. +tests/cases/conformance/classes/nestedClassDeclaration.ts(12,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/classes/nestedClassDeclaration.ts(15,11): error TS1005: ':' expected. +tests/cases/conformance/classes/nestedClassDeclaration.ts(15,14): error TS1005: ',' expected. +tests/cases/conformance/classes/nestedClassDeclaration.ts(17,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/classes/nestedClassDeclaration.ts(15,11): error TS2304: Cannot find name 'C4'. + + ==== tests/cases/conformance/classes/nestedClassDeclaration.ts (8 errors) ==== // nested classes are not allowed @@ -5,31 +15,31 @@ x: string; class C2 { ~~~~~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. } } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. function foo() { class C3 { ~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. } } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. var x = { class C4 { ~~ -!!! ':' expected. +!!! error TS1005: ':' expected. ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~~ -!!! Cannot find name 'C4'. +!!! error TS2304: Cannot find name 'C4'. } } ~ -!!! Declaration or statement expected. +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/newExpressionWithCast.errors.txt b/tests/baselines/reference/newExpressionWithCast.errors.txt index a7e9ef10d50..858fd81f0ee 100644 --- a/tests/baselines/reference/newExpressionWithCast.errors.txt +++ b/tests/baselines/reference/newExpressionWithCast.errors.txt @@ -1,20 +1,26 @@ +tests/cases/compiler/newExpressionWithCast.ts(8,17): error TS1109: Expression expected. +tests/cases/compiler/newExpressionWithCast.ts(4,12): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +tests/cases/compiler/newExpressionWithCast.ts(8,13): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'void'. +tests/cases/compiler/newExpressionWithCast.ts(8,18): error TS2304: Cannot find name 'any'. + + ==== tests/cases/compiler/newExpressionWithCast.ts (4 errors) ==== function Test() { } // valid but error with noImplicitAny var test = new Test(); ~~~~~~~~~~ -!!! 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. function Test2() { } // parse error var test2 = new Test2(); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~~~~~~~~~~~~ -!!! Operator '>' cannot be applied to types 'boolean' and 'void'. +!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'void'. ~~~ -!!! Cannot find name 'any'. +!!! error TS2304: Cannot find name 'any'. function Test3() { } // valid with noImplicitAny diff --git a/tests/baselines/reference/newFunctionImplicitAny.errors.txt b/tests/baselines/reference/newFunctionImplicitAny.errors.txt index 2f507f61557..7aa6c150594 100644 --- a/tests/baselines/reference/newFunctionImplicitAny.errors.txt +++ b/tests/baselines/reference/newFunctionImplicitAny.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/newFunctionImplicitAny.ts(4,12): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + ==== tests/cases/compiler/newFunctionImplicitAny.ts (1 errors) ==== // No implicit any error given when newing a function (up for debate) function Test() { } var test = new Test(); ~~~~~~~~~~ -!!! 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. \ No newline at end of file +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. \ No newline at end of file diff --git a/tests/baselines/reference/newMissingIdentifier.errors.txt b/tests/baselines/reference/newMissingIdentifier.errors.txt index 673129e5b09..fec97eb3d88 100644 --- a/tests/baselines/reference/newMissingIdentifier.errors.txt +++ b/tests/baselines/reference/newMissingIdentifier.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/newMissingIdentifier.ts(1,14): error TS1109: Expression expected. + + ==== tests/cases/compiler/newMissingIdentifier.ts (1 errors) ==== var x = new (); ~ -!!! Expression expected. +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/newNonReferenceType.errors.txt b/tests/baselines/reference/newNonReferenceType.errors.txt index 68761488aa7..a68eba9b9e7 100644 --- a/tests/baselines/reference/newNonReferenceType.errors.txt +++ b/tests/baselines/reference/newNonReferenceType.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/newNonReferenceType.ts(1,13): error TS2304: Cannot find name 'any'. +tests/cases/compiler/newNonReferenceType.ts(2,13): error TS2304: Cannot find name 'boolean'. + + ==== tests/cases/compiler/newNonReferenceType.ts (2 errors) ==== var a = new any(); ~~~ -!!! Cannot find name 'any'. +!!! error TS2304: Cannot find name 'any'. var b = new boolean(); // error ~~~~~~~ -!!! Cannot find name 'boolean'. +!!! error TS2304: Cannot find name 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/newOnInstanceSymbol.errors.txt b/tests/baselines/reference/newOnInstanceSymbol.errors.txt index 11f9e589db4..99af44524cd 100644 --- a/tests/baselines/reference/newOnInstanceSymbol.errors.txt +++ b/tests/baselines/reference/newOnInstanceSymbol.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/newOnInstanceSymbol.ts(3,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. + + ==== tests/cases/compiler/newOnInstanceSymbol.ts (1 errors) ==== class C {} var x = new C(); // should be ok new x(); // should error ~~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file diff --git a/tests/baselines/reference/newOperator.errors.txt b/tests/baselines/reference/newOperator.errors.txt index f522ce63f85..2d3fd005448 100644 --- a/tests/baselines/reference/newOperator.errors.txt +++ b/tests/baselines/reference/newOperator.errors.txt @@ -1,9 +1,22 @@ +tests/cases/compiler/newOperator.ts(18,20): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/newOperator.ts(22,1): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/newOperator.ts(45,23): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +tests/cases/compiler/newOperator.ts(3,13): error TS2304: Cannot find name 'ifc'. +tests/cases/compiler/newOperator.ts(10,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/newOperator.ts(11,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/newOperator.ts(12,5): error TS2304: Cannot find name 'string'. +tests/cases/compiler/newOperator.ts(18,14): error TS2304: Cannot find name 'string'. +tests/cases/compiler/newOperator.ts(21,1): error TS2304: Cannot find name 'string'. +tests/cases/compiler/newOperator.ts(28,13): error TS2304: Cannot find name 'q'. +tests/cases/compiler/newOperator.ts(31,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. + + ==== tests/cases/compiler/newOperator.ts (11 errors) ==== interface ifc { } // Attempting to 'new' an interface yields poor error var i = new ifc(); ~~~ -!!! Cannot find name 'ifc'. +!!! error TS2304: Cannot find name 'ifc'. // Parens are optional var x = new Date; @@ -12,13 +25,13 @@ // Target is not a class or var, good error var t1 = new 53(); ~~~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. var t2 = new ''(); ~~~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. new string; ~~~~~~ -!!! Cannot find name 'string'. +!!! error TS2304: Cannot find name 'string'. // Use in LHS of expression? (new Date()).toString(); @@ -26,31 +39,31 @@ // Various spacing var t3 = new string[]( ); ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ -!!! Cannot find name 'string'. +!!! error TS2304: Cannot find name 'string'. var t4 = new string ~~~~~~ -!!! Cannot find name 'string'. +!!! error TS2304: Cannot find name 'string'. [ ~ ] ~~~~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ( ); // Unresolved symbol var f = new q(); ~ -!!! Cannot find name 'q'. +!!! error TS2304: Cannot find name 'q'. // not legal var t5 = new new Date; ~~~~~~~~~~~~ -!!! Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. // Can be an expression new String; @@ -66,7 +79,7 @@ public get xs(): M.T[] { return new M.T[]; ~~ -!!! 'new T[]' cannot be used to create an array. Use 'new Array()' instead. +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. } } \ No newline at end of file diff --git a/tests/baselines/reference/newOperatorErrorCases.errors.txt b/tests/baselines/reference/newOperatorErrorCases.errors.txt index 17dd55d0ebb..8b94c902e50 100644 --- a/tests/baselines/reference/newOperatorErrorCases.errors.txt +++ b/tests/baselines/reference/newOperatorErrorCases.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts(27,16): error TS1005: ',' expected. +tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts(32,23): error TS1109: Expression expected. +tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts(32,16): error TS2304: Cannot find name 'string'. +tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts(37,9): error TS2350: Only a void function can be called with the 'new' keyword. + + ==== tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts (4 errors) ==== class C0 { @@ -27,21 +33,21 @@ // Construct expression with no parentheses for construct signature with > 0 parameters var b = new C0 32, ''; // Parse error ~~ -!!! ',' expected. +!!! error TS1005: ',' expected. // Generic construct expression with no parentheses var c1 = new T; var c1: T<{}>; var c2 = new T; // Parse error ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~~~~~~ -!!! Cannot find name 'string'. +!!! error TS2304: Cannot find name 'string'. // Construct expression of non-void returning function function fnNumber(): number { return 32; } var s = new fnNumber(); // Error ~~~~~~~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. +!!! error TS2350: Only a void function can be called with the 'new' keyword. \ No newline at end of file diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInAccessors.errors.txt b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInAccessors.errors.txt index 04b5ae07b64..2d322853cfe 100644 --- a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInAccessors.errors.txt +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInAccessors.errors.txt @@ -1,8 +1,14 @@ +tests/cases/compiler/noCollisionThisExpressionAndLocalVarInAccessors.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/noCollisionThisExpressionAndLocalVarInAccessors.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/noCollisionThisExpressionAndLocalVarInAccessors.ts(24,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/noCollisionThisExpressionAndLocalVarInAccessors.ts(34,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/noCollisionThisExpressionAndLocalVarInAccessors.ts (4 errors) ==== class class1 { get a(): number { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x2 = { doStuff: (callback) => () => { var _this = 2; @@ -14,7 +20,7 @@ } set a(val: number) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x2 = { doStuff: (callback) => () => { var _this = 2; @@ -28,7 +34,7 @@ class class2 { get a(): number { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var _this = 2; var x2 = { doStuff: (callback) => () => { @@ -40,7 +46,7 @@ } set a(val: number) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var _this = 2; var x2 = { doStuff: (callback) => () => { diff --git a/tests/baselines/reference/noDefaultLib.errors.txt b/tests/baselines/reference/noDefaultLib.errors.txt index 2f411affd56..02098950055 100644 --- a/tests/baselines/reference/noDefaultLib.errors.txt +++ b/tests/baselines/reference/noDefaultLib.errors.txt @@ -1,12 +1,17 @@ -!!! Cannot find global type 'Boolean'. -!!! Cannot find global type 'IArguments'. +error TS2318: Cannot find global type 'Boolean'. +error TS2318: Cannot find global type 'IArguments'. +tests/cases/compiler/noDefaultLib.ts(4,11): error TS2317: Global type 'Array' must have 1 type parameter(s). + + +!!! error TS2318: Cannot find global type 'Boolean'. +!!! error TS2318: Cannot find global type 'IArguments'. ==== tests/cases/compiler/noDefaultLib.ts (1 errors) ==== /// var x; interface Array {} ~~~~~ -!!! Global type 'Array' must have 1 type parameter(s). +!!! error TS2317: Global type 'Array' must have 1 type parameter(s). interface String {} interface Number {} interface Object {} diff --git a/tests/baselines/reference/noErrorsInCallback.errors.txt b/tests/baselines/reference/noErrorsInCallback.errors.txt index cd7c4beb645..f0bfe00199e 100644 --- a/tests/baselines/reference/noErrorsInCallback.errors.txt +++ b/tests/baselines/reference/noErrorsInCallback.errors.txt @@ -1,13 +1,17 @@ +tests/cases/compiler/noErrorsInCallback.ts(4,19): error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'. +tests/cases/compiler/noErrorsInCallback.ts(6,23): error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/noErrorsInCallback.ts (2 errors) ==== class Bar { constructor(public foo: string) { } } var one = new Bar({}); // Error ~~ -!!! Argument of type '{}' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'. [].forEach(() => { var two = new Bar({}); // No error? ~~ -!!! Argument of type '{}' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'. }); \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyForIn.errors.txt b/tests/baselines/reference/noImplicitAnyForIn.errors.txt index 7e4122a8f26..2fb8e5a4103 100644 --- a/tests/baselines/reference/noImplicitAnyForIn.errors.txt +++ b/tests/baselines/reference/noImplicitAnyForIn.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/noImplicitAnyForIn.ts(8,18): error TS7017: Index signature of object type implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyForIn.ts(15,18): error TS7017: Index signature of object type implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyForIn.ts(21,9): error TS7005: Variable 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyForIn.ts(29,5): error TS7005: Variable 'n' implicitly has an 'any[][]' type. +tests/cases/compiler/noImplicitAnyForIn.ts(31,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. + + ==== tests/cases/compiler/noImplicitAnyForIn.ts (5 errors) ==== var x: {}[] = [[1, 2, 3], ["hello"]]; @@ -8,7 +15,7 @@ //Should yield an implicit 'any' error var _j = x[i][j]; ~~~~~~~ -!!! Index signature of object type implicitly has an 'any' type. +!!! error TS7017: Index signature of object type implicitly has an 'any' type. } for (var k in x[0]) { @@ -17,7 +24,7 @@ //Should yield an implicit 'any' error var k2 = k1[k]; ~~~~~ -!!! Index signature of object type implicitly has an 'any' type. +!!! error TS7017: Index signature of object type implicitly has an 'any' type. } } @@ -25,7 +32,7 @@ // Should yield an implicit 'any' error. var b; ~ -!!! Variable 'b' implicitly has an 'any' type. +!!! error TS7005: Variable 'b' implicitly has an 'any' type. var c = a || b; } @@ -35,8 +42,8 @@ // Should yield an implicit 'any' error. var n = [[]] || []; ~ -!!! Variable 'n' implicitly has an 'any[][]' type. +!!! error TS7005: Variable 'n' implicitly has an 'any[][]' type. for (n[idx++] in m); ~~~~~~~~ -!!! The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. \ No newline at end of file +!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyForMethodParameters.errors.txt b/tests/baselines/reference/noImplicitAnyForMethodParameters.errors.txt index 622914ea419..176f40f16f3 100644 --- a/tests/baselines/reference/noImplicitAnyForMethodParameters.errors.txt +++ b/tests/baselines/reference/noImplicitAnyForMethodParameters.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/noImplicitAnyForMethodParameters.ts(6,5): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyForMethodParameters.ts(6,16): error TS7006: Parameter 'a' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyForMethodParameters.ts(10,17): error TS7006: Parameter 'a' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyForMethodParameters.ts(13,16): error TS7006: Parameter 'a' implicitly has an 'any' type. + + ==== tests/cases/compiler/noImplicitAnyForMethodParameters.ts (4 errors) ==== declare class A { private foo(a); // OK - ambient class and private method - no error @@ -6,18 +12,18 @@ declare class B { public foo(a); // OK - ambient class and public method - error ~~~~~~~~~~~~~~ -!!! 'foo', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. ~ -!!! Parameter 'a' implicitly has an 'any' type. +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. } class C { private foo(a) { } // OK - non-ambient class and private method - error ~ -!!! Parameter 'a' implicitly has an 'any' type. +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. } class D { public foo(a) { } // OK - non-ambient class and public method - error ~ -!!! Parameter 'a' implicitly has an 'any' type. +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyForwardReferencedInterface.errors.txt b/tests/baselines/reference/noImplicitAnyForwardReferencedInterface.errors.txt index 7d02a125569..177d2d66bfe 100644 --- a/tests/baselines/reference/noImplicitAnyForwardReferencedInterface.errors.txt +++ b/tests/baselines/reference/noImplicitAnyForwardReferencedInterface.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/noImplicitAnyForwardReferencedInterface.ts(5,5): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. + + ==== tests/cases/compiler/noImplicitAnyForwardReferencedInterface.ts (1 errors) ==== declare var x: Entry; @@ -5,5 +8,5 @@ // Should return error for implicit any. new (); ~~~~~~~ -!!! Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyFunctionExpressionAssignment.errors.txt b/tests/baselines/reference/noImplicitAnyFunctionExpressionAssignment.errors.txt deleted file mode 100644 index 89c4ffe6ac7..00000000000 --- a/tests/baselines/reference/noImplicitAnyFunctionExpressionAssignment.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -==== tests/cases/compiler/noImplicitAnyFunctionExpressionAssignment.ts (2 errors) ==== - - var x: (a: any) => void = function (x: T) { - ~~~~~~~~~~~~~~~~~~~~ - return null; - ~~~~~~~~~~~~~~~~ - }; - ~ -!!! Function expression, which lacks return-type annotation, implicitly has an 'any' return type. - - var x2: (a: any) => void = function f(x: T) { - ~~~~~~~~~~~~~~~~~~~~~ - return null; - ~~~~~~~~~~~~~~~~ - }; - ~ -!!! 'f', which lacks return-type annotation, implicitly has an 'any' return type. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyFunctionExpressionAssignment.types b/tests/baselines/reference/noImplicitAnyFunctionExpressionAssignment.types new file mode 100644 index 00000000000..b07252dac6d --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyFunctionExpressionAssignment.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/noImplicitAnyFunctionExpressionAssignment.ts === + +var x: (a: any) => void = function (x: T) { +>x : (a: any) => void +>a : any +>function (x: T) { return null;} : (x: T) => any +>T : T +>x : T +>T : T + + return null; +}; + +var x2: (a: any) => void = function f(x: T) { +>x2 : (a: any) => void +>a : any +>function f(x: T) { return null;} : (x: T) => any +>f : (x: T) => any +>T : T +>x : T +>T : T + + return null; +}; diff --git a/tests/baselines/reference/noImplicitAnyFunctions.errors.txt b/tests/baselines/reference/noImplicitAnyFunctions.errors.txt index a3768a1c7a5..622dd953150 100644 --- a/tests/baselines/reference/noImplicitAnyFunctions.errors.txt +++ b/tests/baselines/reference/noImplicitAnyFunctions.errors.txt @@ -1,14 +1,21 @@ +tests/cases/compiler/noImplicitAnyFunctions.ts(2,1): error TS7010: 'f1', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyFunctions.ts(6,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyFunctions.ts(17,1): error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyFunctions.ts(19,1): error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyFunctions.ts(19,24): error TS7006: Parameter 'y' implicitly has an 'any' type. + + ==== tests/cases/compiler/noImplicitAnyFunctions.ts (5 errors) ==== declare function f1(); ~~~~~~~~~~~~~~~~~~~~~~ -!!! 'f1', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'f1', which lacks return-type annotation, implicitly has an 'any' return type. declare function f2(): any; function f3(x) { ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. } function f4(x: any) { @@ -21,14 +28,14 @@ function f6(x: string, y: number); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'f6', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. function f6(x: string, y: string): any; function f6(x: string, y) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. return null; ~~~~~~~~~~~~~~~~ } ~ -!!! 'f6', which lacks return-type annotation, implicitly has an 'any' return type. \ No newline at end of file +!!! error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyInBareInterface.errors.txt b/tests/baselines/reference/noImplicitAnyInBareInterface.errors.txt index f96c1b98827..eb379c67026 100644 --- a/tests/baselines/reference/noImplicitAnyInBareInterface.errors.txt +++ b/tests/baselines/reference/noImplicitAnyInBareInterface.errors.txt @@ -1,12 +1,16 @@ +tests/cases/compiler/noImplicitAnyInBareInterface.ts(4,5): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyInBareInterface.ts(6,5): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. + + ==== tests/cases/compiler/noImplicitAnyInBareInterface.ts (2 errors) ==== interface Entry { // Should return error for implicit any on `new` and `foo`. new (); ~~~~~~~ -!!! Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. few() : any; foo(); ~~~~~~ -!!! 'foo', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt b/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt index bc7542df511..ac52b2365ee 100644 --- a/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt +++ b/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/noImplicitAnyInCastExpression.ts(16,2): error TS2353: Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other: + Property 'a' is missing in type '{ c: null; }'. + + ==== tests/cases/compiler/noImplicitAnyInCastExpression.ts (1 errors) ==== // verify no noImplictAny errors reported with cast expression @@ -16,5 +20,5 @@ // Neither types is assignable to each other ({ c: null }); ~~~~~~~~~~~~~~~~~ -!!! Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other: -!!! Property 'a' is missing in type '{ c: null; }'. \ No newline at end of file +!!! error TS2353: Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other: +!!! error TS2353: Property 'a' is missing in type '{ c: null; }'. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyIndexing.errors.txt b/tests/baselines/reference/noImplicitAnyIndexing.errors.txt index 857809c3e84..8b75459ebd0 100644 --- a/tests/baselines/reference/noImplicitAnyIndexing.errors.txt +++ b/tests/baselines/reference/noImplicitAnyIndexing.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/noImplicitAnyIndexing.ts(13,26): error TS7017: Index signature of object type implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyIndexing.ts(20,9): error TS7017: Index signature of object type implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyIndexing.ts(23,9): error TS7017: Index signature of object type implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyIndexing.ts(31,10): error TS7017: Index signature of object type implicitly has an 'any' type. + + ==== tests/cases/compiler/noImplicitAnyIndexing.ts (4 errors) ==== enum MyEmusEnum { @@ -13,7 +19,7 @@ // Should be implicit 'any' ; property access fails, no string indexer. var strRepresentation3 = MyEmusEnum["monehh"]; ~~~~~~~~~~~~~~~~~~~~ -!!! Index signature of object type implicitly has an 'any' type. +!!! error TS7017: Index signature of object type implicitly has an 'any' type. // Should be okay; should be a MyEmusEnum var strRepresentation4 = MyEmusEnum["emu"]; @@ -22,12 +28,12 @@ // Should report an implicit 'any'. var x = {}["hi"]; ~~~~~~~~ -!!! Index signature of object type implicitly has an 'any' type. +!!! error TS7017: Index signature of object type implicitly has an 'any' type. // Should report an implicit 'any'. var y = {}[10]; ~~~~~~ -!!! Index signature of object type implicitly has an 'any' type. +!!! error TS7017: Index signature of object type implicitly has an 'any' type. var hi: any = "hi"; @@ -37,7 +43,7 @@ // Should report an implicit 'any'. var z1 = emptyObj[hi]; ~~~~~~~~~~~~ -!!! Index signature of object type implicitly has an 'any' type. +!!! error TS7017: Index signature of object type implicitly has an 'any' type. var z2 = (emptyObj)[hi]; interface MyMap { diff --git a/tests/baselines/reference/noImplicitAnyModule.errors.txt b/tests/baselines/reference/noImplicitAnyModule.errors.txt index 81e07fad9cb..ec1af2346cc 100644 --- a/tests/baselines/reference/noImplicitAnyModule.errors.txt +++ b/tests/baselines/reference/noImplicitAnyModule.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/noImplicitAnyModule.ts(5,9): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyModule.ts(10,18): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyModule.ts(11,9): error TS7010: 'g', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyModule.ts(18,5): error TS7010: 'f', which lacks return-type annotation, implicitly has an 'any' return type. + + ==== tests/cases/compiler/noImplicitAnyModule.ts (4 errors) ==== declare module Module { @@ -5,17 +11,17 @@ // Should return error for implicit any on return type. new (); ~~~~~~~ -!!! Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. } class Class { // Should return error for implicit `any` on parameter. public f(x): any; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. public g(x: any); ~~~~~~~~~~~~~~~~~ -!!! 'g', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'g', which lacks return-type annotation, implicitly has an 'any' return type. // Should not return error at all. private h(x); @@ -24,6 +30,6 @@ // Should return error for implicit any on return type. function f(x: number); ~~~~~~~~~~~~~~~~~~~~~~ -!!! 'f', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'f', which lacks return-type annotation, implicitly has an 'any' return type. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyParametersInAmbientClass.errors.txt b/tests/baselines/reference/noImplicitAnyParametersInAmbientClass.errors.txt index d81e3e38404..a2ac9467856 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInAmbientClass.errors.txt +++ b/tests/baselines/reference/noImplicitAnyParametersInAmbientClass.errors.txt @@ -1,3 +1,36 @@ +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(7,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(13,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(13,22): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(13,25): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(16,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(16,30): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(19,19): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(22,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(22,22): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(25,19): error TS7006: Parameter 'x1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(26,31): error TS7006: Parameter 'y2' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(27,19): error TS7006: Parameter 'x3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(27,23): error TS7006: Parameter 'y3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(33,22): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(36,22): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(36,25): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(36,28): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(39,22): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(39,33): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(42,22): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(45,22): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(45,25): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(79,24): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(82,24): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(82,27): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(82,30): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(85,24): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(85,35): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(88,24): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(91,24): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts(91,27): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. + + ==== tests/cases/compiler/noImplicitAnyParametersInAmbientClass.ts (31 errors) ==== declare class D_C { @@ -7,7 +40,7 @@ // Implicit-'any' errors for x. public pub_f2(x): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // No implicit-'any' errors. public pub_f3(x: any): void; @@ -15,43 +48,43 @@ // Implicit-'any' errors for x, y, and z. public pub_f4(x, y, z): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x, and z. public pub_f5(x, y: any, z): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' errors for r. public pub_f6(...r): void; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. public pub_f7(x, ...r): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any' errors for x1, y2, x3, and y3. public pub_f8(x1, y1: number): any; ~~ -!!! Parameter 'x1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x1' implicitly has an 'any' type. public pub_f8(x2: string, y2): any; ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. public pub_f8(x3, y3): any; ~~ -!!! Parameter 'x3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x3' implicitly has an 'any' type. ~~ -!!! Parameter 'y3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y3' implicitly has an 'any' type. // No implicit-'any' errors. public pub_f9: () => string; @@ -59,35 +92,35 @@ // Implicit-'any' error for x. public pub_f10: (x) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // Implicit-'any' errors for x, y, and z. public pub_f11: (x, y, z) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x and z. public pub_f12: (x, y: any, z) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' error for r. public pub_f13: (...r) => string; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. public pub_f14: (x, ...r) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. /////////////////////////////////////////// @@ -123,33 +156,33 @@ // Implicit-'any' error for x. private priv_f10: (x) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // Implicit-'any' errors for x, y, and z. private priv_f11: (x, y, z) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x and z. private priv_f12: (x, y: any, z) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' error for r. private priv_f13: (...r) => string; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. private priv_f14: (x, ...r) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyParametersInAmbientFunctions.errors.txt b/tests/baselines/reference/noImplicitAnyParametersInAmbientFunctions.errors.txt index 905ea1ac9f0..37af83d7891 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInAmbientFunctions.errors.txt +++ b/tests/baselines/reference/noImplicitAnyParametersInAmbientFunctions.errors.txt @@ -1,3 +1,27 @@ +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(6,23): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(12,23): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(12,26): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(12,29): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(15,23): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(15,34): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(18,23): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(21,23): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(21,26): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(24,23): error TS7006: Parameter 'x1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(25,35): error TS7006: Parameter 'y2' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(26,23): error TS7006: Parameter 'x3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(26,27): error TS7006: Parameter 'y3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(32,21): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(35,21): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(35,24): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(35,27): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(38,21): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(38,32): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(41,21): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(44,21): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts(44,24): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. + + ==== tests/cases/compiler/noImplicitAnyParametersInAmbientFunctions.ts (22 errors) ==== // No implicit-'any' errors. @@ -6,7 +30,7 @@ // Implicit-'any' errors for x. declare function d_f2(x): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // No implicit-'any' errors. declare function d_f3(x: any): void; @@ -14,43 +38,43 @@ // Implicit-'any' errors for x, y, and z. declare function d_f4(x, y, z): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x, and z. declare function d_f5(x, y: any, z): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' errors for r. declare function d_f6(...r): void; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. declare function d_f7(x, ...r): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any' errors for x1, y2, x3, and y3. declare function d_f8(x1, y1: number): any; ~~ -!!! Parameter 'x1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x1' implicitly has an 'any' type. declare function d_f8(x2: string, y2): any; ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. declare function d_f8(x3, y3): any; ~~ -!!! Parameter 'x3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x3' implicitly has an 'any' type. ~~ -!!! Parameter 'y3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y3' implicitly has an 'any' type. // No implicit-'any' errors. declare var d_f9: () => string; @@ -58,32 +82,32 @@ // Implicit-'any' error for x. declare var d_f10: (x) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // Implicit-'any' errors for x, y, and z. declare var d_f11: (x, y, z) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x and z. declare var d_f12: (x, y: any, z) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' error for r. declare var d_f13: (...r) => string; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. declare var d_f14: (x, ...r) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. \ No newline at end of file +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyParametersInAmbientModule.errors.txt b/tests/baselines/reference/noImplicitAnyParametersInAmbientModule.errors.txt index 99779ab7697..7bdfbcaae88 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInAmbientModule.errors.txt +++ b/tests/baselines/reference/noImplicitAnyParametersInAmbientModule.errors.txt @@ -1,3 +1,27 @@ +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(7,20): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(13,20): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(13,23): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(13,26): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(16,20): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(16,31): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(19,20): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(22,20): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(22,23): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(25,20): error TS7006: Parameter 'x1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(26,32): error TS7006: Parameter 'y2' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(27,20): error TS7006: Parameter 'x3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(27,24): error TS7006: Parameter 'y3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(33,18): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(36,18): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(36,21): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(36,24): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(39,18): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(39,29): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(42,18): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(45,18): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts(45,21): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. + + ==== tests/cases/compiler/noImplicitAnyParametersInAmbientModule.ts (22 errors) ==== declare module D_M { @@ -7,7 +31,7 @@ // No implicit-'any' errors. function dm_f2(x): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // No implicit-'any' errors. function dm_f3(x: any): void; @@ -15,43 +39,43 @@ // No implicit-'any' errors. function dm_f4(x, y, z): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // No implicit-'any' errors. function dm_f5(x, y: any, z): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // No implicit-'any' errors. function dm_f6(...r): void; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // No implicit-'any' errors. function dm_f7(x, ...r): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // No implicit-'any' errors. function dm_f8(x1, y1: number): any; ~~ -!!! Parameter 'x1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x1' implicitly has an 'any' type. function dm_f8(x2: string, y2): any; ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. function dm_f8(x3, y3): any; ~~ -!!! Parameter 'x3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x3' implicitly has an 'any' type. ~~ -!!! Parameter 'y3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y3' implicitly has an 'any' type. // No implicit-'any' errors. var dm_f9: () => string; @@ -59,33 +83,33 @@ // No implicit-'any' errors. var dm_f10: (x) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // No implicit-'any' errors. var dm_f11: (x, y, z) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // No implicit-'any' errors. var dm_f12: (x, y: any, z) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // No implicit-'any' errors. var dm_f13: (...r) => string; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // No implicit-'any' errors. var dm_f14: (x, ...r) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.errors.txt b/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.errors.txt index ed49e1dbd11..3d3cc1aa5ea 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.errors.txt +++ b/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.errors.txt @@ -1,3 +1,27 @@ +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(6,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(12,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(12,16): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(12,19): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(15,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(15,24): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(18,13): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(21,13): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(21,16): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(24,13): error TS7006: Parameter 'x1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(25,25): error TS7006: Parameter 'y2' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(26,13): error TS7006: Parameter 'x3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(26,17): error TS7006: Parameter 'y3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(32,12): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(35,12): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(35,15): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(35,18): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(38,12): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(38,23): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(41,12): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(44,12): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts(44,15): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. + + ==== tests/cases/compiler/noImplicitAnyParametersInBareFunctions.ts (22 errors) ==== // No implicit-'any' errors. @@ -6,7 +30,7 @@ // Implicit-'any' error for x. function f2(x): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // No implicit-'any' errors. function f3(x: any): void { } @@ -14,43 +38,43 @@ // Implicit-'any' errors for x, y, and z. function f4(x, y, z): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x, and z. function f5(x, y: any, z): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' error for r. function f6(...r): void { } ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. function f7(x, ...r): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any' errors for x1, y2, x3, and y3. function f8(x1, y1: number): any; ~~ -!!! Parameter 'x1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x1' implicitly has an 'any' type. function f8(x2: string, y2): any; ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. function f8(x3, y3): any { } ~~ -!!! Parameter 'x3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x3' implicitly has an 'any' type. ~~ -!!! Parameter 'y3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y3' implicitly has an 'any' type. // No implicit-'any' errors. var f9 = () => ""; @@ -58,32 +82,32 @@ // Implicit-'any' errors for x. var f10 = (x) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // Implicit-'any' errors for x, y, and z. var f11 = (x, y, z) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x and z. var f12 = (x, y: any, z) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' error for r. var f13 = (...r) => ""; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. var f14 = (x, ...r) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. \ No newline at end of file +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyParametersInClass.errors.txt b/tests/baselines/reference/noImplicitAnyParametersInClass.errors.txt index 785ebe83b87..98d743a21aa 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInClass.errors.txt +++ b/tests/baselines/reference/noImplicitAnyParametersInClass.errors.txt @@ -1,3 +1,49 @@ +tests/cases/compiler/noImplicitAnyParametersInClass.ts(7,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(13,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(13,22): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(13,25): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(16,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(16,30): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(19,19): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(22,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(22,22): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(25,19): error TS7006: Parameter 'x1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(26,31): error TS7006: Parameter 'y2' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(27,19): error TS7006: Parameter 'x3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(27,23): error TS7006: Parameter 'y3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(33,23): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(36,23): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(36,26): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(36,29): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(39,23): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(39,34): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(42,23): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(45,23): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(45,26): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(53,21): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(59,21): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(59,24): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(59,27): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(62,21): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(62,32): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(65,21): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(68,21): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(68,24): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(71,21): error TS7006: Parameter 'x1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(72,33): error TS7006: Parameter 'y2' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(73,21): error TS7006: Parameter 'x3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(73,25): error TS7006: Parameter 'y3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(79,25): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(82,25): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(82,28): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(82,31): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(85,25): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(85,36): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(88,25): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(91,25): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInClass.ts(91,28): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. + + ==== tests/cases/compiler/noImplicitAnyParametersInClass.ts (44 errors) ==== class C { @@ -7,7 +53,7 @@ // Implicit-'any' errors for x. public pub_f2(x): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // No implicit-'any' errors. public pub_f3(x: any): void { } @@ -15,43 +61,43 @@ // Implicit-'any' errors for x, y, and z. public pub_f4(x, y, z): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x, and z. public pub_f5(x, y: any, z): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' errors for r. public pub_f6(...r): void { } ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. public pub_f7(x, ...r): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any' errors for x1, y2, x3, and y3. public pub_f8(x1, y1: number): any; ~~ -!!! Parameter 'x1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x1' implicitly has an 'any' type. public pub_f8(x2: string, y2): any; ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. public pub_f8(x3, y3): any { } ~~ -!!! Parameter 'x3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x3' implicitly has an 'any' type. ~~ -!!! Parameter 'y3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y3' implicitly has an 'any' type. // No implicit-'any' errors. public pub_f9 = () => ""; @@ -59,35 +105,35 @@ // Implicit-'any' errors for x. public pub_f10 = (x) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // Implicit-'any' errors for x, y, and z. public pub_f11 = (x, y, z) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x and z. public pub_f12 = (x, y: any, z) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' error for r. public pub_f13 = (...r) => ""; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. public pub_f14 = (x, ...r) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. /////////////////////////////////////////// @@ -97,7 +143,7 @@ // Implicit-'any' errors for x. private priv_f2(x): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // No implicit-'any' errors. private priv_f3(x: any): void { } @@ -105,43 +151,43 @@ // Implicit-'any' errors for x, y, and z. private priv_f4(x, y, z): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x, and z. private priv_f5(x, y: any, z): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' errors for r. private priv_f6(...r): void { } ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. private priv_f7(x, ...r): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any' errors for x1, y2, x3, and y3. private priv_f8(x1, y1: number): any; ~~ -!!! Parameter 'x1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x1' implicitly has an 'any' type. private priv_f8(x2: string, y2): any; ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. private priv_f8(x3, y3): any { } ~~ -!!! Parameter 'x3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x3' implicitly has an 'any' type. ~~ -!!! Parameter 'y3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y3' implicitly has an 'any' type. // No implicit-'any' errors. private priv_f9 = () => ""; @@ -149,33 +195,33 @@ // Implicit-'any' errors for x. private priv_f10 = (x) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // Implicit-'any' errors for x, y, and z. private priv_f11 = (x, y, z) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x and z. private priv_f12 = (x, y: any, z) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' error for r. private priv_f13 = (...r) => ""; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. private priv_f14 = (x, ...r) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyParametersInInterface.errors.txt b/tests/baselines/reference/noImplicitAnyParametersInInterface.errors.txt index c9bece57671..f0b9fad3b33 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInInterface.errors.txt +++ b/tests/baselines/reference/noImplicitAnyParametersInInterface.errors.txt @@ -1,20 +1,49 @@ +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(4,5): error TS7020: Call signature, which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(5,5): error TS7020: Call signature, which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(5,6): error TS7006: Parameter 'x1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(6,6): error TS7006: Parameter 'x2' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(6,22): error TS7006: Parameter 'z2' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(12,8): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(18,8): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(18,11): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(18,14): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(21,8): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(21,19): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(24,8): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(27,8): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(27,11): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(30,8): error TS7006: Parameter 'x1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(31,20): error TS7006: Parameter 'y2' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(32,8): error TS7006: Parameter 'x3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(32,12): error TS7006: Parameter 'y3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(38,11): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(41,11): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(41,14): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(41,17): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(44,11): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(44,22): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(47,11): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(50,11): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInInterface.ts(50,14): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. + + ==== tests/cases/compiler/noImplicitAnyParametersInInterface.ts (27 errors) ==== interface I { // Implicit-'any' errors for first two call signatures, x1, x2, z2. (); ~~~ -!!! Call signature, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7020: Call signature, which lacks return-type annotation, implicitly has an 'any' return type. (x1); ~~~~~ -!!! Call signature, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7020: Call signature, which lacks return-type annotation, implicitly has an 'any' return type. ~~ -!!! Parameter 'x1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x1' implicitly has an 'any' type. (x2, y2: string, z2): any; ~~ -!!! Parameter 'x2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x2' implicitly has an 'any' type. ~~ -!!! Parameter 'z2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z2' implicitly has an 'any' type. // No implicit-'any' errors. f1(): void; @@ -22,7 +51,7 @@ // Implicit-'any' errors for x. f2(x): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // No implicit-'any' errors. f3(x: any): void; @@ -30,43 +59,43 @@ // Implicit-'any' errors for x, y, and z. f4(x, y, z): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x, and z. f5(x, y: any, z): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' errors for r. f6(...r): void; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. f7(x, ...r): void; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any' errors for x1, y2, x3, and y3. f8(x1, y1: number): any; ~~ -!!! Parameter 'x1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x1' implicitly has an 'any' type. f8(x2: string, y2): any; ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. f8(x3, y3): any; ~~ -!!! Parameter 'x3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x3' implicitly has an 'any' type. ~~ -!!! Parameter 'y3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y3' implicitly has an 'any' type. // No implicit-'any' errors. f9: () => string; @@ -74,33 +103,33 @@ // Implicit-'any' errors for x. f10: (x) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // Implicit-'any' errors for x, y, and z. f11: (x, y, z) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x and z. f12: (x, y: any, z) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' error for r. f13: (...r) => string; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x, r. f14: (x, ...r) => string; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyParametersInModule.errors.txt b/tests/baselines/reference/noImplicitAnyParametersInModule.errors.txt index 87912f0dcfa..8bddee624c5 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInModule.errors.txt +++ b/tests/baselines/reference/noImplicitAnyParametersInModule.errors.txt @@ -1,3 +1,27 @@ +tests/cases/compiler/noImplicitAnyParametersInModule.ts(7,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(13,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(13,22): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(13,25): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(16,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(16,30): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(19,19): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(22,19): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(22,22): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(25,19): error TS7006: Parameter 'x1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(26,31): error TS7006: Parameter 'y2' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(27,19): error TS7006: Parameter 'x3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(27,23): error TS7006: Parameter 'y3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(33,18): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(36,18): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(36,21): error TS7006: Parameter 'y' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(36,24): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(39,18): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(39,29): error TS7006: Parameter 'z' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(42,18): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(45,18): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyParametersInModule.ts(45,21): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. + + ==== tests/cases/compiler/noImplicitAnyParametersInModule.ts (22 errors) ==== module M { @@ -7,7 +31,7 @@ // Implicit-'any' error for x. function m_f2(x): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // No implicit-'any' errors. function m_f3(x: any): void { } @@ -15,43 +39,43 @@ // Implicit-'any' errors for x, y, and z. function m_f4(x, y, z): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x and z. function m_f5(x, y: any, z): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' error for r. function m_f6(...r): void { } ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x and r. function m_f7(x, ...r): void { } ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any' errors for x1, y2, x3, and y3. function m_f8(x1, y1: number): any; ~~ -!!! Parameter 'x1' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x1' implicitly has an 'any' type. function m_f8(x2: string, y2): any; ~~ -!!! Parameter 'y2' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y2' implicitly has an 'any' type. function m_f8(x3, y3): any { } ~~ -!!! Parameter 'x3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x3' implicitly has an 'any' type. ~~ -!!! Parameter 'y3' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y3' implicitly has an 'any' type. // No implicit-'any' errors. var m_f9 = () => ""; @@ -59,33 +83,33 @@ // Implicit-'any' error for x. var m_f10 = (x) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. // Implicit-'any' errors for x, y, and z. var m_f11 = (x, y, z) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'y' implicitly has an 'any' type. +!!! error TS7006: Parameter 'y' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any' errors for x and z. var m_f12 = (x, y: any, z) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~ -!!! Parameter 'z' implicitly has an 'any' type. +!!! error TS7006: Parameter 'z' implicitly has an 'any' type. // Implicit-'any[]' errors for r. var m_f13 = (...r) => ""; ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. // Implicit-'any'/'any[]' errors for x and r. var m_f14 = (x, ...r) => ""; ~ -!!! Parameter 'x' implicitly has an 'any' type. +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. ~~~~ -!!! Rest parameter 'r' implicitly has an 'any[]' type. +!!! error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyReferencingDeclaredInterface.errors.txt b/tests/baselines/reference/noImplicitAnyReferencingDeclaredInterface.errors.txt index b3dce9b2f77..d782e05ca61 100644 --- a/tests/baselines/reference/noImplicitAnyReferencingDeclaredInterface.errors.txt +++ b/tests/baselines/reference/noImplicitAnyReferencingDeclaredInterface.errors.txt @@ -1,10 +1,13 @@ +tests/cases/compiler/noImplicitAnyReferencingDeclaredInterface.ts(4,5): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. + + ==== tests/cases/compiler/noImplicitAnyReferencingDeclaredInterface.ts (1 errors) ==== interface Entry { // Should return error for implicit any. new (); ~~~~~~~ -!!! Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. } declare var x: Entry; \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.errors.txt b/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.errors.txt index c19ff9f396e..5c0878f8ab9 100644 --- a/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.errors.txt +++ b/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(2,9): error TS7017: Index signature of object type implicitly has an 'any' type. + + ==== tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts (1 errors) ==== var x = {}["hello"]; ~~~~~~~~~~~ -!!! Index signature of object type implicitly has an 'any' type. \ No newline at end of file +!!! error TS7017: Index signature of object type implicitly has an 'any' type. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt b/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt index 490d3e41cfb..21845261f35 100644 --- a/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt +++ b/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt @@ -1,18 +1,24 @@ +tests/cases/compiler/noImplicitAnyWithOverloads.ts(2,5): error TS7008: Member 'foo' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyWithOverloads.ts(6,1): error TS7010: 'callb', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyWithOverloads.ts(7,1): error TS7010: 'callb', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyWithOverloads.ts(8,16): error TS7006: Parameter 'a' implicitly has an 'any' type. + + ==== tests/cases/compiler/noImplicitAnyWithOverloads.ts (4 errors) ==== interface A { foo; ~~~~ -!!! Member 'foo' implicitly has an 'any' type. +!!! error TS7008: Member 'foo' implicitly has an 'any' type. } interface B { } function callb(lam: (l: A) => void); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'callb', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'callb', which lacks return-type annotation, implicitly has an 'any' return type. function callb(lam: (n: B) => void); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'callb', which lacks return-type annotation, implicitly has an 'any' return type. +!!! error TS7010: 'callb', which lacks return-type annotation, implicitly has an 'any' return type. function callb(a) { } ~ -!!! Parameter 'a' implicitly has an 'any' type. +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. callb((a) => { a.foo; }); // error, chose first overload \ No newline at end of file diff --git a/tests/baselines/reference/noTypeArgumentOnReturnType1.errors.txt b/tests/baselines/reference/noTypeArgumentOnReturnType1.errors.txt index 949364d138b..4800ccf3c17 100644 --- a/tests/baselines/reference/noTypeArgumentOnReturnType1.errors.txt +++ b/tests/baselines/reference/noTypeArgumentOnReturnType1.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/noTypeArgumentOnReturnType1.ts(3,9): error TS2314: Generic type 'A' requires 1 type argument(s). + + ==== tests/cases/compiler/noTypeArgumentOnReturnType1.ts (1 errors) ==== class A{ foo(): A{ ~ -!!! Generic type 'A' requires 1 type argument(s). +!!! error TS2314: Generic type 'A' requires 1 type argument(s). return null; } } \ No newline at end of file diff --git a/tests/baselines/reference/nonArrayRestArgs.errors.txt b/tests/baselines/reference/nonArrayRestArgs.errors.txt index 7262e0a92a7..b25b5296b35 100644 --- a/tests/baselines/reference/nonArrayRestArgs.errors.txt +++ b/tests/baselines/reference/nonArrayRestArgs.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/nonArrayRestArgs.ts(1,14): error TS2370: A rest parameter must be of an array type. + + ==== tests/cases/compiler/nonArrayRestArgs.ts (1 errors) ==== function foo(...rest: number) { // error ~~~~~~~~~~~~~~~ -!!! A rest parameter must be of an array type. +!!! error TS2370: A rest parameter must be of an array type. var x: string = rest[0]; return x; } \ No newline at end of file diff --git a/tests/baselines/reference/nonContextuallyTypedLogicalOr.errors.txt b/tests/baselines/reference/nonContextuallyTypedLogicalOr.errors.txt deleted file mode 100644 index e7d301b6edc..00000000000 --- a/tests/baselines/reference/nonContextuallyTypedLogicalOr.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -==== tests/cases/compiler/nonContextuallyTypedLogicalOr.ts (1 errors) ==== - interface Contextual { - dummy; - p?: number; - } - - interface Ellement { - dummy; - p: any; - } - - var c: Contextual; - var e: Ellement; - - // This should error. Even though we are contextually typing e with Contextual, the RHS still - // needs to be a supertype of the LHS to win as the best common type. - (c || e).dummy; - ~~~~~ -!!! Property 'dummy' does not exist on type '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/nonContextuallyTypedLogicalOr.js b/tests/baselines/reference/nonContextuallyTypedLogicalOr.js index a29390bcf7f..e3ec95533fd 100644 --- a/tests/baselines/reference/nonContextuallyTypedLogicalOr.js +++ b/tests/baselines/reference/nonContextuallyTypedLogicalOr.js @@ -12,13 +12,9 @@ interface Ellement { var c: Contextual; var e: Ellement; -// This should error. Even though we are contextually typing e with Contextual, the RHS still -// needs to be a supertype of the LHS to win as the best common type. (c || e).dummy; //// [nonContextuallyTypedLogicalOr.js] var c; var e; -// This should error. Even though we are contextually typing e with Contextual, the RHS still -// needs to be a supertype of the LHS to win as the best common type. (c || e).dummy; diff --git a/tests/baselines/reference/nonContextuallyTypedLogicalOr.types b/tests/baselines/reference/nonContextuallyTypedLogicalOr.types new file mode 100644 index 00000000000..aeb9d1409c6 --- /dev/null +++ b/tests/baselines/reference/nonContextuallyTypedLogicalOr.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/nonContextuallyTypedLogicalOr.ts === +interface Contextual { +>Contextual : Contextual + + dummy; +>dummy : any + + p?: number; +>p : number +} + +interface Ellement { +>Ellement : Ellement + + dummy; +>dummy : any + + p: any; +>p : any +} + +var c: Contextual; +>c : Contextual +>Contextual : Contextual + +var e: Ellement; +>e : Ellement +>Ellement : Ellement + +(c || e).dummy; +>(c || e).dummy : any +>(c || e) : Contextual | Ellement +>c || e : Contextual | Ellement +>c : Contextual +>e : Ellement +>dummy : any + diff --git a/tests/baselines/reference/nonExportedElementsOfMergedModules.errors.txt b/tests/baselines/reference/nonExportedElementsOfMergedModules.errors.txt index f4f1fe043e7..18f9f3bc8d4 100644 --- a/tests/baselines/reference/nonExportedElementsOfMergedModules.errors.txt +++ b/tests/baselines/reference/nonExportedElementsOfMergedModules.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/nonExportedElementsOfMergedModules.ts(13,7): error TS2339: Property 'x' does not exist on type 'typeof B'. + + ==== tests/cases/compiler/nonExportedElementsOfMergedModules.ts (1 errors) ==== module One { enum A { X } @@ -13,7 +16,7 @@ } B.x; ~ -!!! Property 'x' does not exist on type 'typeof B'. +!!! error TS2339: Property 'x' does not exist on type 'typeof B'. B.y; } \ No newline at end of file diff --git a/tests/baselines/reference/nullAssignedToUndefined.errors.txt b/tests/baselines/reference/nullAssignedToUndefined.errors.txt index 964fec0d3bf..5f9921b5809 100644 --- a/tests/baselines/reference/nullAssignedToUndefined.errors.txt +++ b/tests/baselines/reference/nullAssignedToUndefined.errors.txt @@ -1,5 +1,8 @@ +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignedToUndefined.ts(1,9): error TS2364: Invalid left-hand side of assignment expression. + + ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignedToUndefined.ts (1 errors) ==== var x = undefined = null; // error ~~~~~~~~~ -!!! Invalid left-hand side of assignment expression. +!!! error TS2364: Invalid left-hand side of assignment expression. var y: typeof undefined = null; // ok, widened \ No newline at end of file diff --git a/tests/baselines/reference/nullKeyword.errors.txt b/tests/baselines/reference/nullKeyword.errors.txt index ab3616d7772..a140fce0b0f 100644 --- a/tests/baselines/reference/nullKeyword.errors.txt +++ b/tests/baselines/reference/nullKeyword.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/nullKeyword.ts(1,6): error TS2339: Property 'foo' does not exist on type 'null'. + + ==== tests/cases/compiler/nullKeyword.ts (1 errors) ==== null.foo; ~~~ -!!! Property 'foo' does not exist on type 'null'. \ No newline at end of file +!!! error TS2339: Property 'foo' does not exist on type 'null'. \ No newline at end of file diff --git a/tests/baselines/reference/numLit.errors.txt b/tests/baselines/reference/numLit.errors.txt index 97c80e65677..98b84791e35 100644 --- a/tests/baselines/reference/numLit.errors.txt +++ b/tests/baselines/reference/numLit.errors.txt @@ -1,9 +1,13 @@ +tests/cases/compiler/numLit.ts(3,3): error TS1005: ';' expected. +tests/cases/compiler/numLit.ts(3,3): error TS2304: Cannot find name 'toString'. + + ==== tests/cases/compiler/numLit.ts (2 errors) ==== 1..toString(); 1.0.toString(); 1.toString(); ~~~~~~~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~~~ -!!! Cannot find name 'toString'. +!!! error TS2304: Cannot find name 'toString'. 1.+2.0 + 3. ; \ No newline at end of file diff --git a/tests/baselines/reference/numberToString.errors.txt b/tests/baselines/reference/numberToString.errors.txt index 5d7a636f5f1..d703632d18b 100644 --- a/tests/baselines/reference/numberToString.errors.txt +++ b/tests/baselines/reference/numberToString.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/numberToString.ts(2,12): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/numberToString.ts(9,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/numberToString.ts (2 errors) ==== function f1(n:number):string { return n; // error return type mismatch ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. } function f2(s:string):void { @@ -11,6 +15,6 @@ f1(3); f2(3); // error no coercion to string ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. f2(3+""); // ok + operator promotes \ No newline at end of file diff --git a/tests/baselines/reference/numericClassMembers1.errors.txt b/tests/baselines/reference/numericClassMembers1.errors.txt index 160c6e88207..eb99f26bb4c 100644 --- a/tests/baselines/reference/numericClassMembers1.errors.txt +++ b/tests/baselines/reference/numericClassMembers1.errors.txt @@ -1,16 +1,26 @@ -==== tests/cases/compiler/numericClassMembers1.ts (2 errors) ==== +tests/cases/compiler/numericClassMembers1.ts(2,3): error TS2300: Duplicate identifier '0'. +tests/cases/compiler/numericClassMembers1.ts(3,3): error TS2300: Duplicate identifier '0.0'. +tests/cases/compiler/numericClassMembers1.ts(7,3): error TS2300: Duplicate identifier '0.0'. +tests/cases/compiler/numericClassMembers1.ts(8,2): error TS2300: Duplicate identifier ''0''. + + +==== tests/cases/compiler/numericClassMembers1.ts (4 errors) ==== class C234 { 0 = 1; + ~ +!!! error TS2300: Duplicate identifier '0'. 0.0 = 2; ~~~ -!!! Duplicate identifier '0.0'. +!!! error TS2300: Duplicate identifier '0.0'. } class C235 { 0.0 = 1; + ~~~ +!!! error TS2300: Duplicate identifier '0.0'. '0' = 2; ~~~ -!!! Duplicate identifier ''0''. +!!! error TS2300: Duplicate identifier ''0''. } class C236 { diff --git a/tests/baselines/reference/numericIndexExpressions.errors.txt b/tests/baselines/reference/numericIndexExpressions.errors.txt index b471b45c7dd..5832cca76c6 100644 --- a/tests/baselines/reference/numericIndexExpressions.errors.txt +++ b/tests/baselines/reference/numericIndexExpressions.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/numericIndexExpressions.ts(10,1): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/numericIndexExpressions.ts(11,1): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/numericIndexExpressions.ts(14,1): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/numericIndexExpressions.ts(15,1): error TS2323: Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/numericIndexExpressions.ts (4 errors) ==== interface Numbers1 { 1: string; @@ -10,15 +16,15 @@ var x: Numbers1; x[1] = 4; // error ~~~~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. x['1'] = 4; // error ~~~~~~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. var y: Strings1; y['1'] = 4; // should be error ~~~~~~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. y[1] = 4; // should be error ~~~~ -!!! Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2323: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt index 1a74ee37809..b59b734b3d0 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt @@ -1,3 +1,22 @@ +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(18,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(20,5): error TS2412: Property '"4.0"' of type 'number' is not assignable to numeric index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(21,5): error TS2412: Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(55,5): error TS2412: Property '"4.0"' of type 'number' is not assignable to numeric index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2412: Property '"4.0"' of type 'number' is not assignable to numeric index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }': + Index signatures are incompatible: + Type 'string | number' is not assignable to type 'string': + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(88,9): error TS2304: Cannot find name 'Myn'. + + ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts (14 errors) ==== // String indexer types constrain the types of named properties in their containing type @@ -18,23 +37,23 @@ 1.0: string; // ok 2.0: number; // error ~~~~~~~~~~~~ -!!! Property '2.0' of type 'number' is not assignable to numeric index type 'string'. +!!! error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. "3.0": string; // ok "4.0": number; // error ~~~~~~~~~~~~~~ -!!! Property '"4.0"' of type 'number' is not assignable to numeric index type 'string'. +!!! error TS2412: Property '"4.0"' of type 'number' is not assignable to numeric index type 'string'. 3.0: MyNumber // error ~~~~~~~~~~~~~ -!!! Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'. +!!! error TS2412: Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'. get X() { // ok ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return ''; } set X(v) { } // ok ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. foo() { return ''; @@ -46,7 +65,7 @@ static foo() { } // ok static get X() { // ok ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 1; } } @@ -62,14 +81,14 @@ 1.0: string; // ok 2.0: number; // error ~~~~~~~~~~~~ -!!! Property '2.0' of type 'number' is not assignable to numeric index type 'string'. +!!! error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. (): string; // ok (x): number // ok foo(): string; // ok "3.0": string; // ok "4.0": number; // error ~~~~~~~~~~~~~~ -!!! Property '"4.0"' of type 'number' is not assignable to numeric index type 'string'. +!!! error TS2412: Property '"4.0"' of type 'number' is not assignable to numeric index type 'string'. f: MyNumber; // error } @@ -84,23 +103,24 @@ 1.0: string; // ok 2.0: number; // error ~~~~~~~~~~~~ -!!! Property '2.0' of type 'number' is not assignable to numeric index type 'string'. +!!! error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. (): string; // ok (x): number // ok foo(): string; // ok "3.0": string; // ok "4.0": number; // error ~~~~~~~~~~~~~~ -!!! Property '"4.0"' of type 'number' is not assignable to numeric index type 'string'. +!!! error TS2412: Property '"4.0"' of type 'number' is not assignable to numeric index type 'string'. f: MyNumber; // error } // error var b: { [x: number]: string; } = { ~ -!!! Type '{ [x: number]: {}; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: unknown; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }': -!!! Index signatures are incompatible: -!!! Type '{}' is not assignable to type 'string'. +!!! error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'string | number' is not assignable to type 'string': +!!! error TS2322: Type 'number' is not assignable to type 'string'. a: '', b: 1, c: () => { }, @@ -112,16 +132,16 @@ "4.0": 1, f: null, ~~~ -!!! Cannot find name 'Myn'. +!!! error TS2304: Cannot find name 'Myn'. get X() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return ''; }, set X(v) { }, ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. foo() { return ''; } diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt index 3c211326180..4d0488ec80f 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt @@ -1,3 +1,15 @@ +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(16,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(17,5): error TS2412: Property '"4.0"' of type 'string' is not assignable to numeric index type 'A'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(25,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(26,5): error TS2412: Property '"4.0"' of type 'string' is not assignable to numeric index type 'A'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(34,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(35,5): error TS2412: Property '"4.0"' of type 'string' is not assignable to numeric index type 'A'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ [x: number]: string | number | A; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }': + Index signatures are incompatible: + Type 'string | number | A' is not assignable to type 'A': + Type 'string' is not assignable to type 'A'. + + ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts (7 errors) ==== // String indexer providing a constraint of a user defined type @@ -16,10 +28,10 @@ "2.5": B // ok 3.0: number; // error ~~~~~~~~~~~~ -!!! Property '3.0' of type 'number' is not assignable to numeric index type 'A'. +!!! error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. "4.0": string; // error ~~~~~~~~~~~~~~ -!!! Property '"4.0"' of type 'string' is not assignable to numeric index type 'A'. +!!! error TS2412: Property '"4.0"' of type 'string' is not assignable to numeric index type 'A'. } interface Foo2 { @@ -29,10 +41,10 @@ "2.5": B // ok 3.0: number; // error ~~~~~~~~~~~~ -!!! Property '3.0' of type 'number' is not assignable to numeric index type 'A'. +!!! error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. "4.0": string; // error ~~~~~~~~~~~~~~ -!!! Property '"4.0"' of type 'string' is not assignable to numeric index type 'A'. +!!! error TS2412: Property '"4.0"' of type 'string' is not assignable to numeric index type 'A'. } var a: { @@ -42,19 +54,19 @@ "2.5": B // ok 3.0: number; // error ~~~~~~~~~~~~ -!!! Property '3.0' of type 'number' is not assignable to numeric index type 'A'. +!!! error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. "4.0": string; // error ~~~~~~~~~~~~~~ -!!! Property '"4.0"' of type 'string' is not assignable to numeric index type 'A'. +!!! error TS2412: Property '"4.0"' of type 'string' is not assignable to numeric index type 'A'. }; // error var b: { [x: number]: A } = { ~ -!!! Type '{ [x: number]: {}; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }': -!!! Index signatures are incompatible: -!!! Type '{}' is not assignable to type 'A': -!!! Property 'foo' is missing in type '{}'. +!!! error TS2322: Type '{ [x: number]: string | number | A; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'string | number | A' is not assignable to type 'A': +!!! error TS2322: Type 'string' is not assignable to type 'A'. 1.0: new A(), 2.0: new B(), "2.5": new B(), diff --git a/tests/baselines/reference/numericIndexerConstraint.errors.txt b/tests/baselines/reference/numericIndexerConstraint.errors.txt index 4ff9b00897e..af24643310a 100644 --- a/tests/baselines/reference/numericIndexerConstraint.errors.txt +++ b/tests/baselines/reference/numericIndexerConstraint.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/numericIndexerConstraint.ts(2,5): error TS2412: Property '0' of type 'number' is not assignable to numeric index type 'RegExp'. + + ==== tests/cases/compiler/numericIndexerConstraint.ts (1 errors) ==== class C { 0: number; ~~~~~~~~~~ -!!! Property '0' of type 'number' is not assignable to numeric index type 'RegExp'. +!!! error TS2412: Property '0' of type 'number' is not assignable to numeric index type 'RegExp'. [x: number]: RegExp; } \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerConstraint1.errors.txt b/tests/baselines/reference/numericIndexerConstraint1.errors.txt index 8d615874e4d..cd800042c4b 100644 --- a/tests/baselines/reference/numericIndexerConstraint1.errors.txt +++ b/tests/baselines/reference/numericIndexerConstraint1.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/numericIndexerConstraint1.ts(3,5): error TS2322: Type 'number' is not assignable to type 'Foo': + Property 'foo' is missing in type 'Number'. + + ==== tests/cases/compiler/numericIndexerConstraint1.ts (1 errors) ==== class Foo { foo() { } } var x: { [index: string]: number; }; var result: Foo = x["one"]; // error ~~~~~~ -!!! Type 'number' is not assignable to type 'Foo': -!!! Property 'foo' is missing in type 'Number'. +!!! error TS2322: Type 'number' is not assignable to type 'Foo': +!!! error TS2322: Property 'foo' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerConstraint2.errors.txt b/tests/baselines/reference/numericIndexerConstraint2.errors.txt index 1bd9aea28d1..b31688ca349 100644 --- a/tests/baselines/reference/numericIndexerConstraint2.errors.txt +++ b/tests/baselines/reference/numericIndexerConstraint2.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/numericIndexerConstraint2.ts(4,1): error TS2322: Type '{ one: number; }' is not assignable to type '{ [x: string]: Foo; }': + Index signature is missing in type '{ one: number; }'. + + ==== tests/cases/compiler/numericIndexerConstraint2.ts (1 errors) ==== class Foo { foo() { } } var x: { [index: string]: Foo; }; var a: { one: number; }; x = a; ~ -!!! Type '{ one: number; }' is not assignable to type '{ [x: string]: Foo; }': -!!! Index signature is missing in type '{ one: number; }'. \ No newline at end of file +!!! error TS2322: Type '{ one: number; }' is not assignable to type '{ [x: string]: Foo; }': +!!! error TS2322: Index signature is missing in type '{ one: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerConstraint4.types b/tests/baselines/reference/numericIndexerConstraint4.types index f0004e52b45..78b57d4179e 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.types +++ b/tests/baselines/reference/numericIndexerConstraint4.types @@ -22,7 +22,7 @@ var x: { >A : A } = { data: new B() } ->{ data: new B() } : { [x: number]: A; data: B; } +>{ data: new B() } : { [x: number]: undefined; data: B; } >data : B >new B() : B >B : typeof B diff --git a/tests/baselines/reference/numericIndexerConstraint5.errors.txt b/tests/baselines/reference/numericIndexerConstraint5.errors.txt index 9127b58360e..4cccdf0d30b 100644 --- a/tests/baselines/reference/numericIndexerConstraint5.errors.txt +++ b/tests/baselines/reference/numericIndexerConstraint5.errors.txt @@ -1,6 +1,10 @@ +tests/cases/compiler/numericIndexerConstraint5.ts(2,5): error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [x: number]: string; }': + Index signature is missing in type '{ 0: Date; name: string; }'. + + ==== tests/cases/compiler/numericIndexerConstraint5.ts (1 errors) ==== var x = { name: "x", 0: new Date() }; var z: { [name: number]: string } = x; ~ -!!! Type '{ 0: Date; name: string; }' is not assignable to type '{ [x: number]: string; }': -!!! Index signature is missing in type '{ 0: Date; name: string; }'. \ No newline at end of file +!!! error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [x: number]: string; }': +!!! error TS2322: Index signature is missing in type '{ 0: Date; name: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerTyping1.errors.txt b/tests/baselines/reference/numericIndexerTyping1.errors.txt index 5aa0c794357..2c5217bf5c6 100644 --- a/tests/baselines/reference/numericIndexerTyping1.errors.txt +++ b/tests/baselines/reference/numericIndexerTyping1.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/numericIndexerTyping1.ts(9,5): error TS2323: Type 'Date' is not assignable to type 'string'. +tests/cases/compiler/numericIndexerTyping1.ts(12,5): error TS2323: Type 'Date' is not assignable to type 'string'. + + ==== tests/cases/compiler/numericIndexerTyping1.ts (2 errors) ==== interface I { [x: string]: Date; @@ -9,9 +13,9 @@ var i: I; var r: string = i[1]; // error: numeric indexer returns the type of the string indexer ~ -!!! Type 'Date' is not assignable to type 'string'. +!!! error TS2323: Type 'Date' is not assignable to type 'string'. var i2: I2; var r2: string = i2[1]; // error: numeric indexer returns the type of the string indexer ~~ -!!! Type 'Date' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2323: Type 'Date' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerTyping2.errors.txt b/tests/baselines/reference/numericIndexerTyping2.errors.txt index 5d7165dfeec..2736c9d6789 100644 --- a/tests/baselines/reference/numericIndexerTyping2.errors.txt +++ b/tests/baselines/reference/numericIndexerTyping2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/numericIndexerTyping2.ts(9,5): error TS2323: Type 'Date' is not assignable to type 'string'. +tests/cases/compiler/numericIndexerTyping2.ts(12,5): error TS2323: Type 'Date' is not assignable to type 'string'. + + ==== tests/cases/compiler/numericIndexerTyping2.ts (2 errors) ==== class I { [x: string]: Date @@ -9,9 +13,9 @@ var i: I; var r: string = i[1]; // error: numeric indexer returns the type of the string indexer ~ -!!! Type 'Date' is not assignable to type 'string'. +!!! error TS2323: Type 'Date' is not assignable to type 'string'. var i2: I2; var r2: string = i2[1]; // error: numeric indexer returns the type of the string indexere ~~ -!!! Type 'Date' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2323: Type 'Date' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt b/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt index 7ecf5f15824..c5890d7c98c 100644 --- a/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt +++ b/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt @@ -1,34 +1,57 @@ -==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts (6 errors) ==== +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(20,5): error TS1005: ',' expected. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(2,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(3,5): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(4,12): error TS2300: Duplicate identifier '2'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(5,12): error TS2300: Duplicate identifier '2'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(9,5): error TS2300: Duplicate identifier '2'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(10,5): error TS2300: Duplicate identifier '2.'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(14,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(15,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(19,5): error TS2300: Duplicate identifier '2'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(20,5): error TS2300: Duplicate identifier '2'. + + +==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts (11 errors) ==== class C { 1: number; + ~ +!!! error TS2300: Duplicate identifier '1'. 1.0: number; ~~~ -!!! Duplicate identifier '1.0'. - static 2: number; +!!! error TS2300: Duplicate identifier '1.0'. static 2: number; ~ -!!! Duplicate identifier '2'. +!!! error TS2300: Duplicate identifier '2'. + static 2: number; + ~ +!!! error TS2300: Duplicate identifier '2'. } interface I { 2: number; + ~ +!!! error TS2300: Duplicate identifier '2'. 2.: number; ~~ -!!! Duplicate identifier '2.'. +!!! error TS2300: Duplicate identifier '2.'. } var a: { 1: number; + ~ +!!! error TS2300: Duplicate identifier '1'. 1: number; ~ -!!! Duplicate identifier '1'. +!!! error TS2300: Duplicate identifier '1'. } var b = { 2: 1 + ~ +!!! error TS2300: Duplicate identifier '2'. 2: 1 ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~ -!!! Duplicate identifier '2'. +!!! error TS2300: Duplicate identifier '2'. } \ No newline at end of file diff --git a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt index ddde515f498..4ebef99bd07 100644 --- a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt +++ b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt @@ -1,32 +1,50 @@ -==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts (4 errors) ==== +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(4,5): error TS2300: Duplicate identifier '"1"'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(6,5): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(10,5): error TS2300: Duplicate identifier '"1"'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(12,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(16,5): error TS2300: Duplicate identifier '"1"'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(21,5): error TS2300: Duplicate identifier '"0"'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(22,5): error TS2300: Duplicate identifier '0'. + + +==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts (8 errors) ==== // Each of these types has an error in it. // String named and numeric named properties conflict if they would be equivalent after ToNumber on the property name. class C { "1": number; + ~~~ +!!! error TS2300: Duplicate identifier '"1"'. "1.0": number; // not a duplicate 1.0: number; ~~~ -!!! Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1.0'. } interface I { "1": number; + ~~~ +!!! error TS2300: Duplicate identifier '"1"'. "1.": number; // not a duplicate 1: number; ~ -!!! Duplicate identifier '1'. +!!! error TS2300: Duplicate identifier '1'. } var a: { "1": number; + ~~~ +!!! error TS2300: Duplicate identifier '"1"'. 1.0: string; ~~~ -!!! Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1.0'. } var b = { "0": '', + ~~~ +!!! error TS2300: Duplicate identifier '"0"'. 0: '' ~ -!!! Duplicate identifier '0'. +!!! error TS2300: Duplicate identifier '0'. } \ No newline at end of file diff --git a/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt b/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt index 6b3788ff53e..89693f4bced 100644 --- a/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt +++ b/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts(6,2): error TS1128: Declaration or statement expected. +tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts(5,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts (2 errors) ==== class A { constructor(public a1: string) { @@ -5,7 +9,7 @@ } function foo(x = new A(123)) { //should error, 123 is not string ~~~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. }} ~ -!!! Declaration or statement expected. \ No newline at end of file +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt index d4bafcbc9cd..73332ff8926 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,63): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? + + ==== tests/cases/compiler/objectCreationOfElementAccessExpression.ts (4 errors) ==== class Food { private amount: number; @@ -53,12 +59,12 @@ // ElementAccessExpressions can only contain one expression. There should be a parse error here. var foods = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? +!!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? +!!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/objectIndexer.types b/tests/baselines/reference/objectIndexer.types index a2a7f99cf5d..7b42ea51b56 100644 --- a/tests/baselines/reference/objectIndexer.types +++ b/tests/baselines/reference/objectIndexer.types @@ -23,11 +23,11 @@ class Emitter { constructor () { this.listeners = {}; ->this.listeners = {} : { [x: string]: Callback; } +>this.listeners = {} : { [x: string]: undefined; } >this.listeners : IMap >this : Emitter >listeners : IMap ->{} : { [x: string]: Callback; } +>{} : { [x: string]: undefined; } } } diff --git a/tests/baselines/reference/objectLitArrayDeclNoNew.errors.txt b/tests/baselines/reference/objectLitArrayDeclNoNew.errors.txt index b7d5ae0f616..01c0fea7a26 100644 --- a/tests/baselines/reference/objectLitArrayDeclNoNew.errors.txt +++ b/tests/baselines/reference/objectLitArrayDeclNoNew.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/objectLitArrayDeclNoNew.ts(22,20): error TS1109: Expression expected. +tests/cases/compiler/objectLitArrayDeclNoNew.ts(27,1): error TS1128: Declaration or statement expected. + + ==== tests/cases/compiler/objectLitArrayDeclNoNew.ts (2 errors) ==== declare var console; "use strict"; @@ -22,11 +26,11 @@ return { tokens: Gar[],//IToken[], // Missing new. Correct syntax is: tokens: new IToken[] ~ -!!! Expression expected. +!!! error TS1109: Expression expected. endState: state }; } } } ~ -!!! Declaration or statement expected. \ No newline at end of file +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/objectLitIndexerContextualType.errors.txt b/tests/baselines/reference/objectLitIndexerContextualType.errors.txt index b9d92a78385..ca65ee5a5be 100644 --- a/tests/baselines/reference/objectLitIndexerContextualType.errors.txt +++ b/tests/baselines/reference/objectLitIndexerContextualType.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/objectLitIndexerContextualType.ts(12,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/objectLitIndexerContextualType.ts(12,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/objectLitIndexerContextualType.ts(15,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/objectLitIndexerContextualType.ts(15,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/objectLitIndexerContextualType.ts(21,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/objectLitIndexerContextualType.ts(21,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + ==== tests/cases/compiler/objectLitIndexerContextualType.ts (6 errors) ==== interface I { [s: string]: (s: string) => number; @@ -12,16 +20,16 @@ x = { s: t => t * t, // Should error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. }; x = { 0: t => t * t, // Should error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. }; y = { s: t => t * t, // Should not error @@ -29,7 +37,7 @@ y = { 0: t => t * t, // Should error ~ -!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ -!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. }; \ No newline at end of file diff --git a/tests/baselines/reference/objectLitPropertyScoping.errors.txt b/tests/baselines/reference/objectLitPropertyScoping.errors.txt index f317de68e75..420f8a5f192 100644 --- a/tests/baselines/reference/objectLitPropertyScoping.errors.txt +++ b/tests/baselines/reference/objectLitPropertyScoping.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/objectLitPropertyScoping.ts(5,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/objectLitPropertyScoping.ts(8,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/objectLitPropertyScoping.ts (2 errors) ==== // Should compile, x and y should not be picked up from the properties @@ -5,12 +9,12 @@ return { get x() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return x; }, get y() { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return y; }, dist: function () { diff --git a/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt b/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt index 2a3c8d43630..25f51e89882 100644 --- a/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt +++ b/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt @@ -1,6 +1,10 @@ +tests/cases/compiler/objectLitStructuralTypeMismatch.ts(2,5): error TS2322: Type '{ b: number; }' is not assignable to type '{ a: number; }': + Property 'a' is missing in type '{ b: number; }'. + + ==== tests/cases/compiler/objectLitStructuralTypeMismatch.ts (1 errors) ==== // Shouldn't compile var x: { a: number; } = { b: 5 }; ~ -!!! Type '{ b: number; }' is not assignable to type '{ a: number; }': -!!! Property 'a' is missing in type '{ b: number; }'. \ No newline at end of file +!!! error TS2322: Type '{ b: number; }' is not assignable to type '{ a: number; }': +!!! error TS2322: Property 'a' is missing in type '{ b: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLitTargetTypeCallSite.errors.txt b/tests/baselines/reference/objectLitTargetTypeCallSite.errors.txt index 2d12916ab24..761cd24c1a0 100644 --- a/tests/baselines/reference/objectLitTargetTypeCallSite.errors.txt +++ b/tests/baselines/reference/objectLitTargetTypeCallSite.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/objectLitTargetTypeCallSite.ts(5,9): error TS2345: Argument of type '{ a: boolean; b: string; }' is not assignable to parameter of type '{ a: number; b: string; }'. + Types of property 'a' are incompatible: + Type 'boolean' is not assignable to type 'number'. + + ==== tests/cases/compiler/objectLitTargetTypeCallSite.ts (1 errors) ==== function process( x: {a:number; b:string;}) { return x.a; @@ -5,6 +10,6 @@ process({a:true,b:"y"}); ~~~~~~~~~~~~~~ -!!! Argument of type '{ a: boolean; b: string; }' is not assignable to parameter of type '{ a: number; b: string; }'. -!!! Types of property 'a' are incompatible: -!!! Type 'boolean' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2345: Argument of type '{ a: boolean; b: string; }' is not assignable to parameter of type '{ a: number; b: string; }'. +!!! error TS2345: Types of property 'a' are incompatible: +!!! error TS2345: Type 'boolean' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralErrors.errors.txt b/tests/baselines/reference/objectLiteralErrors.errors.txt index 6a36b93edbb..1fc92ac5a48 100644 --- a/tests/baselines/reference/objectLiteralErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralErrors.errors.txt @@ -1,169 +1,340 @@ -==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (61 errors) ==== +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,22): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,22): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,25): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,22): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,24): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,25): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,27): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,18): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(4,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(4,19): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(5,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(5,18): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(6,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(6,21): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(7,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(7,19): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(8,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(8,18): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(9,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(9,20): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(10,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(10,20): error TS2300: Duplicate identifier '"a"'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(11,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(11,20): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(12,13): error TS2300: Duplicate identifier '"a"'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(12,21): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,13): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,21): error TS2300: Duplicate identifier ''1''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,19): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,19): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS2300: Duplicate identifier '0x0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS2300: Duplicate identifier '000'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,13): error TS2300: Duplicate identifier '"100"'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,23): error TS2300: Duplicate identifier '1e2'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,13): error TS2300: Duplicate identifier '0x20'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,22): error TS2300: Duplicate identifier '3.2e1'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(20,13): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(20,25): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,22): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,23): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,22): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,25): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,23): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,22): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS2300: Duplicate identifier '"a"'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,24): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,13): error TS2300: Duplicate identifier '"a"'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,13): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,25): error TS2300: Duplicate identifier ''1''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS2300: Duplicate identifier '0x0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23): error TS2300: Duplicate identifier '000'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,13): error TS2300: Duplicate identifier '"100"'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,27): error TS2300: Duplicate identifier '1e2'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,13): error TS2300: Duplicate identifier '0x20'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26): error TS2300: Duplicate identifier '3.2e1'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,13): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,12): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,43): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,29): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,12): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51): error TS2380: 'get' and 'set' accessor must have the same type. + + +==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (97 errors) ==== // Multiple properties with the same name var e1 = { a: 0, a: 0 }; + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var e2 = { a: '', a: '' }; + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var e3 = { a: 0, a: '' }; + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var e4 = { a: true, a: false }; + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var e5 = { a: {}, a: {} }; + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var e6 = { a: 0, 'a': 0 }; + ~ +!!! error TS2300: Duplicate identifier 'a'. ~~~ -!!! Duplicate identifier ''a''. +!!! error TS2300: Duplicate identifier ''a''. var e7 = { 'a': 0, a: 0 }; + ~~~ +!!! error TS2300: Duplicate identifier ''a''. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var e8 = { 'a': 0, "a": 0 }; + ~~~ +!!! error TS2300: Duplicate identifier ''a''. ~~~ -!!! Duplicate identifier '"a"'. +!!! error TS2300: Duplicate identifier '"a"'. var e9 = { 'a': 0, 'a': 0 }; + ~~~ +!!! error TS2300: Duplicate identifier ''a''. ~~~ -!!! Duplicate identifier ''a''. +!!! error TS2300: Duplicate identifier ''a''. var e10 = { "a": 0, 'a': 0 }; + ~~~ +!!! error TS2300: Duplicate identifier '"a"'. ~~~ -!!! Duplicate identifier ''a''. +!!! error TS2300: Duplicate identifier ''a''. var e11 = { 1.0: 0, '1': 0 }; + ~~~ +!!! error TS2300: Duplicate identifier '1.0'. ~~~ -!!! Duplicate identifier ''1''. +!!! error TS2300: Duplicate identifier ''1''. var e12 = { 0: 0, 0: 0 }; + ~ +!!! error TS2300: Duplicate identifier '0'. ~ -!!! Duplicate identifier '0'. +!!! error TS2300: Duplicate identifier '0'. var e13 = { 0: 0, 0: 0 }; + ~ +!!! error TS2300: Duplicate identifier '0'. ~ -!!! Duplicate identifier '0'. +!!! error TS2300: Duplicate identifier '0'. var e14 = { 0: 0, 0x0: 0 }; + ~ +!!! error TS2300: Duplicate identifier '0'. ~~~ -!!! Duplicate identifier '0x0'. +!!! error TS2300: Duplicate identifier '0x0'. var e14 = { 0: 0, 000: 0 }; ~~~ -!!! Octal literals are not available when targeting ECMAScript 5 and higher. +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. + ~ +!!! error TS2300: Duplicate identifier '0'. ~~~ -!!! Duplicate identifier '000'. +!!! error TS2300: Duplicate identifier '000'. var e15 = { "100": 0, 1e2: 0 }; + ~~~~~ +!!! error TS2300: Duplicate identifier '"100"'. ~~~ -!!! Duplicate identifier '1e2'. +!!! error TS2300: Duplicate identifier '1e2'. var e16 = { 0x20: 0, 3.2e1: 0 }; + ~~~~ +!!! error TS2300: Duplicate identifier '0x20'. ~~~~~ -!!! Duplicate identifier '3.2e1'. +!!! error TS2300: Duplicate identifier '3.2e1'. var e17 = { a: 0, b: 1, a: 0 }; + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. // Accessor and property with the same name var f1 = { a: 0, get a() { return 0; } }; ~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var f2 = { a: '', get a() { return ''; } }; ~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var f3 = { a: 0, get a() { return ''; } }; ~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var f4 = { a: true, get a() { return false; } }; ~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var f5 = { a: {}, get a() { return {}; } }; ~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var f6 = { a: 0, get 'a'() { return 0; } }; ~~~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier 'a'. ~~~ -!!! Duplicate identifier ''a''. +!!! error TS2300: Duplicate identifier ''a''. var f7 = { 'a': 0, get a() { return 0; } }; ~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ +!!! error TS2300: Duplicate identifier ''a''. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. var f8 = { 'a': 0, get "a"() { return 0; } }; ~~~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ +!!! error TS2300: Duplicate identifier ''a''. ~~~ -!!! Duplicate identifier '"a"'. +!!! error TS2300: Duplicate identifier '"a"'. var f9 = { 'a': 0, get 'a'() { return 0; } }; ~~~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ +!!! error TS2300: Duplicate identifier ''a''. ~~~ -!!! Duplicate identifier ''a''. +!!! error TS2300: Duplicate identifier ''a''. var f10 = { "a": 0, get 'a'() { return 0; } }; ~~~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ +!!! error TS2300: Duplicate identifier '"a"'. ~~~ -!!! Duplicate identifier ''a''. +!!! error TS2300: Duplicate identifier ''a''. var f11 = { 1.0: 0, get '1'() { return 0; } }; ~~~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ +!!! error TS2300: Duplicate identifier '1.0'. ~~~ -!!! Duplicate identifier ''1''. +!!! error TS2300: Duplicate identifier ''1''. var f12 = { 0: 0, get 0() { return 0; } }; ~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier '0'. ~ -!!! Duplicate identifier '0'. +!!! error TS2300: Duplicate identifier '0'. var f13 = { 0: 0, get 0() { return 0; } }; ~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier '0'. ~ -!!! Duplicate identifier '0'. +!!! error TS2300: Duplicate identifier '0'. var f14 = { 0: 0, get 0x0() { return 0; } }; ~~~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier '0'. ~~~ -!!! Duplicate identifier '0x0'. +!!! error TS2300: Duplicate identifier '0x0'. var f14 = { 0: 0, get 000() { return 0; } }; ~~~ -!!! Octal literals are not available when targeting ECMAScript 5 and higher. +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. ~~~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier '0'. ~~~ -!!! Duplicate identifier '000'. +!!! error TS2300: Duplicate identifier '000'. var f15 = { "100": 0, get 1e2() { return 0; } }; ~~~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~~~ +!!! error TS2300: Duplicate identifier '"100"'. ~~~ -!!! Duplicate identifier '1e2'. +!!! error TS2300: Duplicate identifier '1e2'. var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; ~~~~~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~~ +!!! error TS2300: Duplicate identifier '0x20'. ~~~~~ -!!! Duplicate identifier '3.2e1'. +!!! error TS2300: Duplicate identifier '3.2e1'. var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; ~ -!!! An object literal cannot have property and accessor with the same name. +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ +!!! error TS2300: Duplicate identifier 'a'. ~ -!!! Duplicate identifier 'a'. +!!! error TS2300: Duplicate identifier 'a'. // Get and set accessor with mismatched type annotations var g1 = { get a(): number { return 4; }, set a(n: string) { } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'get' and 'set' accessor must have the same type. +!!! error TS2380: 'get' and 'set' accessor must have the same type. ~~~~~~~~~~~~~~~~~~~~ -!!! 'get' and 'set' accessor must have the same type. +!!! error TS2380: 'get' and 'set' accessor must have the same type. var g2 = { get a() { return 4; }, set a(n: string) { } }; ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. var g3 = { get a(): number { return undefined; }, set a(n: string) { } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 'get' and 'set' accessor must have the same type. +!!! error TS2380: 'get' and 'set' accessor must have the same type. ~~~~~~~~~~~~~~~~~~~~ -!!! 'get' and 'set' accessor must have the same type. +!!! error TS2380: 'get' and 'set' accessor must have the same type. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralErrorsES3.errors.txt b/tests/baselines/reference/objectLiteralErrorsES3.errors.txt index b928d9546a4..2788c23a278 100644 --- a/tests/baselines/reference/objectLiteralErrorsES3.errors.txt +++ b/tests/baselines/reference/objectLiteralErrorsES3.errors.txt @@ -1,15 +1,21 @@ +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrorsES3.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrorsES3.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrorsES3.ts(4,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrorsES3.ts(4,40): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrorsES3.ts (4 errors) ==== var e1 = { get a() { return 4; } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var e2 = { set a(n) { } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var e3 = { get a() { return ''; }, set a(n) { } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt index f4eef960bb9..f031031b0a8 100644 --- a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt +++ b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt @@ -1,3 +1,12 @@ +tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(8,4): error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'. + Property 'value' is missing in type '{ hello: number; }'. +tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(11,4): error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. + Property 'value' is missing in type '{ toString: (s: string) => string; }'. +tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(12,4): error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. + Property 'value' is missing in type '{ toString: (s: string) => string; }'. +tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(13,36): error TS2339: Property 'uhhh' does not exist on type 'string'. + + ==== tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts (4 errors) ==== interface I { value: string; @@ -8,18 +17,18 @@ f2({ hello: 1 }) // error ~~~~~~~~~~~~ -!!! Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'. -!!! Property 'value' is missing in type '{ hello: number; }'. +!!! error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'. +!!! error TS2345: Property 'value' is missing in type '{ hello: number; }'. f2({ value: '' }) // missing toString satisfied by Object's member f2({ value: '', what: 1 }) // missing toString satisfied by Object's member f2({ toString: (s) => s }) // error, missing property value from ArgsString ~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. -!!! Property 'value' is missing in type '{ toString: (s: string) => string; }'. +!!! error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. +!!! error TS2345: Property 'value' is missing in type '{ toString: (s: string) => string; }'. f2({ toString: (s: string) => s }) // error, missing property value from ArgsString ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. -!!! Property 'value' is missing in type '{ toString: (s: string) => string; }'. +!!! error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. +!!! error TS2345: Property 'value' is missing in type '{ toString: (s: string) => string; }'. f2({ value: '', toString: (s) => s.uhhh }) // error ~~~~ -!!! Property 'uhhh' does not exist on type 'string'. \ No newline at end of file +!!! error TS2339: Property 'uhhh' does not exist on type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt index 3b6995e0623..7cb3304aa2f 100644 --- a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt +++ b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt @@ -1,3 +1,17 @@ +tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(8,4): error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'. + Property 'value' is missing in type '{ hello: number; }'. +tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(9,4): error TS2345: Argument of type '{ value: string; }' is not assignable to parameter of type 'I2'. + Property 'doStuff' is missing in type '{ value: string; }'. +tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(10,4): error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'. + Property 'doStuff' is missing in type '{ value: string; what: number; }'. +tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(11,4): error TS2345: Argument of type '{ toString: (s: any) => any; }' is not assignable to parameter of type 'I2'. + Property 'value' is missing in type '{ toString: (s: any) => any; }'. +tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(12,4): error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I2'. + Property 'value' is missing in type '{ toString: (s: string) => string; }'. +tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(13,4): error TS2345: Argument of type '{ value: string; toString: (s: any) => any; }' is not assignable to parameter of type 'I2'. + Property 'doStuff' is missing in type '{ value: string; toString: (s: any) => any; }'. + + ==== tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts (6 errors) ==== interface I2 { value: string; @@ -8,25 +22,25 @@ f2({ hello: 1 }) ~~~~~~~~~~~~ -!!! Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'. -!!! Property 'value' is missing in type '{ hello: number; }'. +!!! error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'. +!!! error TS2345: Property 'value' is missing in type '{ hello: number; }'. f2({ value: '' }) ~~~~~~~~~~~~~ -!!! Argument of type '{ value: string; }' is not assignable to parameter of type 'I2'. -!!! Property 'doStuff' is missing in type '{ value: string; }'. +!!! error TS2345: Argument of type '{ value: string; }' is not assignable to parameter of type 'I2'. +!!! error TS2345: Property 'doStuff' is missing in type '{ value: string; }'. f2({ value: '', what: 1 }) ~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'. -!!! Property 'doStuff' is missing in type '{ value: string; what: number; }'. +!!! error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'. +!!! error TS2345: Property 'doStuff' is missing in type '{ value: string; what: number; }'. f2({ toString: (s) => s }) ~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '{ toString: (s: any) => any; }' is not assignable to parameter of type 'I2'. -!!! Property 'value' is missing in type '{ toString: (s: any) => any; }'. +!!! error TS2345: Argument of type '{ toString: (s: any) => any; }' is not assignable to parameter of type 'I2'. +!!! error TS2345: Property 'value' is missing in type '{ toString: (s: any) => any; }'. f2({ toString: (s: string) => s }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I2'. -!!! Property 'value' is missing in type '{ toString: (s: string) => string; }'. +!!! error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I2'. +!!! error TS2345: Property 'value' is missing in type '{ toString: (s: string) => string; }'. f2({ value: '', toString: (s) => s.uhhh }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '{ value: string; toString: (s: any) => any; }' is not assignable to parameter of type 'I2'. -!!! Property 'doStuff' is missing in type '{ value: string; toString: (s: any) => any; }'. \ No newline at end of file +!!! error TS2345: Argument of type '{ value: string; toString: (s: any) => any; }' is not assignable to parameter of type 'I2'. +!!! error TS2345: Property 'doStuff' is missing in type '{ value: string; toString: (s: any) => any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt b/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt index 9019cd7246a..4e04b856d8c 100644 --- a/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt +++ b/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt @@ -1,35 +1,71 @@ +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(2,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(2,50): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(3,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(3,50): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(4,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(4,51): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(5,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(5,49): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(6,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(6,51): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(7,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(7,50): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(18,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(22,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(26,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(30,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(35,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(35,62): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(36,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(36,69): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(37,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(37,59): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(38,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(38,60): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(42,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(43,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(50,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(55,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(60,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(67,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(68,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(76,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(77,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts (34 errors) ==== // Get and set accessor with the same name var sameName1a = { get 'a'() { return ''; }, set a(n) { var p = n; var p: string; } }; ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var sameName2a = { get 0.0() { return ''; }, set 0(n) { var p = n; var p: string; } }; ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var sameName3a = { get 0x20() { return ''; }, set 3.2e1(n) { var p = n; var p: string; } }; ~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var sameName4a = { get ''() { return ''; }, set ""(n) { var p = n; var p: string; } }; ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var sameName5a = { get '\t'() { return ''; }, set '\t'(n) { var p = n; var p: string; } }; ~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var sameName6a = { get 'a'() { return ''; }, set a(n) { var p = n; var p: string; } }; ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. // PropertyName CallSignature{FunctionBody} is equivalent to PropertyName:function CallSignature{FunctionBody} var callSig1 = { num(n: number) { return '' } }; @@ -42,58 +78,58 @@ // Get accessor only, type of the property is the annotated return type of the get accessor var getter1 = { get x(): string { return undefined; } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var getter1: { x: string; } // Get accessor only, type of the property is the inferred return type of the get accessor var getter2 = { get x() { return ''; } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var getter2: { x: string; } // Set accessor only, type of the property is the param type of the set accessor var setter1 = { set x(n: number) { } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var setter1: { x: number }; // Set accessor only, type of the property is Any for an unannotated set accessor var setter2 = { set x(n) { } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var setter2: { x: any }; var anyVar: any; // Get and set accessor with matching type annotations var sameType1 = { get x(): string { return undefined; }, set x(n: string) { } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var sameType2 = { get x(): Array { return undefined; }, set x(n: number[]) { } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var sameType3 = { get x(): any { return undefined; }, set x(n: typeof anyVar) { } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var sameType4 = { get x(): Date { return undefined; }, set x(n: Date) { } }; ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. // Type of unannotated get accessor return type is the type annotation of the set accessor param var setParamType1 = { set n(x: (t: string) => void) { }, ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. get n() { return (t) => { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var p: string; var p = t; } @@ -102,35 +138,35 @@ var setParamType2 = { get n() { return (t) => { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var p: string; var p = t; } }, set n(x: (t: string) => void) { } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. }; // Type of unannotated set accessor parameter is the return type annotation of the get accessor var getParamType1 = { set n(x) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var y = x; var y: string; }, get n() { return ''; } ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. }; var getParamType2 = { get n() { return ''; }, ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. set n(x) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var y = x; var y: string; } @@ -140,10 +176,10 @@ var getParamType3 = { get n() { return ''; }, ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. set n(x) { ~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var y = x; var y: string; } diff --git a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt index 019d5c2733a..18aa2c63160 100644 --- a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [x: string]: A; [x: number]: B; }': + Index signatures are incompatible: + Type 'A' is not assignable to type 'B': + Property 'y' is missing in type 'A'. + + ==== tests/cases/compiler/objectLiteralIndexerErrors.ts (1 errors) ==== interface A { x: number; @@ -13,8 +19,8 @@ var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A ~~ -!!! Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [x: string]: A; [x: number]: B; }': -!!! Index signatures are incompatible: -!!! Type 'A' is not assignable to type 'B': -!!! Property 'y' is missing in type 'A'. +!!! error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [x: string]: A; [x: number]: B; }': +!!! error TS2322: Index signatures are incompatible: +!!! error TS2322: Type 'A' is not assignable to type 'B': +!!! error TS2322: Property 'y' is missing in type 'A'. o1 = { x: c, 0: a }; // string indexer is any, number indexer is A \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralParameterResolution.errors.txt b/tests/baselines/reference/objectLiteralParameterResolution.errors.txt index 4380a976380..415b4677cd8 100644 --- a/tests/baselines/reference/objectLiteralParameterResolution.errors.txt +++ b/tests/baselines/reference/objectLiteralParameterResolution.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/objectLiteralParameterResolution.ts(9,14): error TS2304: Cannot find name 'wrapSuccessCallback'. +tests/cases/compiler/objectLiteralParameterResolution.ts(9,34): error TS2304: Cannot find name 'requestContext'. +tests/cases/compiler/objectLiteralParameterResolution.ts(9,50): error TS2304: Cannot find name 'callback'. +tests/cases/compiler/objectLiteralParameterResolution.ts(10,12): error TS2304: Cannot find name 'wrapErrorCallback'. +tests/cases/compiler/objectLiteralParameterResolution.ts(10,30): error TS2304: Cannot find name 'requestContext'. +tests/cases/compiler/objectLiteralParameterResolution.ts(10,46): error TS2304: Cannot find name 'errorCallback'. + + ==== tests/cases/compiler/objectLiteralParameterResolution.ts (6 errors) ==== interface Foo{ extend(target: T, ...objs: any[]): T; @@ -9,18 +17,18 @@ data: "data" , success: wrapSuccessCallback(requestContext, callback) , ~~~~~~~~~~~~~~~~~~~ -!!! Cannot find name 'wrapSuccessCallback'. +!!! error TS2304: Cannot find name 'wrapSuccessCallback'. ~~~~~~~~~~~~~~ -!!! Cannot find name 'requestContext'. +!!! error TS2304: Cannot find name 'requestContext'. ~~~~~~~~ -!!! Cannot find name 'callback'. +!!! error TS2304: Cannot find name 'callback'. error: wrapErrorCallback(requestContext, errorCallback) , ~~~~~~~~~~~~~~~~~ -!!! Cannot find name 'wrapErrorCallback'. +!!! error TS2304: Cannot find name 'wrapErrorCallback'. ~~~~~~~~~~~~~~ -!!! Cannot find name 'requestContext'. +!!! error TS2304: Cannot find name 'requestContext'. ~~~~~~~~~~~~~ -!!! Cannot find name 'errorCallback'. +!!! error TS2304: Cannot find name 'errorCallback'. dataType: "json" , converters: { "text json": "" }, traditional: true , diff --git a/tests/baselines/reference/objectLiteralReferencingInternalProperties.errors.txt b/tests/baselines/reference/objectLiteralReferencingInternalProperties.errors.txt index c5bffb34662..d9785df1467 100644 --- a/tests/baselines/reference/objectLiteralReferencingInternalProperties.errors.txt +++ b/tests/baselines/reference/objectLiteralReferencingInternalProperties.errors.txt @@ -1,4 +1,7 @@ +tests/cases/compiler/objectLiteralReferencingInternalProperties.ts(1,21): error TS2304: Cannot find name 'b'. + + ==== tests/cases/compiler/objectLiteralReferencingInternalProperties.ts (1 errors) ==== var a = { b: 10, c: b }; // Should give error for attempting to reference b. ~ -!!! Cannot find name 'b'. \ No newline at end of file +!!! error TS2304: Cannot find name 'b'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralWithGetAccessorInsideFunction.errors.txt b/tests/baselines/reference/objectLiteralWithGetAccessorInsideFunction.errors.txt index 7c3f272c683..1b1426e28b2 100644 --- a/tests/baselines/reference/objectLiteralWithGetAccessorInsideFunction.errors.txt +++ b/tests/baselines/reference/objectLiteralWithGetAccessorInsideFunction.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/objectLiteralWithGetAccessorInsideFunction.ts(3,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/objectLiteralWithGetAccessorInsideFunction.ts (1 errors) ==== function bar() { var x = { get _extraOccluded() { ~~~~~~~~~~~~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var occluded = 0; return occluded; }, diff --git a/tests/baselines/reference/objectLiteralWithNumericPropertyName.errors.txt b/tests/baselines/reference/objectLiteralWithNumericPropertyName.errors.txt index cea10abde8d..00f724ee0a7 100644 --- a/tests/baselines/reference/objectLiteralWithNumericPropertyName.errors.txt +++ b/tests/baselines/reference/objectLiteralWithNumericPropertyName.errors.txt @@ -1,12 +1,17 @@ +tests/cases/compiler/objectLiteralWithNumericPropertyName.ts(4,5): error TS2322: Type '{ 0: number; }' is not assignable to type 'A': + Types of property '0' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/objectLiteralWithNumericPropertyName.ts (1 errors) ==== interface A { 0: string; } var x: A = { ~ -!!! Type '{ 0: number; }' is not assignable to type 'A': -!!! Types of property '0' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '{ 0: number; }' is not assignable to type 'A': +!!! error TS2322: Types of property '0' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. 0: 3 }; \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt index 65b100d9b8b..19c12ebf62f 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'constructor' of type 'Function' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'data' of type 'A' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'hasOwnProperty' of type '(v: string) => boolean' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: string) => boolean' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'toString' of type '() => string' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'valueOf' of type '() => Object' is not assignable to string index type 'Object'. + + ==== tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts (8 errors) ==== class A { foo: string; @@ -11,21 +21,21 @@ data: A; [x: string]: Object; ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'constructor' of type 'Function' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'constructor' of type 'Function' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'data' of type 'A' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'data' of type 'A' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'hasOwnProperty' of type '(v: string) => boolean' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'hasOwnProperty' of type '(v: string) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'propertyIsEnumerable' of type '(v: string) => boolean' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'propertyIsEnumerable' of type '(v: string) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'toString' of type '() => string' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'toString' of type '() => string' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'valueOf' of type '() => Object' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'valueOf' of type '() => Object' is not assignable to string index type 'Object'. } class C { diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat.errors.txt index a592cca8f5f..42395ccf0b5 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat.errors.txt @@ -1,3 +1,17 @@ +tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts(7,1): error TS2322: Type 'I' is not assignable to type 'Object': + Types of property 'toString' are incompatible: + Type '() => void' is not assignable to type '() => string': + Type 'void' is not assignable to type 'string'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts(14,1): error TS2322: Type 'C' is not assignable to type 'Object': + Types of property 'toString' are incompatible: + Type '() => void' is not assignable to type '() => string': + Type 'void' is not assignable to type 'string'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts(20,1): error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object': + Types of property 'toString' are incompatible: + Type '() => void' is not assignable to type '() => string': + Type 'void' is not assignable to type 'string'. + + ==== tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts (3 errors) ==== interface I { toString(): void; @@ -7,10 +21,10 @@ var o: Object; o = i; // error ~ -!!! Type 'I' is not assignable to type 'Object': -!!! Types of property 'toString' are incompatible: -!!! Type '() => void' is not assignable to type '() => string': -!!! Type 'void' is not assignable to type 'string'. +!!! error TS2322: Type 'I' is not assignable to type 'Object': +!!! error TS2322: Types of property 'toString' are incompatible: +!!! error TS2322: Type '() => void' is not assignable to type '() => string': +!!! error TS2322: Type 'void' is not assignable to type 'string'. i = o; // ok class C { @@ -19,10 +33,10 @@ var c: C; o = c; // error ~ -!!! Type 'C' is not assignable to type 'Object': -!!! Types of property 'toString' are incompatible: -!!! Type '() => void' is not assignable to type '() => string': -!!! Type 'void' is not assignable to type 'string'. +!!! error TS2322: Type 'C' is not assignable to type 'Object': +!!! error TS2322: Types of property 'toString' are incompatible: +!!! error TS2322: Type '() => void' is not assignable to type '() => string': +!!! error TS2322: Type 'void' is not assignable to type 'string'. c = o; // ok var a = { @@ -30,8 +44,8 @@ } o = a; // error ~ -!!! Type '{ toString: () => void; }' is not assignable to type 'Object': -!!! Types of property 'toString' are incompatible: -!!! Type '() => void' is not assignable to type '() => string': -!!! Type 'void' is not assignable to type 'string'. +!!! error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object': +!!! error TS2322: Types of property 'toString' are incompatible: +!!! error TS2322: Type '() => void' is not assignable to type '() => string': +!!! error TS2322: Type 'void' is not assignable to type 'string'. a = o; // ok \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt index 7bfc0894d3a..4a64f34aa5e 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt +++ b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt @@ -1,3 +1,25 @@ +tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(7,1): error TS2322: Type 'I' is not assignable to type 'Object': + Types of property 'toString' are incompatible: + Type '() => number' is not assignable to type '() => string': + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I': + Types of property 'toString' are incompatible: + Type '() => string' is not assignable to type '() => number': + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(14,1): error TS2322: Type 'C' is not assignable to type 'Object': + Types of property 'toString' are incompatible: + Type '() => number' is not assignable to type '() => string': + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(15,1): error TS2322: Type 'Object' is not assignable to type 'C': + Types of property 'toString' are incompatible: + Type '() => string' is not assignable to type '() => number': + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(20,1): error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object': + Types of property 'toString' are incompatible: + Type '() => void' is not assignable to type '() => string': + Type 'void' is not assignable to type 'string'. + + ==== tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts (5 errors) ==== interface I { toString(): number; @@ -7,16 +29,16 @@ var o: Object; o = i; // error ~ -!!! Type 'I' is not assignable to type 'Object': -!!! Types of property 'toString' are incompatible: -!!! Type '() => number' is not assignable to type '() => string': -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'I' is not assignable to type 'Object': +!!! error TS2322: Types of property 'toString' are incompatible: +!!! error TS2322: Type '() => number' is not assignable to type '() => string': +!!! error TS2322: Type 'number' is not assignable to type 'string'. i = o; // error ~ -!!! Type 'Object' is not assignable to type 'I': -!!! Types of property 'toString' are incompatible: -!!! Type '() => string' is not assignable to type '() => number': -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'Object' is not assignable to type 'I': +!!! error TS2322: Types of property 'toString' are incompatible: +!!! error TS2322: Type '() => string' is not assignable to type '() => number': +!!! error TS2322: Type 'string' is not assignable to type 'number'. class C { toString(): number { return 1; } @@ -24,24 +46,24 @@ var c: C; o = c; // error ~ -!!! Type 'C' is not assignable to type 'Object': -!!! Types of property 'toString' are incompatible: -!!! Type '() => number' is not assignable to type '() => string': -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'C' is not assignable to type 'Object': +!!! error TS2322: Types of property 'toString' are incompatible: +!!! error TS2322: Type '() => number' is not assignable to type '() => string': +!!! error TS2322: Type 'number' is not assignable to type 'string'. c = o; // error ~ -!!! Type 'Object' is not assignable to type 'C': -!!! Types of property 'toString' are incompatible: -!!! Type '() => string' is not assignable to type '() => number': -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'Object' is not assignable to type 'C': +!!! error TS2322: Types of property 'toString' are incompatible: +!!! error TS2322: Type '() => string' is not assignable to type '() => number': +!!! error TS2322: Type 'string' is not assignable to type 'number'. var a = { toString: () => { } } o = a; // error ~ -!!! Type '{ toString: () => void; }' is not assignable to type 'Object': -!!! Types of property 'toString' are incompatible: -!!! Type '() => void' is not assignable to type '() => string': -!!! Type 'void' is not assignable to type 'string'. +!!! error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object': +!!! error TS2322: Types of property 'toString' are incompatible: +!!! error TS2322: Type '() => void' is not assignable to type '() => string': +!!! error TS2322: Type 'void' is not assignable to type 'string'. a = o; // ok \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeLiteralSyntax2.errors.txt b/tests/baselines/reference/objectTypeLiteralSyntax2.errors.txt index 9608cf84421..a774115e350 100644 --- a/tests/baselines/reference/objectTypeLiteralSyntax2.errors.txt +++ b/tests/baselines/reference/objectTypeLiteralSyntax2.errors.txt @@ -1,8 +1,12 @@ +tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts(2,16): error TS1005: ';' expected. +tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts(12,22): error TS1005: ';' expected. + + ==== tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts (2 errors) ==== var x: { foo: string, ~ -!!! ';' expected. +!!! error TS1005: ';' expected. bar: string } @@ -14,4 +18,4 @@ var z: { foo: string bar: string } ~~~ -!!! ';' expected. \ No newline at end of file +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt index 8fbbcddff0b..982fcf05b3b 100644 --- a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2323: Type 'Object' is not assignable to type 'I'. +tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2323: Type 'Object' is not assignable to type '() => void'. + + ==== tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ==== interface I { (): void; @@ -8,7 +12,7 @@ f = i; i = f; ~ -!!! Type 'Object' is not assignable to type 'I'. +!!! error TS2323: Type 'Object' is not assignable to type 'I'. var a: { (): void @@ -16,4 +20,4 @@ f = a; a = f; ~ -!!! Type 'Object' is not assignable to type '() => void'. \ No newline at end of file +!!! error TS2323: Type 'Object' is not assignable to type '() => void'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithConstructSignatureAppearsToBeFunctionType.errors.txt b/tests/baselines/reference/objectTypeWithConstructSignatureAppearsToBeFunctionType.errors.txt index cb6bedb2179..1ae1e2d22a1 100644 --- a/tests/baselines/reference/objectTypeWithConstructSignatureAppearsToBeFunctionType.errors.txt +++ b/tests/baselines/reference/objectTypeWithConstructSignatureAppearsToBeFunctionType.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/members/objectTypeWithConstructSignatureAppearsToBeFunctionType.ts(8,18): error TS2348: Value of type 'I' is not callable. Did you mean to include 'new'? +tests/cases/conformance/types/members/objectTypeWithConstructSignatureAppearsToBeFunctionType.ts(16,18): error TS2348: Value of type 'new () => number' is not callable. Did you mean to include 'new'? + + ==== tests/cases/conformance/types/members/objectTypeWithConstructSignatureAppearsToBeFunctionType.ts (2 errors) ==== // no errors expected below @@ -8,7 +12,7 @@ var i: I; var r2: number = i(); ~~~ -!!! Value of type 'I' is not callable. Did you mean to include 'new'? +!!! error TS2348: Value of type 'I' is not callable. Did you mean to include 'new'? var r2b: number = new i(); var r2c: (x: any, y?: any) => any = i.apply; @@ -18,6 +22,6 @@ var r4: number = b(); ~~~ -!!! Value of type 'new () => number' is not callable. Did you mean to include 'new'? +!!! error TS2348: Value of type 'new () => number' is not callable. Did you mean to include 'new'? var r4b: number = new b(); var r4c: (x: any, y?: any) => any = b.apply; \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt index 9696c68769d..1544fb5bebe 100644 --- a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2323: Type 'Object' is not assignable to type 'I'. +tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2323: Type 'Object' is not assignable to type 'new () => any'. + + ==== tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ==== interface I { new(): any; @@ -8,7 +12,7 @@ f = i; i = f; ~ -!!! Type 'Object' is not assignable to type 'I'. +!!! error TS2323: Type 'Object' is not assignable to type 'I'. var a: { new(): any @@ -16,4 +20,4 @@ f = a; a = f; ~ -!!! Type 'Object' is not assignable to type 'new () => any'. \ No newline at end of file +!!! error TS2323: Type 'Object' is not assignable to type 'new () => any'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt b/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt index 2049e3c9607..c89cd04d1ee 100644 --- a/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt +++ b/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt @@ -1,57 +1,83 @@ -==== tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts (12 errors) ==== +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(5,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(6,5): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(7,5): error TS2300: Duplicate identifier '1.'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(8,5): error TS2300: Duplicate identifier '1.00'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(12,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(13,5): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(14,5): error TS2300: Duplicate identifier '1.'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(15,5): error TS2300: Duplicate identifier '1.00'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(19,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(20,5): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(21,5): error TS2300: Duplicate identifier '1.'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(22,5): error TS2300: Duplicate identifier '1.00'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(26,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(27,5): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(28,5): error TS2300: Duplicate identifier '1.'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(29,5): error TS2300: Duplicate identifier '1.00'. + + +==== tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts (16 errors) ==== // numeric properties must be distinct after a ToNumber operation // so the below are all errors class C { 1; + ~ +!!! error TS2300: Duplicate identifier '1'. 1.0; ~~~ -!!! Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1.0'. 1.; ~~ -!!! Duplicate identifier '1.'. +!!! error TS2300: Duplicate identifier '1.'. 1.00; ~~~~ -!!! Duplicate identifier '1.00'. +!!! error TS2300: Duplicate identifier '1.00'. } interface I { 1; + ~ +!!! error TS2300: Duplicate identifier '1'. 1.0; ~~~ -!!! Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1.0'. 1.; ~~ -!!! Duplicate identifier '1.'. +!!! error TS2300: Duplicate identifier '1.'. 1.00; ~~~~ -!!! Duplicate identifier '1.00'. +!!! error TS2300: Duplicate identifier '1.00'. } var a: { 1; + ~ +!!! error TS2300: Duplicate identifier '1'. 1.0; ~~~ -!!! Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1.0'. 1.; ~~ -!!! Duplicate identifier '1.'. +!!! error TS2300: Duplicate identifier '1.'. 1.00; ~~~~ -!!! Duplicate identifier '1.00'. +!!! error TS2300: Duplicate identifier '1.00'. } var b = { 1: 1, + ~ +!!! error TS2300: Duplicate identifier '1'. 1.0: 1, ~~~ -!!! Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1.0'. 1.: 1, ~~ -!!! Duplicate identifier '1.'. +!!! error TS2300: Duplicate identifier '1.'. 1.00: 1 ~~~~ -!!! Duplicate identifier '1.00'. +!!! error TS2300: Duplicate identifier '1.00'. } \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty.errors.txt b/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty.errors.txt index 21ec31d4085..6a6fe5965fc 100644 --- a/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty.errors.txt +++ b/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedProperty.ts(13,1): error TS2322: Type 'List' is not assignable to type 'List': + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedProperty.ts (1 errors) ==== // Basic recursive type @@ -13,5 +17,5 @@ list1 = list2; // ok list1 = list3; // error ~~~~~ -!!! Type 'List' is not assignable to type 'List': -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'List' is not assignable to type 'List': +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty2.errors.txt b/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty2.errors.txt index 7e209541a00..bcabfeaa183 100644 --- a/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty2.errors.txt +++ b/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty2.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedProperty2.ts(13,1): error TS2322: Type 'List' is not assignable to type 'List': + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedProperty2.ts (1 errors) ==== // Basic recursive type @@ -13,5 +17,5 @@ list1 = list2; // ok list1 = list3; // error ~~~~~ -!!! Type 'List' is not assignable to type 'List': -!!! Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'List' is not assignable to type 'List': +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt b/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt index 123a8289f7f..9dc658d1850 100644 --- a/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt +++ b/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt @@ -1,3 +1,18 @@ +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(20,1): error TS2322: Type 'MyList' is not assignable to type 'List': + Types of property 'data' are incompatible: + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(22,1): error TS2322: Type 'MyList' is not assignable to type 'List': + Types of property 'data' are incompatible: + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(30,5): error TS2323: Type 'U' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(31,5): error TS2323: Type 'T' is not assignable to type 'U'. +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(41,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(42,5): error TS2323: Type 'U' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(43,5): error TS2323: Type 'T' is not assignable to type 'U'. +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(48,5): error TS2323: Type 'T' is not assignable to type 'List'. +tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(50,5): error TS2323: Type 'T' is not assignable to type 'MyList'. + + ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts (9 errors) ==== // Types with infinitely expanding recursive types are type checked nominally @@ -20,15 +35,15 @@ list1 = myList1; // error, not nominally equal list1 = myList2; // error, type mismatch ~~~~~ -!!! Type 'MyList' is not assignable to type 'List': -!!! Types of property 'data' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'MyList' is not assignable to type 'List': +!!! error TS2322: Types of property 'data' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. list2 = myList1; // error, not nominally equal ~~~~~ -!!! Type 'MyList' is not assignable to type 'List': -!!! Types of property 'data' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'MyList' is not assignable to type 'List': +!!! error TS2322: Types of property 'data' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. list2 = myList2; // error, type mismatch var rList1 = new List>(); @@ -38,10 +53,10 @@ function foo, U extends MyList>(t: T, u: U) { t = u; // error ~ -!!! Type 'U' is not assignable to type 'T'. +!!! error TS2323: Type 'U' is not assignable to type 'T'. u = t; // error ~ -!!! Type 'T' is not assignable to type 'U'. +!!! error TS2323: Type 'T' is not assignable to type 'U'. var a: List; var b: MyList; @@ -53,23 +68,23 @@ function foo2>(t: T, u: U) { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. t = u; // error ~ -!!! Type 'U' is not assignable to type 'T'. +!!! error TS2323: Type 'U' is not assignable to type 'T'. u = t; // was error, ok after constraint made illegal, doesn't matter ~ -!!! Type 'T' is not assignable to type 'U'. +!!! error TS2323: Type 'T' is not assignable to type 'U'. var a: List; var b: MyList; a = t; // error ~ -!!! Type 'T' is not assignable to type 'List'. +!!! error TS2323: Type 'T' is not assignable to type 'List'. a = u; // error b = t; // ok ~ -!!! Type 'T' is not assignable to type 'MyList'. +!!! error TS2323: Type 'T' is not assignable to type 'MyList'. b = u; // ok } \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt b/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt index 8d05f4aa45a..d09701c3b06 100644 --- a/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt +++ b/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt @@ -1,3 +1,12 @@ +tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'constructor' of type 'Function' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'hasOwnProperty' of type '(v: string) => boolean' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: string) => boolean' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'toString' of type '() => string' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'valueOf' of type '() => Object' is not assignable to string index type 'Object'. + + ==== tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts (7 errors) ==== // object types can define string indexers that are more specific than the default 'any' that would be returned // no errors expected below @@ -5,19 +14,19 @@ interface Object { [x: string]: Object; ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'constructor' of type 'Function' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'constructor' of type 'Function' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'hasOwnProperty' of type '(v: string) => boolean' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'hasOwnProperty' of type '(v: string) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'propertyIsEnumerable' of type '(v: string) => boolean' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'propertyIsEnumerable' of type '(v: string) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'toString' of type '() => string' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'toString' of type '() => string' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! Property 'valueOf' of type '() => Object' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'valueOf' of type '() => Object' is not assignable to string index type 'Object'. } var o = {}; var r = o['']; // should be Object diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures3.errors.txt b/tests/baselines/reference/objectTypesIdentityWithCallSignatures3.errors.txt index 994ce2a1cef..3e7cbacb759 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures3.errors.txt +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures3.errors.txt @@ -1,3 +1,7 @@ +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures3.ts(21,25): error TS2304: Cannot find name 'b'. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures3.ts(22,25): error TS2304: Cannot find name 'b'. + + ==== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures3.ts (2 errors) ==== // object types are identical structurally @@ -21,10 +25,10 @@ function foo4(x: typeof b); ~ -!!! Cannot find name 'b'. +!!! error TS2304: Cannot find name 'b'. function foo4(x: typeof b); // error ~ -!!! Cannot find name 'b'. +!!! error TS2304: Cannot find name 'b'. function foo4(x: any) { } function foo13(x: I); diff --git a/tests/baselines/reference/objectTypesIdentityWithComplexConstraints.errors.txt b/tests/baselines/reference/objectTypesIdentityWithComplexConstraints.errors.txt index c3032d3eac1..dce23ed96e5 100644 --- a/tests/baselines/reference/objectTypesIdentityWithComplexConstraints.errors.txt +++ b/tests/baselines/reference/objectTypesIdentityWithComplexConstraints.errors.txt @@ -1,3 +1,6 @@ +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithComplexConstraints.ts(2,8): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithComplexConstraints.ts (1 errors) ==== interface A { (x: T, y: T): void ~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } interface B { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.errors.txt b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.errors.txt index 3dc6c5f5d34..b1221bb21aa 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.errors.txt +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts(6,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts(9,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts(13,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts(17,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts(21,13): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts(26,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts(29,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts(30,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts (8 errors) ==== // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, @@ -6,45 +16,45 @@ class A { foo(x: T, y: U): string { return null; } ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } class B> { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo(x: T, y: U): string { return null; } } class C { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo(x: T, y: U): string { return null; } } class D { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo(x: T, y: U): string { return null; } } interface I { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo(x: T, y: U): string; } interface I2 { foo(x: T, y: U): string; ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } var a: { foo>(x: T, y: U): string } ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var b = { foo(x: T, y: U) { return ''; } }; ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. function foo1(x: A); function foo1(x: A); // error diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.errors.txt b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.errors.txt index 8ec2435ba29..42e7f11e939 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.errors.txt +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.errors.txt @@ -1,3 +1,13 @@ +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts(15,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts(18,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts(22,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts(26,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts(30,13): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts(35,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts(38,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts(39,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts (8 errors) ==== // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, @@ -15,45 +25,45 @@ class A { foo(x: T, y: U): string { return null; } ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } class B { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo(x: T, y: U): string { return null; } } class C { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo(x: T, y: U): string { return null; } } class D> { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo(x: T, y: U): string { return null; } } interface I> { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. foo(x: T, y: U): string; } interface I2 { foo>(x: T, y: U): string; ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } var a: { foo(x: T, y: U): string } ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var b = { foo(x: T, y: U) { return ''; } }; ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. function foo1(x: A); function foo1(x: A); // error diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.errors.txt b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.errors.txt index 7f1d923565a..536be73b5cc 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.errors.txt +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.errors.txt @@ -1,3 +1,12 @@ +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts(5,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts(9,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts(13,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts(17,13): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts(22,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts(25,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts(26,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts (7 errors) ==== // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, @@ -5,40 +14,40 @@ class B> { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. constructor(x: T, y: U) { return null; } } class C { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. constructor(x: T, y: U) { return null; } } class D { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. constructor(x: T, y: U) { return null; } } interface I { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. new(x: T, y: U): string; } interface I2 { new(x: T, y: U): string; ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } var a: { new>(x: T, y: U): string } ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var b = { new(x: T, y: U) { return ''; } }; // not a construct signature, function called new ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. function foo1b(x: B, Array>); function foo1b(x: B, Array>); // error diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.errors.txt b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.errors.txt index 053dec33b4a..33a62356d1c 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.errors.txt +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.errors.txt @@ -1,3 +1,12 @@ +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts(14,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts(18,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts(22,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts(26,13): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts(31,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts(34,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts(35,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. + + ==== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts (7 errors) ==== // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, @@ -14,40 +23,40 @@ class B { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. constructor(x: T, y: U) { return null; } } class C { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. constructor(x: T, y: U) { return null; } } class D> { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. constructor(x: T, y: U) { return null; } } interface I> { ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. new(x: T, y: U): string; } interface I2 { new>(x: T, y: U): string; ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. } var a: { new(x: T, y: U): string } ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. var b = { new(x: T, y: U) { return ''; } }; // not a construct signature, function called new ~~~~~~~~~~~ -!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. function foo1b(x: B); function foo1b(x: B); // error diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types index ab83b0c78f0..a0603ae0777 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.types @@ -50,7 +50,7 @@ var a: { var b: { [x: number]: string; } = { foo: '' }; >b : { [x: number]: string; } >x : number ->{ foo: '' } : { [x: number]: string; foo: string; } +>{ foo: '' } : { [x: number]: undefined; foo: string; } >foo : string function foo1(x: A); diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types index cd8f19b2b7e..9e4ccb5c43b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.types @@ -64,7 +64,7 @@ var b: { [x: number]: Derived; } = { foo: null }; >b : { [x: number]: Derived; } >x : number >Derived : Derived ->{ foo: null } : { [x: number]: Derived; foo: Derived; } +>{ foo: null } : { [x: number]: undefined; foo: Derived; } >foo : Derived >null : Derived >Derived : Derived diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types index 6a73749fc84..3553f5f7252 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.types @@ -50,7 +50,7 @@ var a: { var b: { [x: number]: string; } = { foo: '' }; >b : { [x: number]: string; } >x : number ->{ foo: '' } : { [x: number]: string; foo: string; } +>{ foo: '' } : { [x: number]: undefined; foo: string; } >foo : string function foo1(x: A); diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt b/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt new file mode 100644 index 00000000000..c950b935130 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt @@ -0,0 +1,33 @@ +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates3.ts(25,1): error TS2353: Neither type 'C3' nor type 'C4' is assignable to the other: + Property 'y' is missing in type 'C3'. + + +==== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates3.ts (1 errors) ==== + interface T1 { } + interface T2 { z } + + class C1 { + private x; + } + + class C2 extends C1 { + y; + } + + var c1: C1; + c1; // Should succeed (private x originates in the same declaration) + + + class C3 { + private x: T; // This T is the difference between C3 and C1 + } + + class C4 extends C3 { + y; + } + + var c3: C3; + c3; // Should fail (private x originates in the same declaration, but different types) + ~~~~~~ +!!! error TS2353: Neither type 'C3' nor type 'C4' is assignable to the other: +!!! error TS2353: Property 'y' is missing in type 'C3'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js new file mode 100644 index 00000000000..7c8dac97250 --- /dev/null +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js @@ -0,0 +1,62 @@ +//// [objectTypesIdentityWithPrivates3.ts] +interface T1 { } +interface T2 { z } + +class C1 { + private x; +} + +class C2 extends C1 { + y; +} + +var c1: C1; +c1; // Should succeed (private x originates in the same declaration) + + +class C3 { + private x: T; // This T is the difference between C3 and C1 +} + +class C4 extends C3 { + y; +} + +var c3: C3; +c3; // Should fail (private x originates in the same declaration, but different types) + +//// [objectTypesIdentityWithPrivates3.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); +var c1; +c1; // Should succeed (private x originates in the same declaration) +var C3 = (function () { + function C3() { + } + return C3; +})(); +var C4 = (function (_super) { + __extends(C4, _super); + function C4() { + _super.apply(this, arguments); + } + return C4; +})(C3); +var c3; +c3; // Should fail (private x originates in the same declaration, but different types) diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt index 72759fbded2..0622b7badb0 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(12,6): error TS1112: A class member cannot be declared optional. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(20,6): error TS1112: A class member cannot be declared optional. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1005: ':' expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,7): error TS1109: Expression expected. + + ==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (4 errors) ==== // Basic uses of optional properties @@ -12,7 +18,7 @@ class C { x?: number; // error ~ -!!! A class member cannot be declared optional. +!!! error TS1112: A class member cannot be declared optional. } interface I2 { @@ -22,13 +28,13 @@ class C2 { x?: T; // error ~ -!!! A class member cannot be declared optional. +!!! error TS1112: A class member cannot be declared optional. } var b = { x?: 1 // error ~ -!!! ':' expected. +!!! error TS1005: ':' expected. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. } \ No newline at end of file diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt index 75e3b2efc8e..a427681b22e 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt @@ -1,57 +1,74 @@ +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(4,8): error TS1005: ';' expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(4,9): error TS1131: Property or signature expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(8,8): error TS1005: ';' expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(8,9): error TS1131: Property or signature expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(12,8): error TS1144: Block or ';' expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(12,9): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(16,8): error TS1005: ';' expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(16,9): error TS1131: Property or signature expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(20,8): error TS1144: Block or ';' expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(20,9): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(25,8): error TS1005: '{' expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(25,9): error TS1136: Property assignment expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(26,1): error TS1005: ':' expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(12,5): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(20,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + ==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts (15 errors) ==== // Illegal attempts to define optional methods var a: { x()?: number; // error ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. } interface I { x()?: number; // error ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. } class C { x()?: number; // error ~ -!!! Block or ';' expected. +!!! error TS1144: Block or ';' expected. ~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. ~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } interface I2 { x()?: T; // error ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. } class C2 { x()?: T; // error ~ -!!! Block or ';' expected. +!!! error TS1144: Block or ';' expected. ~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. ~ -!!! Function implementation is missing or not immediately following the declaration. +!!! error TS2391: Function implementation is missing or not immediately following the declaration. } var b = { x()?: 1 // error ~ -!!! '{' expected. +!!! error TS1005: '{' expected. ~ -!!! Property assignment expected. +!!! error TS1136: Property assignment expected. } ~ -!!! ':' expected. \ No newline at end of file +!!! error TS1005: ':' expected. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName.errors.txt b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName.errors.txt index 630f4c2ee7c..d6f2d2bae19 100644 --- a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName.errors.txt +++ b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName.errors.txt @@ -1,22 +1,28 @@ +tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(3,7): error TS2414: Class name cannot be 'any' +tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(5,7): error TS2414: Class name cannot be 'number' +tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(7,7): error TS2414: Class name cannot be 'boolean' +tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(10,7): error TS2414: Class name cannot be 'string' + + ==== tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts (4 errors) ==== // it is an error to use a predefined type as a type name class any { } ~~~ -!!! Class name cannot be 'any' +!!! error TS2414: Class name cannot be 'any' class number { } ~~~~~~ -!!! Class name cannot be 'number' +!!! error TS2414: Class name cannot be 'number' class boolean { } ~~~~~~~ -!!! Class name cannot be 'boolean' +!!! error TS2414: Class name cannot be 'boolean' class bool { } // not a predefined type anymore class string { } ~~~~~~ -!!! Class name cannot be 'string' +!!! error TS2414: Class name cannot be 'string' \ No newline at end of file diff --git a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.errors.txt b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.errors.txt index 0e36e0cdefa..32a693abdcb 100644 --- a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.errors.txt +++ b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.errors.txt @@ -1,6 +1,9 @@ +tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName2.ts(3,7): error TS1003: Identifier expected. + + ==== tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName2.ts (1 errors) ==== // it is an error to use a predefined type as a type name class void {} // parse error unlike the others ~~~~ -!!! Identifier expected. \ No newline at end of file +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/octalLiteralInStrictModeES3.errors.txt b/tests/baselines/reference/octalLiteralInStrictModeES3.errors.txt index c282d871aff..a884dbc5005 100644 --- a/tests/baselines/reference/octalLiteralInStrictModeES3.errors.txt +++ b/tests/baselines/reference/octalLiteralInStrictModeES3.errors.txt @@ -1,5 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/StrictMode/octalLiteralInStrictModeES3.ts(2,1): error TS1121: Octal literals are not allowed in strict mode. + + ==== tests/cases/conformance/parser/ecmascript5/StrictMode/octalLiteralInStrictModeES3.ts (1 errors) ==== "use strict"; 03; ~~ -!!! Octal literals are not allowed in strict mode. \ No newline at end of file +!!! error TS1121: Octal literals are not allowed in strict mode. \ No newline at end of file diff --git a/tests/baselines/reference/operatorAddNullUndefined.errors.txt b/tests/baselines/reference/operatorAddNullUndefined.errors.txt index 5accc58a1cc..269ee0a5166 100644 --- a/tests/baselines/reference/operatorAddNullUndefined.errors.txt +++ b/tests/baselines/reference/operatorAddNullUndefined.errors.txt @@ -1,17 +1,23 @@ +tests/cases/compiler/operatorAddNullUndefined.ts(2,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/compiler/operatorAddNullUndefined.ts(3,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/compiler/operatorAddNullUndefined.ts(4,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/compiler/operatorAddNullUndefined.ts(5,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + + ==== tests/cases/compiler/operatorAddNullUndefined.ts (4 errors) ==== enum E { x } var x1 = null + null; ~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var x2 = null + undefined; ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var x3 = undefined + null; ~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'null' and 'null'. +!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var x4 = undefined + undefined; ~~~~~~~~~~~~~~~~~~~~~ -!!! Operator '+' cannot be applied to types 'undefined' and 'undefined'. +!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var x5 = 1 + null; var x6 = 1 + undefined; var x7 = null + 1; diff --git a/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt b/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt index def37b39fe4..414e718ac71 100644 --- a/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt +++ b/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt @@ -1,20 +1,27 @@ +tests/cases/compiler/optionalArgsWithDefaultValues.ts(1,25): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/optionalArgsWithDefaultValues.ts(4,27): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/optionalArgsWithDefaultValues.ts(5,28): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/optionalArgsWithDefaultValues.ts(8,10): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/optionalArgsWithDefaultValues.ts(9,13): error TS1015: Parameter cannot have question mark and initializer. + + ==== tests/cases/compiler/optionalArgsWithDefaultValues.ts (5 errors) ==== function foo(x: number, y?:boolean=false, z?=0) {} ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. class CCC { public foo(x: number, y?:boolean=false, z?=0) {} ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. static foo2(x: number, y?:boolean=false, z?=0) {} ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. } var a = (x?=0) => { return 1; }; ~ -!!! Parameter cannot have question mark and initializer. +!!! error TS1015: Parameter cannot have question mark and initializer. var b = (x, y?:number = 2) => { x; }; ~ -!!! Parameter cannot have question mark and initializer. \ No newline at end of file +!!! error TS1015: Parameter cannot have question mark and initializer. \ No newline at end of file diff --git a/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt b/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt index 93ddbfa149b..a930e9f7657 100644 --- a/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt +++ b/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/optionalFunctionArgAssignability.ts(7,1): error TS2322: Type '(onFulFill?: (value: number) => U, onReject?: (reason: any) => U) => Promise' is not assignable to type '(onFulfill?: (value: string) => U, onReject?: (reason: any) => U) => Promise': + Types of parameters 'onFulFill' and 'onFulfill' are incompatible: + Type '(value: number) => any' is not assignable to type '(value: string) => any': + Types of parameters 'value' and 'value' are incompatible: + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/optionalFunctionArgAssignability.ts (1 errors) ==== interface Promise { then(onFulfill?: (value: T) => U, onReject?: (reason: any) => U): Promise; @@ -7,9 +14,9 @@ var b = function then(onFulFill?: (value: number) => U, onReject?: (reason: any) => U): Promise { return null }; a = b; // error because number is not assignable to string ~ -!!! Type '(onFulFill?: (value: number) => U, onReject?: (reason: any) => U) => Promise' is not assignable to type '(onFulfill?: (value: string) => U, onReject?: (reason: any) => U) => Promise': -!!! Types of parameters 'onFulFill' and 'onFulfill' are incompatible: -!!! Type '(value: number) => any' is not assignable to type '(value: string) => any': -!!! Types of parameters 'value' and 'value' are incompatible: -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type '(onFulFill?: (value: number) => U, onReject?: (reason: any) => U) => Promise' is not assignable to type '(onFulfill?: (value: string) => U, onReject?: (reason: any) => U) => Promise': +!!! error TS2322: Types of parameters 'onFulFill' and 'onFulfill' are incompatible: +!!! error TS2322: Type '(value: number) => any' is not assignable to type '(value: string) => any': +!!! error TS2322: Types of parameters 'value' and 'value' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalParamArgsTest.errors.txt b/tests/baselines/reference/optionalParamArgsTest.errors.txt index b3be75d6daa..a8ce88e494e 100644 --- a/tests/baselines/reference/optionalParamArgsTest.errors.txt +++ b/tests/baselines/reference/optionalParamArgsTest.errors.txt @@ -1,4 +1,29 @@ -==== tests/cases/compiler/optionalParamArgsTest.ts (22 errors) ==== +tests/cases/compiler/optionalParamArgsTest.ts(35,47): error TS1016: A required parameter cannot follow an optional parameter. +tests/cases/compiler/optionalParamArgsTest.ts(31,12): error TS2393: Duplicate function implementation. +tests/cases/compiler/optionalParamArgsTest.ts(35,12): error TS2393: Duplicate function implementation. +tests/cases/compiler/optionalParamArgsTest.ts(99,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(100,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(101,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(102,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(103,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(104,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(105,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(106,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(107,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(108,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(109,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(110,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(111,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(112,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(113,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(114,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(115,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(116,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/optionalParamArgsTest.ts(118,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/optionalParamArgsTest.ts (23 errors) ==== // Optional parameter and default argument tests // Key: @@ -30,14 +55,16 @@ public C1M4(C1M4A1:number,C1M4A2?:number) { return C1M4A1 + C1M4A2; } public C1M5(C1M5A1:number,C1M5A2:number=0,C1M5A3?:number) { return C1M5A1 + C1M5A2; } + ~~~~ +!!! error TS2393: Duplicate function implementation. // Negative test // "Optional parameters may only be followed by other optional parameters" public C1M5(C1M5A1:number,C1M5A2:number=0,C1M5A3:number) { return C1M5A1 + C1M5A2; } ~~~~~~ -!!! A required parameter cannot follow an optional parameter. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate function implementation. +!!! error TS1016: A required parameter cannot follow an optional parameter. + ~~~~ +!!! error TS2393: Duplicate function implementation. } class C2 extends C1 { @@ -103,64 +130,64 @@ // Negative tests - we expect these cases to fail c1o1.C1M1(1); ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. i1o1.C1M1(1); ~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. F1(1); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. L1(1); ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. c1o1.C1M2(); ~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. i1o1.C1M2(); ~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. F2(); ~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. L2(); ~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. c1o1.C1M2(1,2); ~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. i1o1.C1M2(1,2); ~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. F2(1,2); ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. L2(1,2); ~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. c1o1.C1M3(1,2,3); ~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. i1o1.C1M3(1,2,3); ~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. F3(1,2,3); ~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. L3(1,2,3); ~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. c1o1.C1M4(); ~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. i1o1.C1M4(); ~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. F4(); ~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. L4(); ~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. function fnOpt1(id: number, children: number[] = [], expectedPath: number[] = [], isRoot?: boolean): void {} function fnOpt2(id: number, children?: number[], expectedPath?: number[], isRoot?: boolean): void {} diff --git a/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt b/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt index c79360011d2..f6e9cd01761 100644 --- a/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt +++ b/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/optionalParamAssignmentCompat.ts(10,5): error TS2322: Type '(p1?: string) => I1' is not assignable to type 'I1': + Types of parameters 'p1' and 'p1' are incompatible: + Type 'string' is not assignable to type 'number'. + + ==== tests/cases/compiler/optionalParamAssignmentCompat.ts (1 errors) ==== interface I1 { (p1: number, p2: string): void; @@ -10,7 +15,7 @@ var c: I1 = i2.p1; // should be ok var d: I1 = i2.m1; // should error ~ -!!! Type '(p1?: string) => I1' is not assignable to type 'I1': -!!! Types of parameters 'p1' and 'p1' are incompatible: -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '(p1?: string) => I1' is not assignable to type 'I1': +!!! error TS2322: Types of parameters 'p1' and 'p1' are incompatible: +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalParamReferencingOtherParams2.errors.txt b/tests/baselines/reference/optionalParamReferencingOtherParams2.errors.txt index 51c632bded9..fa89c3ed761 100644 --- a/tests/baselines/reference/optionalParamReferencingOtherParams2.errors.txt +++ b/tests/baselines/reference/optionalParamReferencingOtherParams2.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/optionalParamReferencingOtherParams2.ts(2,29): error TS2373: Initializer of parameter 'y' cannot reference identifier 'b' declared after it. + + ==== tests/cases/compiler/optionalParamReferencingOtherParams2.ts (1 errors) ==== var a = 1; function strange(x = a, y = b) { ~ -!!! Initializer of parameter 'y' cannot reference identifier 'b' declared after it. +!!! error TS2373: Initializer of parameter 'y' cannot reference identifier 'b' declared after it. var b = ""; return y; } \ No newline at end of file diff --git a/tests/baselines/reference/optionalParamReferencingOtherParams3.errors.txt b/tests/baselines/reference/optionalParamReferencingOtherParams3.errors.txt index ab344ba4f8d..f2b8d3d9127 100644 --- a/tests/baselines/reference/optionalParamReferencingOtherParams3.errors.txt +++ b/tests/baselines/reference/optionalParamReferencingOtherParams3.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/optionalParamReferencingOtherParams3.ts(1,20): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. + + ==== tests/cases/compiler/optionalParamReferencingOtherParams3.ts (1 errors) ==== function right(a = b, b = a) { ~ -!!! Initializer of parameter 'a' cannot reference identifier 'b' declared after it. +!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it. a; b; } \ No newline at end of file diff --git a/tests/baselines/reference/optionalParamTypeComparison.errors.txt b/tests/baselines/reference/optionalParamTypeComparison.errors.txt index f80329a5b1b..29ecc73509f 100644 --- a/tests/baselines/reference/optionalParamTypeComparison.errors.txt +++ b/tests/baselines/reference/optionalParamTypeComparison.errors.txt @@ -1,14 +1,22 @@ +tests/cases/compiler/optionalParamTypeComparison.ts(4,1): error TS2322: Type '(s: string, b?: boolean) => void' is not assignable to type '(s: string, n?: number) => void': + Types of parameters 'b' and 'n' are incompatible: + Type 'boolean' is not assignable to type 'number'. +tests/cases/compiler/optionalParamTypeComparison.ts(5,1): error TS2322: Type '(s: string, n?: number) => void' is not assignable to type '(s: string, b?: boolean) => void': + Types of parameters 'n' and 'b' are incompatible: + Type 'number' is not assignable to type 'boolean'. + + ==== tests/cases/compiler/optionalParamTypeComparison.ts (2 errors) ==== var f: (s: string, n?: number) => void; var g: (s: string, b?: boolean) => void; f = g; ~ -!!! Type '(s: string, b?: boolean) => void' is not assignable to type '(s: string, n?: number) => void': -!!! Types of parameters 'b' and 'n' are incompatible: -!!! Type 'boolean' is not assignable to type 'number'. +!!! error TS2322: Type '(s: string, b?: boolean) => void' is not assignable to type '(s: string, n?: number) => void': +!!! error TS2322: Types of parameters 'b' and 'n' are incompatible: +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. g = f; ~ -!!! Type '(s: string, n?: number) => void' is not assignable to type '(s: string, b?: boolean) => void': -!!! Types of parameters 'n' and 'b' are incompatible: -!!! Type 'number' is not assignable to type 'boolean'. \ No newline at end of file +!!! error TS2322: Type '(s: string, n?: number) => void' is not assignable to type '(s: string, b?: boolean) => void': +!!! error TS2322: Types of parameters 'n' and 'b' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalPropertiesInClasses.errors.txt b/tests/baselines/reference/optionalPropertiesInClasses.errors.txt index d63270ea0fa..d1193270c0c 100644 --- a/tests/baselines/reference/optionalPropertiesInClasses.errors.txt +++ b/tests/baselines/reference/optionalPropertiesInClasses.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/optionalPropertiesInClasses.ts(10,7): error TS2421: Class 'C2' incorrectly implements interface 'ifoo': + Property 'y' is missing in type 'C2'. + + ==== tests/cases/compiler/optionalPropertiesInClasses.ts (1 errors) ==== interface ifoo { x?:number; @@ -10,8 +14,8 @@ class C2 implements ifoo { // ERROR - still need 'y' ~~ -!!! Class 'C2' incorrectly implements interface 'ifoo': -!!! Property 'y' is missing in type 'C2'. +!!! error TS2421: Class 'C2' incorrectly implements interface 'ifoo': +!!! error TS2421: Property 'y' is missing in type 'C2'. public x:number; } diff --git a/tests/baselines/reference/optionalPropertiesSyntax.errors.txt b/tests/baselines/reference/optionalPropertiesSyntax.errors.txt index 348eed0916b..66c1cae2a7e 100644 --- a/tests/baselines/reference/optionalPropertiesSyntax.errors.txt +++ b/tests/baselines/reference/optionalPropertiesSyntax.errors.txt @@ -1,10 +1,27 @@ -==== tests/cases/compiler/optionalPropertiesSyntax.ts (14 errors) ==== +tests/cases/compiler/optionalPropertiesSyntax.ts(11,7): error TS1005: ';' expected. +tests/cases/compiler/optionalPropertiesSyntax.ts(11,8): error TS1131: Property or signature expected. +tests/cases/compiler/optionalPropertiesSyntax.ts(12,5): error TS1131: Property or signature expected. +tests/cases/compiler/optionalPropertiesSyntax.ts(18,11): error TS1005: ';' expected. +tests/cases/compiler/optionalPropertiesSyntax.ts(18,12): error TS1131: Property or signature expected. +tests/cases/compiler/optionalPropertiesSyntax.ts(32,18): error TS1005: ';' expected. +tests/cases/compiler/optionalPropertiesSyntax.ts(32,19): error TS1131: Property or signature expected. +tests/cases/compiler/optionalPropertiesSyntax.ts(33,5): error TS1131: Property or signature expected. +tests/cases/compiler/optionalPropertiesSyntax.ts(34,6): error TS1019: An index signature parameter cannot have a question mark. +tests/cases/compiler/optionalPropertiesSyntax.ts(4,5): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/optionalPropertiesSyntax.ts(24,5): error TS2300: Duplicate identifier 'prop'. +tests/cases/compiler/optionalPropertiesSyntax.ts(25,5): error TS2300: Duplicate identifier 'prop'. +tests/cases/compiler/optionalPropertiesSyntax.ts(32,5): error TS2375: Duplicate number index signature. +tests/cases/compiler/optionalPropertiesSyntax.ts(33,7): error TS2375: Duplicate number index signature. +tests/cases/compiler/optionalPropertiesSyntax.ts(34,5): error TS2375: Duplicate number index signature. + + +==== tests/cases/compiler/optionalPropertiesSyntax.ts (15 errors) ==== interface fnSigs { //functions signatures can be optional fn(): void; fn?(): void; //err ~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. fn2?(): void; } @@ -13,12 +30,12 @@ (): any; ()?: any; //err ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. ?(): any; //err ~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. } interface constructSig { @@ -26,18 +43,20 @@ new (): any; new ()?: any; //err ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. new ?(): any; //err } interface propertySig { //Property signatures can be optional prop: any; + ~~~~ +!!! error TS2300: Duplicate identifier 'prop'. prop?: any; ~~~~ -!!! Duplicate identifier 'prop'. +!!! error TS2300: Duplicate identifier 'prop'. prop2?: any; } @@ -46,19 +65,19 @@ [idx: number]: any; [idx: number]?: any; //err ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. ~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. ? [idx: number]: any; //err ~ -!!! Property or signature expected. +!!! error TS1131: Property or signature expected. ~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. [idx?: number]: any; //err ~~~ -!!! An index signature parameter cannot have a question mark. +!!! error TS1019: An index signature parameter cannot have a question mark. ~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate number index signature. +!!! error TS2375: Duplicate number index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/optionalPropertiesTest.errors.txt b/tests/baselines/reference/optionalPropertiesTest.errors.txt index 8068dd5e061..74b8dd7a73a 100644 --- a/tests/baselines/reference/optionalPropertiesTest.errors.txt +++ b/tests/baselines/reference/optionalPropertiesTest.errors.txt @@ -1,3 +1,13 @@ +tests/cases/compiler/optionalPropertiesTest.ts(14,1): error TS2322: Type '{ name: string; }' is not assignable to type 'IFoo': + Property 'id' is missing in type '{ name: string; }'. +tests/cases/compiler/optionalPropertiesTest.ts(25,5): error TS2322: Type '{}' is not assignable to type 'i1': + Property 'M' is missing in type '{}'. +tests/cases/compiler/optionalPropertiesTest.ts(26,5): error TS2322: Type '{}' is not assignable to type 'i3': + Property 'M' is missing in type '{}'. +tests/cases/compiler/optionalPropertiesTest.ts(40,1): error TS2322: Type 'i2' is not assignable to type 'i1': + Property 'M' is optional in type 'i2' but required in type 'i1'. + + ==== tests/cases/compiler/optionalPropertiesTest.ts (4 errors) ==== var x: {p1:number; p2?:string; p3?:{():number;};}; @@ -14,8 +24,8 @@ foo = { id: 1234, name: "test" }; // Ok foo = { name: "test" }; // Error, id missing ~~~ -!!! Type '{ name: string; }' is not assignable to type 'IFoo': -!!! Property 'id' is missing in type '{ name: string; }'. +!!! error TS2322: Type '{ name: string; }' is not assignable to type 'IFoo': +!!! error TS2322: Property 'id' is missing in type '{ name: string; }'. foo = {id: 1234, print:()=>{}} // Ok var s = foo.name || "default"; @@ -28,12 +38,12 @@ var test1: i1 = {}; ~~~~~ -!!! Type '{}' is not assignable to type 'i1': -!!! Property 'M' is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type 'i1': +!!! error TS2322: Property 'M' is missing in type '{}'. var test2: i3 = {}; ~~~~~ -!!! Type '{}' is not assignable to type 'i3': -!!! Property 'M' is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type 'i3': +!!! error TS2322: Property 'M' is missing in type '{}'. var test3: i2 = {}; var test4: i4 = {}; var test5: i1 = { M: function () { } }; @@ -49,5 +59,5 @@ var test10_2: i2; test10_1 = test10_2; ~~~~~~~~ -!!! Type 'i2' is not assignable to type 'i1': -!!! Required property 'M' cannot be reimplemented with optional property in 'i2'. \ No newline at end of file +!!! error TS2322: Type 'i2' is not assignable to type 'i1': +!!! error TS2322: Property 'M' is optional in type 'i2' but required in type 'i1'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalSetterParam.errors.txt b/tests/baselines/reference/optionalSetterParam.errors.txt index 6f3b39e7138..732351671ce 100644 --- a/tests/baselines/reference/optionalSetterParam.errors.txt +++ b/tests/baselines/reference/optionalSetterParam.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/optionalSetterParam.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + + ==== tests/cases/compiler/optionalSetterParam.ts (1 errors) ==== class foo { public set bar(param?:any) { } ~~~ -!!! Accessors are only available when targeting ECMAScript 5 and higher. +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt b/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt index 9ff39d72f45..b7b9f437735 100644 --- a/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt +++ b/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'. + + ==== tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts (1 errors) ==== interface A { (x: { s: string }): string @@ -22,6 +25,6 @@ var w: A; var w: C; ~ -!!! Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'. w({ s: "", n: 0 }).toLowerCase(); \ No newline at end of file diff --git a/tests/baselines/reference/overEagerReturnTypeSpecialization.errors.txt b/tests/baselines/reference/overEagerReturnTypeSpecialization.errors.txt index 82ddd8bcef0..cb2635c4a3b 100644 --- a/tests/baselines/reference/overEagerReturnTypeSpecialization.errors.txt +++ b/tests/baselines/reference/overEagerReturnTypeSpecialization.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/overEagerReturnTypeSpecialization.ts(8,5): error TS2322: Type 'I1' is not assignable to type 'I1': + Type 'number' is not assignable to type 'string'. + + ==== tests/cases/compiler/overEagerReturnTypeSpecialization.ts (1 errors) ==== //Note: Below simpler repro @@ -8,8 +12,8 @@ declare var v1: I1; var r1: I1 = v1.func(num => num.toString()) // Correctly returns an I1 ~~ -!!! Type 'I1' is not assignable to type 'I1': -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'I1' is not assignable to type 'I1': +!!! error TS2322: Type 'number' is not assignable to type 'string'. .func(str => str.length); // should error var r2: I1 = v1.func(num => num.toString()) // Correctly returns an I1 diff --git a/tests/baselines/reference/overload1.errors.txt b/tests/baselines/reference/overload1.errors.txt index 415a44ebae5..c4d3d999880 100644 --- a/tests/baselines/reference/overload1.errors.txt +++ b/tests/baselines/reference/overload1.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/overload1.ts(27,5): error TS2323: Type 'C' is not assignable to type 'string'. +tests/cases/compiler/overload1.ts(29,1): error TS2323: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/overload1.ts(31,3): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/overload1.ts(32,3): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/overload1.ts(33,1): error TS2323: Type 'C' is not assignable to type 'string'. +tests/cases/compiler/overload1.ts(34,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + ==== tests/cases/compiler/overload1.ts (6 errors) ==== module O { export class A { @@ -27,24 +35,24 @@ var e:string=x.g(new O.A()); // matches overload but bad assignment ~ -!!! Type 'C' is not assignable to type 'string'. +!!! error TS2323: Type 'C' is not assignable to type 'string'. var y:string=x.f(3); // good y=x.f("nope"); // can't assign number to string ~ -!!! Type 'number' is not assignable to type 'string'. +!!! error TS2323: Type 'number' is not assignable to type 'string'. var z:string=x.g(x.g(3,3)); // good z=x.g(2,2,2); // no match ~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. z=x.g(); // no match ~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. z=x.g(new O.B()); // ambiguous (up and down conversion) ~ -!!! Type 'C' is not assignable to type 'string'. +!!! error TS2323: Type 'C' is not assignable to type 'string'. z=x.h(2,2); // no match ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. z=x.h("hello",0); // good var v=x.g; diff --git a/tests/baselines/reference/overloadAssignmentCompat.errors.txt b/tests/baselines/reference/overloadAssignmentCompat.errors.txt index f5cf4b6a6f6..aa25558203b 100644 --- a/tests/baselines/reference/overloadAssignmentCompat.errors.txt +++ b/tests/baselines/reference/overloadAssignmentCompat.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/overloadAssignmentCompat.ts(35,1): error TS2394: Overload signature is not compatible with function implementation. + + ==== tests/cases/compiler/overloadAssignmentCompat.ts (1 errors) ==== // ok - overload signatures are assignment compatible with their implementation @@ -35,7 +38,7 @@ // error - signatures are not assignment compatible function foo():number; ~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo():string { return "a" }; \ No newline at end of file diff --git a/tests/baselines/reference/overloadModifiersMustAgree.errors.txt b/tests/baselines/reference/overloadModifiersMustAgree.errors.txt index f2aa56b8e4d..0efdbcdd1f6 100644 --- a/tests/baselines/reference/overloadModifiersMustAgree.errors.txt +++ b/tests/baselines/reference/overloadModifiersMustAgree.errors.txt @@ -1,24 +1,30 @@ +tests/cases/compiler/overloadModifiersMustAgree.ts(2,12): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/compiler/overloadModifiersMustAgree.ts(6,18): error TS2384: Overload signatures must all be ambient or non-ambient. +tests/cases/compiler/overloadModifiersMustAgree.ts(7,17): error TS2383: Overload signatures must all be exported or not exported. +tests/cases/compiler/overloadModifiersMustAgree.ts(12,5): error TS2386: Overload signatures must all be optional or required. + + ==== tests/cases/compiler/overloadModifiersMustAgree.ts (4 errors) ==== class baz { public foo(); ~~~ -!!! Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private foo(bar?: any) { } // error - access modifiers do not agree } declare function bar(); ~~~ -!!! Overload signatures must all be ambient or non-ambient. +!!! error TS2384: Overload signatures must all be ambient or non-ambient. export function bar(s: string); ~~~ -!!! Overload signatures must all be exported or not exported. +!!! error TS2383: Overload signatures must all be exported or not exported. function bar(s?: string) { } interface I { foo? (); foo(s: string); ~~~ -!!! Overload signatures must all be optional or required. +!!! error TS2386: Overload signatures must all be optional or required. } \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt index 42336209049..0d4cd775c56 100644 --- a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt @@ -1,8 +1,13 @@ +tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(1,37): error TS1005: ';' expected. +tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(1,42): error TS1108: A 'return' statement can only be used within a function body. +tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(1,8): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (3 errors) ==== var f: (x: 'hi') => number = ('hi') => { return 1; }; ~~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~~~ -!!! A 'return' statement can only be used within a function body. +!!! error TS1108: A 'return' statement can only be used within a function body. ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. \ No newline at end of file +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.errors.txt b/tests/baselines/reference/overloadOnConstConstraintChecks4.errors.txt index b64650db422..9ac9e2253f0 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.errors.txt +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/overloadOnConstConstraintChecks4.ts(9,1): error TS2394: Overload signature is not compatible with function implementation. + + ==== tests/cases/compiler/overloadOnConstConstraintChecks4.ts (1 errors) ==== class Z { } class A extends Z { private x = 1 } @@ -9,7 +12,7 @@ function foo(name: 'bye'): C; function foo(name: string): A; // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. function foo(name: any): Z { return null; } diff --git a/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt b/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt index 04df57d7fcc..4714c06ee73 100644 --- a/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt +++ b/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts(1,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts(2,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts (2 errors) ==== function foo(a: 'hi', x: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(a: 'hi', x: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(a: any, x: any) { } diff --git a/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.errors.txt b/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.errors.txt index 4124c643554..e040559a054 100644 --- a/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.errors.txt +++ b/tests/baselines/reference/overloadOnConstInBaseWithBadImplementationInDerived.errors.txt @@ -1,13 +1,17 @@ +tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts (2 errors) ==== interface I { x1(a: number, callback: (x: 'hi') => number); ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } class C implements I { x1(a: number, callback: (x: 'hi') => number) { // error ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } } \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstInCallback1.errors.txt b/tests/baselines/reference/overloadOnConstInCallback1.errors.txt index 40473b6b6aa..5d594204933 100644 --- a/tests/baselines/reference/overloadOnConstInCallback1.errors.txt +++ b/tests/baselines/reference/overloadOnConstInCallback1.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/overloadOnConstInCallback1.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/overloadOnConstInCallback1.ts (1 errors) ==== class C { x1(a: number, callback: (x: 'hi') => number); // error ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. x1(a: number, callback: (x: any) => number) { callback('hi'); callback('bye'); diff --git a/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.errors.txt b/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.errors.txt index 11d35bdedf5..5788a9e6bbe 100644 --- a/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.errors.txt +++ b/tests/baselines/reference/overloadOnConstInObjectLiteralImplementingAnInterface.errors.txt @@ -1,10 +1,14 @@ +tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts(5,35): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts (2 errors) ==== interface I { x1(a: number, callback: (x: 'hi') => number); ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } var i2: I = { x1: (a: number, cb: (x: 'hi') => number) => { } }; // error ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. \ No newline at end of file +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstInheritance2.errors.txt b/tests/baselines/reference/overloadOnConstInheritance2.errors.txt index ff965b47a18..f50dcd04a1d 100644 --- a/tests/baselines/reference/overloadOnConstInheritance2.errors.txt +++ b/tests/baselines/reference/overloadOnConstInheritance2.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/overloadOnConstInheritance2.ts(5,11): error TS2429: Interface 'Deriver' incorrectly extends interface 'Base': + Types of property 'addEventListener' are incompatible: + Type '(x: 'bar') => string' is not assignable to type '{ (x: string): any; (x: 'foo'): string; }'. +tests/cases/compiler/overloadOnConstInheritance2.ts(6,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/overloadOnConstInheritance2.ts (2 errors) ==== interface Base { addEventListener(x: string): any; @@ -5,11 +11,11 @@ } interface Deriver extends Base { ~~~~~~~ -!!! Interface 'Deriver' incorrectly extends interface 'Base': -!!! Types of property 'addEventListener' are incompatible: -!!! Type '(x: 'bar') => string' is not assignable to type '{ (x: string): any; (x: 'foo'): string; }'. +!!! error TS2429: Interface 'Deriver' incorrectly extends interface 'Base': +!!! error TS2429: Types of property 'addEventListener' are incompatible: +!!! error TS2429: Type '(x: 'bar') => string' is not assignable to type '{ (x: string): any; (x: 'foo'): string; }'. addEventListener(x: 'bar'): string; // shouldn't need to redeclare the string overload ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstInheritance3.errors.txt b/tests/baselines/reference/overloadOnConstInheritance3.errors.txt index cbfd32b1d6d..4ddb7d3669a 100644 --- a/tests/baselines/reference/overloadOnConstInheritance3.errors.txt +++ b/tests/baselines/reference/overloadOnConstInheritance3.errors.txt @@ -1,18 +1,25 @@ +tests/cases/compiler/overloadOnConstInheritance3.ts(4,11): error TS2429: Interface 'Deriver' incorrectly extends interface 'Base': + Types of property 'addEventListener' are incompatible: + Type '{ (x: 'bar'): string; (x: 'foo'): string; }' is not assignable to type '(x: string) => any'. +tests/cases/compiler/overloadOnConstInheritance3.ts(6,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstInheritance3.ts(7,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/overloadOnConstInheritance3.ts (3 errors) ==== interface Base { addEventListener(x: string): any; } interface Deriver extends Base { ~~~~~~~ -!!! Interface 'Deriver' incorrectly extends interface 'Base': -!!! Types of property 'addEventListener' are incompatible: -!!! Type '{ (x: 'bar'): string; (x: 'foo'): string; }' is not assignable to type '(x: string) => any'. +!!! error TS2429: Interface 'Deriver' incorrectly extends interface 'Base': +!!! error TS2429: Types of property 'addEventListener' are incompatible: +!!! error TS2429: Type '{ (x: 'bar'): string; (x: 'foo'): string; }' is not assignable to type '(x: string) => any'. // shouldn't need to redeclare the string overload addEventListener(x: 'bar'): string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. addEventListener(x: 'foo'): string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstInheritance4.errors.txt b/tests/baselines/reference/overloadOnConstInheritance4.errors.txt index f2debeac4ff..54200023408 100644 --- a/tests/baselines/reference/overloadOnConstInheritance4.errors.txt +++ b/tests/baselines/reference/overloadOnConstInheritance4.errors.txt @@ -1,16 +1,21 @@ +tests/cases/compiler/overloadOnConstInheritance4.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstInheritance4.ts(5,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstInheritance4.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/overloadOnConstInheritance4.ts (3 errors) ==== interface I { x1(a: number, callback: (x: 'hi') => number); ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } class C implements I { x1(a: number, callback: (x: 'hi') => number); ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. x1(a: number, callback: (x: 'hi') => number) { ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } } \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt b/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt index ad3dc56a7f9..2827a97ca82 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt @@ -1,10 +1,16 @@ +tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(1,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(2,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(9,8): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(14,7): error TS2381: A signature with an implementation cannot use a string literal type. + + ==== tests/cases/compiler/overloadOnConstNoAnyImplementation.ts (4 errors) ==== function x1(a: number, cb: (x: 'hi') => number); ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function x1(a: number, cb: (x: 'bye') => number); ~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function x1(a: number, cb: (x: string) => number) { cb('hi'); cb('bye'); @@ -13,12 +19,12 @@ cb('uh'); cb(1); // error ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. } var cb: (number) => number = (x: number) => 1; x1(1, cb); x1(1, (x: 'hi') => 1); // error ~~~~~~~~~~~~~~ -!!! A signature with an implementation cannot use a string literal type. +!!! error TS2381: A signature with an implementation cannot use a string literal type. x1(1, (x: string) => 1); \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt index 201165a56ec..aab390c48e8 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt @@ -1,14 +1,21 @@ +tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(12,18): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(17,9): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2381: A signature with an implementation cannot use a string literal type. + + ==== tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts (5 errors) ==== interface I { x1(a: number, callback: (x: 'hi') => number); ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } class C { x1(a: number, callback: (x: 'hi') => number); ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. x1(a: number, callback: (x: string) => number) { callback('hi'); callback('bye'); @@ -16,17 +23,17 @@ callback(hm); callback(1); // error ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. } } var c: C; c.x1(1, (x: 'hi') => { return 1; } ); ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! A signature with an implementation cannot use a string literal type. +!!! error TS2381: A signature with an implementation cannot use a string literal type. c.x1(1, (x: 'bye') => { return 1; } ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! A signature with an implementation cannot use a string literal type. +!!! error TS2381: A signature with an implementation cannot use a string literal type. c.x1(1, (x) => { return 1; } ); c.x1(1, (x: number) => { return 1; } ); \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.errors.txt b/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.errors.txt index 73c954ef10c..f897cae121d 100644 --- a/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoNonSpecializedSignature.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/overloadOnConstNoNonSpecializedSignature.ts(2,4): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/overloadOnConstNoNonSpecializedSignature.ts (1 errors) ==== class C { x1(a: 'hi'); // error, no non-specialized signature in overload list ~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. x1(a: string) { } } \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation.errors.txt b/tests/baselines/reference/overloadOnConstNoStringImplementation.errors.txt index 8ac0806a496..12dcdaf9769 100644 --- a/tests/baselines/reference/overloadOnConstNoStringImplementation.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoStringImplementation.errors.txt @@ -1,10 +1,15 @@ +tests/cases/compiler/overloadOnConstNoStringImplementation.ts(1,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstNoStringImplementation.ts(2,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstNoStringImplementation.ts(14,7): error TS2381: A signature with an implementation cannot use a string literal type. + + ==== tests/cases/compiler/overloadOnConstNoStringImplementation.ts (3 errors) ==== function x2(a: number, cb: (x: 'hi') => number); ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function x2(a: number, cb: (x: 'bye') => number); ~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function x2(a: number, cb: (x: any) => number) { cb('hi'); cb('bye'); @@ -18,5 +23,5 @@ x2(1, cb); // error x2(1, (x: 'hi') => 1); // error ~~~~~~~~~~~~~~ -!!! A signature with an implementation cannot use a string literal type. +!!! error TS2381: A signature with an implementation cannot use a string literal type. x2(1, (x: string) => 1); \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt b/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt index f7fdeed169b..c85b004f160 100644 --- a/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt @@ -1,14 +1,20 @@ +tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(17,9): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(18,9): error TS2381: A signature with an implementation cannot use a string literal type. + + ==== tests/cases/compiler/overloadOnConstNoStringImplementation2.ts (4 errors) ==== interface I { x1(a: number, callback: (x: 'hi') => number); ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. } class C implements I { x1(a: number, callback: (x: 'hi') => number); ~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. x1(a: number, callback: (x: any) => number) { callback('hi'); callback('bye'); @@ -21,9 +27,9 @@ var c: C; c.x1(1, (x: 'hi') => { return 1; } ); ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! A signature with an implementation cannot use a string literal type. +!!! error TS2381: A signature with an implementation cannot use a string literal type. c.x1(1, (x: 'bye') => { return 1; } ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! A signature with an implementation cannot use a string literal type. +!!! error TS2381: A signature with an implementation cannot use a string literal type. c.x1(1, (x: string) => { return 1; } ); c.x1(1, (x: number) => { return 1; } ); \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt index 1369843e9b4..bfdb66aa437 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(7,1): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: Argument of type 'string' is not assignable to parameter of type '"SPAN"'. + + ==== tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts (3 errors) ==== class Base { foo() { } } class Derived1 extends Base { bar() { } } @@ -6,15 +11,15 @@ function foo(name: "SPAN"): Derived1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(name: "DIV"): Derived2 { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return null; ~~~~~~~~~~~~~~~~ } ~ -!!! A signature with an implementation cannot use a string literal type. +!!! error TS2381: A signature with an implementation cannot use a string literal type. foo("HI"); ~~~~ -!!! Argument of type 'string' is not assignable to parameter of type '"SPAN"'. \ No newline at end of file +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"SPAN"'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadResolution.errors.txt b/tests/baselines/reference/overloadResolution.errors.txt index a5d0a02969d..729b52d6045 100644 --- a/tests/baselines/reference/overloadResolution.errors.txt +++ b/tests/baselines/reference/overloadResolution.errors.txt @@ -1,3 +1,22 @@ +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(27,5): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(41,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(63,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,5): error TS2344: Type 'string' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,13): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,21): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,5): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,13): error TS2344: Type 'string' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(72,5): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(72,13): error TS2344: Type 'string' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(81,5): error TS2344: Type 'boolean' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(81,14): error TS2344: Type 'Date' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(84,5): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(85,11): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): error TS2339: Property 'toFixed' does not exist on type 'string'. + + ==== tests/cases/conformance/expressions/functionCalls/overloadResolution.ts (17 errors) ==== class SomeBase { private n; @@ -27,7 +46,7 @@ // No candidate overloads found fn1({}); // Error ~~ -!!! Argument of type '{}' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. // Generic and non - generic overload where generic overload is the only candidate when called with type arguments function fn2(s: string, n: number): number; @@ -43,7 +62,7 @@ // Generic and non - generic overload where non - generic overload is the only candidate when called with type arguments fn2('', 0); // Error ~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments fn2('', 0); // OK @@ -67,7 +86,7 @@ // Generic overloads with differing arity called with type argument count that doesn't match any overload fn3(); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. // Generic overloads with constraints called with type arguments that satisfy the constraints function fn4(n: T, m: U); @@ -76,23 +95,23 @@ fn4('', 3); fn4(3, ''); // Error ~~~~~~ -!!! Type 'string' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. ~~~~~~ -!!! Type 'number' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. fn4('', 3); // Error ~~~~~~ -!!! Type 'number' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. ~~~~~~ -!!! Type 'string' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. ~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. fn4(3, ''); ~~~~~~ -!!! Type 'number' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. ~~~~~~ -!!! Type 'string' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that satisfy the constraints fn4('', 3); @@ -103,17 +122,17 @@ // Generic overloads with constraints called with type arguments that do not satisfy the constraints fn4(null, null); // Error ~~~~~~~ -!!! Type 'boolean' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'boolean' does not satisfy the constraint 'string'. ~~~~ -!!! Type 'Date' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'Date' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4(true, null); // Error ~~~~ -!!! Argument of type 'boolean' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. fn4(null, true); // Error ~~~~ -!!! Argument of type 'boolean' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. // Non - generic overloads where contextual typing of function arguments has errors function fn5(f: (n: string) => void): string; @@ -121,9 +140,9 @@ function fn5() { return undefined; } var n = fn5((n) => n.toFixed()); ~ -!!! Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. ~~~~~~~ -!!! Property 'toFixed' does not exist on type 'string'. +!!! error TS2339: Property 'toFixed' does not exist on type 'string'. var s = fn5((n) => n.substr(0)); \ No newline at end of file diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt b/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt index 389ae265c32..676d5ea12d0 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt @@ -1,3 +1,23 @@ +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(27,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(60,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(61,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(65,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(73,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(74,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(74,17): error TS2344: Type 'string' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(74,25): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(75,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(75,17): error TS2344: Type 'string' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(79,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(80,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(84,9): error TS2344: Type 'boolean' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(84,18): error TS2344: Type 'Date' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(87,9): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(88,15): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(96,18): error TS2339: Property 'toFixed' does not exist on type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(98,18): error TS2339: Property 'blah' does not exist on type 'string'. + + ==== tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts (18 errors) ==== class SomeBase { private n; @@ -27,7 +47,7 @@ // No candidate overloads found new fn1({}); // Error ~~ -!!! Argument of type '{}' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. // Generic and non - generic overload where generic overload is the only candidate when called with type arguments class fn2 { @@ -62,16 +82,16 @@ // Generic overloads with differing arity called with type arguments matching each overload type parameter count new fn3(4); // Error ~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. new fn3('', '', ''); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. new fn3('', '', 3); // Generic overloads with differing arity called with type argument count that doesn't match any overload new fn3(); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. // Generic overloads with constraints called with type arguments that satisfy the constraints class fn4 { @@ -81,44 +101,44 @@ new fn4('', 3); new fn4(3, ''); // Error ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new fn4('', 3); // Error ~~~~~~ -!!! Type 'number' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. ~~~~~~ -!!! Type 'string' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. ~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. new fn4(3, ''); // Error ~~~~~~ -!!! Type 'number' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. ~~~~~~ -!!! Type 'string' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that satisfy the constraints new fn4('', 3); new fn4(3, ''); // Error ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new fn4(3, undefined); // Error ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new fn4('', null); // Generic overloads with constraints called with type arguments that do not satisfy the constraints new fn4(null, null); // Error ~~~~~~~ -!!! Type 'boolean' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'boolean' does not satisfy the constraint 'string'. ~~~~ -!!! Type 'Date' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'Date' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints new fn4(true, null); // Error ~~~~ -!!! Argument of type 'boolean' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. new fn4(null, true); // Error ~~~~ -!!! Argument of type 'boolean' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. // Non - generic overloads where contextual typing of function arguments has errors class fn5 { @@ -128,11 +148,11 @@ } new fn5((n) => n.toFixed()); ~~~~~~~ -!!! Property 'toFixed' does not exist on type 'string'. +!!! error TS2339: Property 'toFixed' does not exist on type 'string'. new fn5((n) => n.substr(0)); new fn5((n) => n.blah); // Error ~~~~ -!!! Property 'blah' does not exist on type 'string'. +!!! error TS2339: Property 'blah' does not exist on type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadResolutionConstructors.errors.txt b/tests/baselines/reference/overloadResolutionConstructors.errors.txt index 96dd65c0710..0cbaec65c13 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionConstructors.errors.txt @@ -1,3 +1,22 @@ +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(27,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(43,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(67,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,9): error TS2344: Type 'string' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,17): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,17): error TS2344: Type 'string' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,25): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(79,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(79,17): error TS2344: Type 'string' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(88,9): error TS2344: Type 'boolean' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(88,18): error TS2344: Type 'Date' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(91,9): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(92,15): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,26): error TS2339: Property 'toFixed' does not exist on type 'string'. + + ==== tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts (17 errors) ==== class SomeBase { private n; @@ -27,7 +46,7 @@ // No candidate overloads found new fn1({}); // Error ~~ -!!! Argument of type '{}' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. // Generic and non - generic overload where generic overload is the only candidate when called with type arguments interface fn2 { @@ -45,7 +64,7 @@ // Generic and non - generic overload where non - generic overload is the only candidate when called with type arguments new fn2('', 0); // Error ~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments new fn2('', 0); // OK @@ -71,7 +90,7 @@ // Generic overloads with differing arity called with type argument count that doesn't match any overload new fn3(); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. // Generic overloads with constraints called with type arguments that satisfy the constraints interface fn4 { @@ -83,23 +102,23 @@ new fn4('', 3); new fn4(3, ''); // Error ~~~~~~ -!!! Type 'string' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. ~~~~~~ -!!! Type 'number' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. ~ -!!! Argument of type 'number' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new fn4('', 3); // Error ~~~~~~ -!!! Type 'number' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. ~~~~~~ -!!! Type 'string' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. ~~ -!!! Argument of type 'string' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. new fn4(3, ''); ~~~~~~ -!!! Type 'number' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. ~~~~~~ -!!! Type 'string' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that satisfy the constraints new fn4('', 3); @@ -110,17 +129,17 @@ // Generic overloads with constraints called with type arguments that do not satisfy the constraints new fn4(null, null); // Error ~~~~~~~ -!!! Type 'boolean' does not satisfy the constraint 'string'. +!!! error TS2344: Type 'boolean' does not satisfy the constraint 'string'. ~~~~ -!!! Type 'Date' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'Date' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints new fn4(true, null); // Error ~~~~ -!!! Argument of type 'boolean' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. new fn4(null, true); // Error ~~~~ -!!! Argument of type 'boolean' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. // Non - generic overloads where contextual typing of function arguments has errors interface fn5 { @@ -130,8 +149,8 @@ var fn5: fn5; var n = new fn5((n) => n.toFixed()); ~ -!!! Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. ~~~~~~~ -!!! Property 'toFixed' does not exist on type 'string'. +!!! error TS2339: Property 'toFixed' does not exist on type 'string'. var s = new fn5((n) => n.substr(0)); \ No newline at end of file diff --git a/tests/baselines/reference/overloadResolutionOnDefaultConstructor1.errors.txt b/tests/baselines/reference/overloadResolutionOnDefaultConstructor1.errors.txt index c9935140818..1922df6852a 100644 --- a/tests/baselines/reference/overloadResolutionOnDefaultConstructor1.errors.txt +++ b/tests/baselines/reference/overloadResolutionOnDefaultConstructor1.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/overloadResolutionOnDefaultConstructor1.ts(3,16): error TS2346: Supplied parameters do not match any signature of call target. + + ==== tests/cases/compiler/overloadResolutionOnDefaultConstructor1.ts (1 errors) ==== class Bar { public clone() { return new Bar(0); ~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. } } \ No newline at end of file diff --git a/tests/baselines/reference/overloadResolutionOverCTLambda.errors.txt b/tests/baselines/reference/overloadResolutionOverCTLambda.errors.txt index bd11102dfdd..03901cf67a4 100644 --- a/tests/baselines/reference/overloadResolutionOverCTLambda.errors.txt +++ b/tests/baselines/reference/overloadResolutionOverCTLambda.errors.txt @@ -1,5 +1,8 @@ +tests/cases/compiler/overloadResolutionOverCTLambda.ts(2,5): error TS2345: Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'. + + ==== tests/cases/compiler/overloadResolutionOverCTLambda.ts (1 errors) ==== function foo(b: (item: number) => boolean) { } foo(a => a); // can not convert (number)=>bool to (number)=>number ~~~~~~ -!!! Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'. \ No newline at end of file +!!! error TS2345: Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types b/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types index 846190010b4..7ad68cefa4f 100644 --- a/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types +++ b/tests/baselines/reference/overloadResolutionOverNonCTObjectLit.types @@ -37,7 +37,7 @@ module Bugs { var tokens:IToken[]= []; >tokens : IToken[] >IToken : IToken ->[] : IToken[] +>[] : undefined[] tokens.push({ startIndex: 1, type: '', bracket: 3 }); >tokens.push({ startIndex: 1, type: '', bracket: 3 }) : number diff --git a/tests/baselines/reference/overloadResolutionTest1.errors.txt b/tests/baselines/reference/overloadResolutionTest1.errors.txt index c8b65902d26..6e9be0cc516 100644 --- a/tests/baselines/reference/overloadResolutionTest1.errors.txt +++ b/tests/baselines/reference/overloadResolutionTest1.errors.txt @@ -1,3 +1,15 @@ +tests/cases/compiler/overloadResolutionTest1.ts(8,16): error TS2345: Argument of type '{ a: string; }[]' is not assignable to parameter of type '{ a: boolean; }[]'. + Type '{ a: string; }' is not assignable to type '{ a: boolean; }': + Types of property 'a' are incompatible: + Type 'string' is not assignable to type 'boolean'. +tests/cases/compiler/overloadResolutionTest1.ts(19,15): error TS2345: Argument of type '{ a: string; }' is not assignable to parameter of type '{ a: boolean; }'. + Types of property 'a' are incompatible: + Type 'string' is not assignable to type 'boolean'. +tests/cases/compiler/overloadResolutionTest1.ts(25,14): error TS2345: Argument of type '{ a: boolean; }' is not assignable to parameter of type '{ a: string; }'. + Types of property 'a' are incompatible: + Type 'boolean' is not assignable to type 'string'. + + ==== tests/cases/compiler/overloadResolutionTest1.ts (3 errors) ==== function foo(bar:{a:number;}[]):string; @@ -8,10 +20,10 @@ var x11 = foo([{a:0}]); // works var x111 = foo([{a:"s"}]); // error - does not match any signature ~~~~~~~~~ -!!! Argument of type '{ a: string; }[]' is not assignable to parameter of type '{ a: boolean; }[]'. -!!! Type '{ a: string; }' is not assignable to type '{ a: boolean; }': -!!! Types of property 'a' are incompatible: -!!! Type 'string' is not assignable to type 'boolean'. +!!! error TS2345: Argument of type '{ a: string; }[]' is not assignable to parameter of type '{ a: boolean; }[]'. +!!! error TS2345: Type '{ a: string; }' is not assignable to type '{ a: boolean; }': +!!! error TS2345: Types of property 'a' are incompatible: +!!! error TS2345: Type 'string' is not assignable to type 'boolean'. var x1111 = foo([{a:null}]); // works - ambiguous call is resolved to be the first in the overload set so this returns a string @@ -24,9 +36,9 @@ var x3 = foo2({a:true}); // works var x4 = foo2({a:"s"}); // error ~~~~~~~ -!!! Argument of type '{ a: string; }' is not assignable to parameter of type '{ a: boolean; }'. -!!! Types of property 'a' are incompatible: -!!! Type 'string' is not assignable to type 'boolean'. +!!! error TS2345: Argument of type '{ a: string; }' is not assignable to parameter of type '{ a: boolean; }'. +!!! error TS2345: Types of property 'a' are incompatible: +!!! error TS2345: Type 'string' is not assignable to type 'boolean'. function foo4(bar:{a:number;}):number; @@ -34,6 +46,6 @@ function foo4(bar:{a:any;}):any{ return bar }; var x = foo4({a:true}); // error ~~~~~~~~ -!!! Argument of type '{ a: boolean; }' is not assignable to parameter of type '{ a: string; }'. -!!! Types of property 'a' are incompatible: -!!! Type 'boolean' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2345: Argument of type '{ a: boolean; }' is not assignable to parameter of type '{ a: string; }'. +!!! error TS2345: Types of property 'a' are incompatible: +!!! error TS2345: Type 'boolean' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadingOnConstants1.errors.txt b/tests/baselines/reference/overloadingOnConstants1.errors.txt index f523160803c..bc277dc0795 100644 --- a/tests/baselines/reference/overloadingOnConstants1.errors.txt +++ b/tests/baselines/reference/overloadingOnConstants1.errors.txt @@ -1,3 +1,13 @@ +tests/cases/compiler/overloadingOnConstants1.ts(22,5): error TS2322: Type 'Base' is not assignable to type 'Derived1': + Property 'bar' is missing in type 'Base'. +tests/cases/compiler/overloadingOnConstants1.ts(23,5): error TS2322: Type 'Derived1' is not assignable to type 'Derived3': + Property 'biz' is missing in type 'Derived1'. +tests/cases/compiler/overloadingOnConstants1.ts(24,5): error TS2322: Type 'Derived2' is not assignable to type 'Derived1': + Property 'bar' is missing in type 'Derived2'. +tests/cases/compiler/overloadingOnConstants1.ts(25,5): error TS2322: Type 'Derived3' is not assignable to type 'Derived1': + Property 'bar' is missing in type 'Derived3'. + + ==== tests/cases/compiler/overloadingOnConstants1.ts (4 errors) ==== class Base { foo() { } } class Derived1 extends Base { bar() { } } @@ -22,17 +32,17 @@ // these are errors var htmlElement2: Derived1 = d2.createElement("yo") ~~~~~~~~~~~~ -!!! Type 'Base' is not assignable to type 'Derived1': -!!! Property 'bar' is missing in type 'Base'. +!!! error TS2322: Type 'Base' is not assignable to type 'Derived1': +!!! error TS2322: Property 'bar' is missing in type 'Base'. var htmlCanvasElement2: Derived3 = d2.createElement("canvas"); ~~~~~~~~~~~~~~~~~~ -!!! Type 'Derived1' is not assignable to type 'Derived3': -!!! Property 'biz' is missing in type 'Derived1'. +!!! error TS2322: Type 'Derived1' is not assignable to type 'Derived3': +!!! error TS2322: Property 'biz' is missing in type 'Derived1'. var htmlDivElement2: Derived1 = d2.createElement("div"); ~~~~~~~~~~~~~~~ -!!! Type 'Derived2' is not assignable to type 'Derived1': -!!! Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived1': +!!! error TS2322: Property 'bar' is missing in type 'Derived2'. var htmlSpanElement2: Derived1 = d2.createElement("span"); ~~~~~~~~~~~~~~~~ -!!! Type 'Derived3' is not assignable to type 'Derived1': -!!! Property 'bar' is missing in type 'Derived3'. \ No newline at end of file +!!! error TS2322: Type 'Derived3' is not assignable to type 'Derived1': +!!! error TS2322: Property 'bar' is missing in type 'Derived3'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadingOnConstants2.errors.txt b/tests/baselines/reference/overloadingOnConstants2.errors.txt index a79428f70b6..1d7d2c8ecab 100644 --- a/tests/baselines/reference/overloadingOnConstants2.errors.txt +++ b/tests/baselines/reference/overloadingOnConstants2.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/overloadingOnConstants2.ts(8,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstants2.ts(9,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstants2.ts(15,13): error TS2345: Argument of type 'string' is not assignable to parameter of type '"bye"'. +tests/cases/compiler/overloadingOnConstants2.ts(19,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + + ==== tests/cases/compiler/overloadingOnConstants2.ts (4 errors) ==== class C { private x = 1; @@ -8,10 +14,10 @@ } function foo(x: "hi", items: string[]): D; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(x: "bye", items: string[]): E; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(x: string, items: string[]): C { return null; } @@ -19,13 +25,13 @@ var b: E = foo("bye", []); // E var c = foo("um", []); // error ~~~~ -!!! Argument of type 'string' is not assignable to parameter of type '"bye"'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"bye"'. //function bar(x: "hi", items: string[]): D; function bar(x: "bye", items: string[]): E; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function bar(x: string, items: string[]): C; function bar(x: string, items: string[]): C { return null; diff --git a/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt b/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt index 6313010ef8c..e3a8bb08628 100644 --- a/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt +++ b/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt @@ -1,12 +1,17 @@ +tests/cases/compiler/overloadingOnConstantsInImplementation.ts(1,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstantsInImplementation.ts(2,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstantsInImplementation.ts(3,1): error TS2381: A signature with an implementation cannot use a string literal type. + + ==== tests/cases/compiler/overloadingOnConstantsInImplementation.ts (3 errors) ==== function foo(a: 'hi', x: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(a: 'hi', x: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Specialized overload signature is not assignable to any non-specialized signature. +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(a: 'hi', x: any) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~ -!!! A signature with an implementation cannot use a string literal type. \ No newline at end of file +!!! error TS2381: A signature with an implementation cannot use a string literal type. \ No newline at end of file diff --git a/tests/baselines/reference/overloadingStaticFunctionsInFunctions.errors.txt b/tests/baselines/reference/overloadingStaticFunctionsInFunctions.errors.txt index 2d8832f67da..7d101598129 100644 --- a/tests/baselines/reference/overloadingStaticFunctionsInFunctions.errors.txt +++ b/tests/baselines/reference/overloadingStaticFunctionsInFunctions.errors.txt @@ -1,34 +1,50 @@ +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(1,14): error TS1005: '(' expected. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(2,3): error TS1129: Statement expected. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,3): error TS1129: Statement expected. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,19): error TS1005: ',' expected. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,3): error TS1129: Statement expected. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,20): error TS1109: Expression expected. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,25): error TS1005: ';' expected. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(2,10): error TS2304: Cannot find name 'test'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,10): error TS2304: Cannot find name 'test'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,15): error TS2304: Cannot find name 'name'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,20): error TS2304: Cannot find name 'string'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,10): error TS2304: Cannot find name 'test'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,15): error TS2304: Cannot find name 'name'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,21): error TS2304: Cannot find name 'any'. + + ==== tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts (14 errors) ==== function boo { ~ -!!! '(' expected. +!!! error TS1005: '(' expected. static test() ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. ~~~~ -!!! Cannot find name 'test'. +!!! error TS2304: Cannot find name 'test'. static test(name:string) ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. ~ -!!! ',' expected. +!!! error TS1005: ',' expected. ~~~~ -!!! Cannot find name 'test'. +!!! error TS2304: Cannot find name 'test'. ~~~~ -!!! Cannot find name 'name'. +!!! error TS2304: Cannot find name 'name'. ~~~~~~ -!!! Cannot find name 'string'. +!!! error TS2304: Cannot find name 'string'. static test(name?:any){ } ~~~~~~ -!!! Statement expected. +!!! error TS1129: Statement expected. ~ -!!! Expression expected. +!!! error TS1109: Expression expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~~~~ -!!! Cannot find name 'test'. +!!! error TS2304: Cannot find name 'test'. ~~~~ -!!! Cannot find name 'name'. +!!! error TS2304: Cannot find name 'name'. ~~~ -!!! Cannot find name 'any'. +!!! error TS2304: Cannot find name 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt index 58472a41414..e41557a2903 100644 --- a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt +++ b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt @@ -1,3 +1,11 @@ +tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,5): error TS2323: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,37): error TS2345: Argument of type 'D' is not assignable to parameter of type 'A'. +tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,27): error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. +tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,38): error TS2344: Type 'D' does not satisfy the constraint 'A'. +tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(18,27): error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. +tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12): error TS2344: Type 'D' does not satisfy the constraint 'A'. + + ==== tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts (6 errors) ==== interface A { x } interface B { x; y } @@ -14,25 +22,25 @@ var result: number = foo(x => new G(x)); // No error, returns number ~~~~~~ -!!! Type 'string' is not assignable to type 'number'. +!!! error TS2323: Type 'string' is not assignable to type 'number'. ~ -!!! Argument of type 'D' is not assignable to parameter of type 'A'. +!!! error TS2345: Argument of type 'D' is not assignable to parameter of type 'A'. var result2: number = foo(x => new G(x)); // No error, returns number ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. +!!! error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. ~~~~~~~~ -!!! Type 'D' does not satisfy the constraint 'A'. +!!! error TS2344: Type 'D' does not satisfy the constraint 'A'. var result3: string = foo(x => { // returns string because the C overload is picked ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var y: G; // error that C does not satisfy constraint ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ -!!! Type 'D' does not satisfy the constraint 'A'. +!!! error TS2344: Type 'D' does not satisfy the constraint 'A'. return y; ~~~~~~~~~~~~~ }); ~ -!!! Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. +!!! error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt b/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt index 3b9543f50cc..64faaf7e8c1 100644 --- a/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt +++ b/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt @@ -1,3 +1,8 @@ +tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,1): error TS2350: Only a void function can be called with the 'new' keyword. + + ==== tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts (3 errors) ==== declare function Callbacks(flags?: string): void; declare function Callbacks(flags?: string): void; @@ -5,9 +10,9 @@ Callbacks('s'); // wrong number of type arguments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. new Callbacks('s'); // wrong number of type arguments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Supplied parameters do not match any signature of call target. +!!! error TS2346: Supplied parameters do not match any signature of call target. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Only a void function can be called with the 'new' keyword. \ No newline at end of file +!!! error TS2350: Only a void function can be called with the 'new' keyword. \ No newline at end of file diff --git a/tests/baselines/reference/overloadsInDifferentContainersDisagreeOnAmbient.errors.txt b/tests/baselines/reference/overloadsInDifferentContainersDisagreeOnAmbient.errors.txt index 06bd4d0f62d..20da9c71371 100644 --- a/tests/baselines/reference/overloadsInDifferentContainersDisagreeOnAmbient.errors.txt +++ b/tests/baselines/reference/overloadsInDifferentContainersDisagreeOnAmbient.errors.txt @@ -1,3 +1,6 @@ +tests/cases/compiler/overloadsInDifferentContainersDisagreeOnAmbient.ts(7,21): error TS2384: Overload signatures must all be ambient or non-ambient. + + ==== tests/cases/compiler/overloadsInDifferentContainersDisagreeOnAmbient.ts (1 errors) ==== declare module M { // Error because body is not ambient and this overload is @@ -7,5 +10,5 @@ module M { export function f() { } ~ -!!! Overload signatures must all be ambient or non-ambient. +!!! error TS2384: Overload signatures must all be ambient or non-ambient. } \ No newline at end of file diff --git a/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt b/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt index 2e44fc1df69..bd918de55fe 100644 --- a/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt +++ b/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt @@ -1,3 +1,9 @@ +tests/cases/compiler/overloadsWithProvisionalErrors.ts(6,6): error TS2345: Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. +tests/cases/compiler/overloadsWithProvisionalErrors.ts(7,17): error TS2304: Cannot find name 'blah'. +tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,6): error TS2345: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. +tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cannot find name 'blah'. + + ==== tests/cases/compiler/overloadsWithProvisionalErrors.ts (4 errors) ==== var func: { (s: string): number; @@ -6,12 +12,12 @@ func(s => ({})); // Error for no applicable overload (object type is missing a and b) ~~~~~~~~~ -!!! Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. +!!! error TS2345: Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. func(s => ({ a: blah, b: 3 })); // Only error inside the function, but not outside (since it would be applicable if not for the provisional error) ~~~~ -!!! Cannot find name 'blah'. +!!! error TS2304: Cannot find name 'blah'. func(s => ({ a: blah })); // Two errors here, one for blah not being defined, and one for the overload since it would not be applicable anyway ~~~~~~~~~~~~~~~~~~ -!!! Argument of type '(s: string) => { a: unknown; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. +!!! error TS2345: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. ~~~~ -!!! Cannot find name 'blah'. \ No newline at end of file +!!! error TS2304: Cannot find name 'blah'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadsWithinClasses.errors.txt b/tests/baselines/reference/overloadsWithinClasses.errors.txt index c67bba61626..02872861a4b 100644 --- a/tests/baselines/reference/overloadsWithinClasses.errors.txt +++ b/tests/baselines/reference/overloadsWithinClasses.errors.txt @@ -1,11 +1,17 @@ -==== tests/cases/compiler/overloadsWithinClasses.ts (1 errors) ==== +tests/cases/compiler/overloadsWithinClasses.ts(3,12): error TS2393: Duplicate function implementation. +tests/cases/compiler/overloadsWithinClasses.ts(5,12): error TS2393: Duplicate function implementation. + + +==== tests/cases/compiler/overloadsWithinClasses.ts (2 errors) ==== class foo { static fnOverload( ) {} + ~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. static fnOverload(foo: string){ } // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Duplicate function implementation. + ~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. } diff --git a/tests/baselines/reference/overridingPrivateStaticMembers.errors.txt b/tests/baselines/reference/overridingPrivateStaticMembers.errors.txt index 0e7200d122d..6d51014f005 100644 --- a/tests/baselines/reference/overridingPrivateStaticMembers.errors.txt +++ b/tests/baselines/reference/overridingPrivateStaticMembers.errors.txt @@ -1,3 +1,7 @@ +tests/cases/compiler/overridingPrivateStaticMembers.ts(5,7): error TS2418: Class static side 'typeof Derived2' incorrectly extends base class static side 'typeof Base2': + Types have separate declarations of a private property 'y'. + + ==== tests/cases/compiler/overridingPrivateStaticMembers.ts (1 errors) ==== class Base2 { private static y: { foo: string }; @@ -5,7 +9,7 @@ class Derived2 extends Base2 { ~~~~~~~~ -!!! Class static side 'typeof Derived2' incorrectly extends base class static side 'typeof Base2': -!!! Private property 'y' cannot be reimplemented. +!!! error TS2418: Class static side 'typeof Derived2' incorrectly extends base class static side 'typeof Base2': +!!! error TS2418: Types have separate declarations of a private property 'y'. private static y: { foo: string; bar: string; }; } \ No newline at end of file diff --git a/tests/baselines/reference/paramPropertiesInSignatures.errors.txt b/tests/baselines/reference/paramPropertiesInSignatures.errors.txt index 46ac90581e9..89d2ea67bc3 100644 --- a/tests/baselines/reference/paramPropertiesInSignatures.errors.txt +++ b/tests/baselines/reference/paramPropertiesInSignatures.errors.txt @@ -1,22 +1,29 @@ +tests/cases/compiler/paramPropertiesInSignatures.ts(2,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/paramPropertiesInSignatures.ts(3,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/paramPropertiesInSignatures.ts(8,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/paramPropertiesInSignatures.ts(9,14): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/paramPropertiesInSignatures.ts(10,14): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/paramPropertiesInSignatures.ts (5 errors) ==== class C1 { constructor(public p1:string); // ERROR ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. constructor(private p2:number); // ERROR ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. constructor(public p3:any) {} // OK } declare class C2 { constructor(public p1:string); // ERROR ~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. constructor(private p2:number); // ERROR ~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. constructor(public p3:any); // ERROR ~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/parameterPropertyInConstructor1.errors.txt b/tests/baselines/reference/parameterPropertyInConstructor1.errors.txt index 2394b91104e..c191073277f 100644 --- a/tests/baselines/reference/parameterPropertyInConstructor1.errors.txt +++ b/tests/baselines/reference/parameterPropertyInConstructor1.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/parameterPropertyInConstructor1.ts(3,17): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/parameterPropertyInConstructor1.ts (1 errors) ==== declare module mod { class Customers { constructor(public names: string); ~~~~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } } \ No newline at end of file diff --git a/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt b/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt index deb9806812b..5885385a20c 100644 --- a/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt +++ b/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt @@ -1,14 +1,22 @@ -==== tests/cases/compiler/parameterPropertyInConstructor2.ts (3 errors) ==== +tests/cases/compiler/parameterPropertyInConstructor2.ts(3,5): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/parameterPropertyInConstructor2.ts(3,17): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/parameterPropertyInConstructor2.ts(3,24): error TS2300: Duplicate identifier 'names'. +tests/cases/compiler/parameterPropertyInConstructor2.ts(4,24): error TS2300: Duplicate identifier 'names'. + + +==== tests/cases/compiler/parameterPropertyInConstructor2.ts (4 errors) ==== module mod { class Customers { constructor(public names: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Overload signature is not compatible with function implementation. +!!! error TS2394: Overload signature is not compatible with function implementation. ~~~~~~~~~~~~~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~~~~~ +!!! error TS2300: Duplicate identifier 'names'. constructor(public names: string, public ages: number) { ~~~~~ -!!! Duplicate identifier 'names'. +!!! error TS2300: Duplicate identifier 'names'. } } } diff --git a/tests/baselines/reference/parameterPropertyOutsideConstructor.errors.txt b/tests/baselines/reference/parameterPropertyOutsideConstructor.errors.txt index 316a71a37b9..1073cf9164d 100644 --- a/tests/baselines/reference/parameterPropertyOutsideConstructor.errors.txt +++ b/tests/baselines/reference/parameterPropertyOutsideConstructor.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/parameterPropertyOutsideConstructor.ts(2,9): error TS2369: A parameter property is only allowed in a constructor implementation. + + ==== tests/cases/compiler/parameterPropertyOutsideConstructor.ts (1 errors) ==== class C { foo(public x) { ~~~~~~~~ -!!! A parameter property is only allowed in a constructor implementation. +!!! error TS2369: A parameter property is only allowed in a constructor implementation. } } \ No newline at end of file diff --git a/tests/baselines/reference/parse1.errors.txt b/tests/baselines/reference/parse1.errors.txt index b2c9a06efe6..03c35f18633 100644 --- a/tests/baselines/reference/parse1.errors.txt +++ b/tests/baselines/reference/parse1.errors.txt @@ -1,8 +1,11 @@ +tests/cases/compiler/parse1.ts(4,1): error TS1003: Identifier expected. + + ==== tests/cases/compiler/parse1.ts (1 errors) ==== var bar = 42; function foo() { bar. } ~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/parse2.errors.txt b/tests/baselines/reference/parse2.errors.txt index f7d424001ca..cef03437430 100644 --- a/tests/baselines/reference/parse2.errors.txt +++ b/tests/baselines/reference/parse2.errors.txt @@ -1,6 +1,9 @@ +tests/cases/compiler/parse2.ts(3,1): error TS1135: Argument expression expected. + + ==== tests/cases/compiler/parse2.ts (1 errors) ==== function foo() { foo( } ~ -!!! Argument expression expected. \ No newline at end of file +!!! error TS1135: Argument expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/parseTypes.errors.txt b/tests/baselines/reference/parseTypes.errors.txt index 49b9218320c..96d004c5b01 100644 --- a/tests/baselines/reference/parseTypes.errors.txt +++ b/tests/baselines/reference/parseTypes.errors.txt @@ -1,3 +1,10 @@ +tests/cases/compiler/parseTypes.ts(9,1): error TS2323: Type '(s: string) => void' is not assignable to type '() => number'. +tests/cases/compiler/parseTypes.ts(10,1): error TS2323: Type '(s: string) => void' is not assignable to type '() => number'. +tests/cases/compiler/parseTypes.ts(11,1): error TS2322: Type '(s: string) => void' is not assignable to type '{ [x: number]: number; }': + Index signature is missing in type '(s: string) => void'. +tests/cases/compiler/parseTypes.ts(12,1): error TS2323: Type '(s: string) => void' is not assignable to type 'new () => number'. + + ==== tests/cases/compiler/parseTypes.ts (4 errors) ==== var x = <() => number>null; @@ -9,15 +16,15 @@ y=f; y=g; ~ -!!! Type '(s: string) => void' is not assignable to type '() => number'. +!!! error TS2323: Type '(s: string) => void' is not assignable to type '() => number'. x=g; ~ -!!! Type '(s: string) => void' is not assignable to type '() => number'. +!!! error TS2323: Type '(s: string) => void' is not assignable to type '() => number'. w=g; ~ -!!! Type '(s: string) => void' is not assignable to type '{ [x: number]: number; }': -!!! Index signature is missing in type '(s: string) => void'. +!!! error TS2322: Type '(s: string) => void' is not assignable to type '{ [x: number]: number; }': +!!! error TS2322: Index signature is missing in type '(s: string) => void'. z=g; ~ -!!! Type '(s: string) => void' is not assignable to type 'new () => number'. +!!! error TS2323: Type '(s: string) => void' is not assignable to type 'new () => number'. \ No newline at end of file diff --git a/tests/baselines/reference/parser0_004152.errors.txt b/tests/baselines/reference/parser0_004152.errors.txt index 551d6aab5c2..cfd6161a48e 100644 --- a/tests/baselines/reference/parser0_004152.errors.txt +++ b/tests/baselines/reference/parser0_004152.errors.txt @@ -1,73 +1,115 @@ -==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (34 errors) ==== +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(1,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,45): error TS1137: Expression or comma expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,46): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,49): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,52): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,55): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,58): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,61): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,64): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,67): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,70): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,73): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,76): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,79): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,82): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,85): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,86): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,94): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,97): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,98): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,28): error TS2304: Cannot find name 'DisplayPosition'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,48): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,51): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,54): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,57): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,60): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,63): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,66): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,69): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,72): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,75): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,78): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,81): error TS2300: Duplicate identifier '3'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,84): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,96): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error TS2304: Cannot find name 'SeedCoords'. + + +==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (36 errors) ==== export class Game { ~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0); ~ -!!! Expression or comma expected. +!!! error TS1137: Expression or comma expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! ';' expected. +!!! error TS1005: ';' expected. ~ -!!! Unexpected token. A constructor, method, accessor, or property was expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. ~~~~~~~~~~~~~~~ -!!! Cannot find name 'DisplayPosition'. +!!! error TS2304: Cannot find name 'DisplayPosition'. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ -!!! Duplicate identifier '3'. +!!! error TS2300: Duplicate identifier '3'. ~ -!!! Duplicate identifier '3'. +!!! error TS2300: Duplicate identifier '3'. ~ -!!! Duplicate identifier '3'. +!!! error TS2300: Duplicate identifier '3'. ~ -!!! Duplicate identifier '3'. +!!! error TS2300: Duplicate identifier '3'. + ~ +!!! error TS2300: Duplicate identifier '0'. ~ -!!! Duplicate identifier '3'. +!!! error TS2300: Duplicate identifier '3'. ~ -!!! Duplicate identifier '3'. +!!! error TS2300: Duplicate identifier '3'. ~ -!!! Duplicate identifier '3'. +!!! error TS2300: Duplicate identifier '3'. ~ -!!! Duplicate identifier '3'. +!!! error TS2300: Duplicate identifier '3'. ~ -!!! Duplicate identifier '3'. +!!! error TS2300: Duplicate identifier '3'. ~ -!!! Duplicate identifier '3'. +!!! error TS2300: Duplicate identifier '3'. ~ -!!! Duplicate identifier '0'. +!!! error TS2300: Duplicate identifier '0'. ~ -!!! Duplicate identifier '0'. +!!! error TS2300: Duplicate identifier '0'. private prevConfig: SeedCoords[][]; ~~~~~~~~~~ -!!! Cannot find name 'SeedCoords'. +!!! error TS2304: Cannot find name 'SeedCoords'. } \ No newline at end of file diff --git a/tests/baselines/reference/parser10.1.1-8gs.errors.txt b/tests/baselines/reference/parser10.1.1-8gs.errors.txt index 4ed4b8b2635..459ad40ab72 100644 --- a/tests/baselines/reference/parser10.1.1-8gs.errors.txt +++ b/tests/baselines/reference/parser10.1.1-8gs.errors.txt @@ -1,3 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(17,5): error TS1134: Variable declaration expected. +tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(17,12): error TS1134: Variable declaration expected. +tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(17,14): error TS1134: Variable declaration expected. +tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(16,7): error TS2304: Cannot find name 'NotEarlyError'. + + ==== tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts (4 errors) ==== /// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set @@ -16,12 +22,12 @@ "use strict"; throw NotEarlyError; ~~~~~~~~~~~~~ -!!! Cannot find name 'NotEarlyError'. +!!! error TS2304: Cannot find name 'NotEarlyError'. var public = 1; ~~~~~~ -!!! Variable declaration expected. +!!! error TS1134: Variable declaration expected. ~ -!!! Variable declaration expected. +!!! error TS1134: Variable declaration expected. ~ -!!! Variable declaration expected. +!!! error TS1134: Variable declaration expected. \ No newline at end of file diff --git a/tests/baselines/reference/parser15.4.4.14-9-2.errors.txt b/tests/baselines/reference/parser15.4.4.14-9-2.errors.txt index 694dc1ac57a..237541b40f7 100644 --- a/tests/baselines/reference/parser15.4.4.14-9-2.errors.txt +++ b/tests/baselines/reference/parser15.4.4.14-9-2.errors.txt @@ -1,4 +1,8 @@ -==== tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts (1 errors) ==== +tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(16,11): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(25,1): error TS2304: Cannot find name 'runTestCase'. + + +==== tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts (2 errors) ==== /// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the @@ -15,6 +19,8 @@ var one = 1; var _float = -(4/3); var a = new Array(false,undefined,null,"0",obj,-1.3333333333333, "str",-0,true,+0, one, 1,0, false, _float, -(4/3)); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. if (a.indexOf(-(4/3)) === 14 && // a[14]=_float===-(4/3) a.indexOf(0) === 7 && // a[7] = +0, 0===+0 a.indexOf(-0) === 7 && // a[7] = +0, -0===+0 @@ -25,5 +31,5 @@ } runTestCase(testcase); ~~~~~~~~~~~ -!!! Cannot find name 'runTestCase'. +!!! error TS2304: Cannot find name 'runTestCase'. \ No newline at end of file diff --git a/tests/baselines/reference/parser509534.errors.txt b/tests/baselines/reference/parser509534.errors.txt index e40d485cb60..78d56d1413e 100644 --- a/tests/baselines/reference/parser509534.errors.txt +++ b/tests/baselines/reference/parser509534.errors.txt @@ -1,11 +1,15 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509534.ts(2,14): error TS2304: Cannot find name 'require'. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509534.ts(3,1): error TS2304: Cannot find name 'module'. + + ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509534.ts (2 errors) ==== "use strict"; var config = require("../config"); ~~~~~~~ -!!! Cannot find name 'require'. +!!! error TS2304: Cannot find name 'require'. module.exports.route = function (server) { ~~~~~~ -!!! Cannot find name 'module'. +!!! error TS2304: Cannot find name 'module'. // General Login Page server.get(config.env.siteRoot + "/auth/login", function (req, res, next) { diff --git a/tests/baselines/reference/parser509546.errors.txt b/tests/baselines/reference/parser509546.errors.txt index e3e361e6c69..ad8bf69dc12 100644 --- a/tests/baselines/reference/parser509546.errors.txt +++ b/tests/baselines/reference/parser509546.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts(1,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts (1 errors) ==== export class Logger { ~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. public } \ No newline at end of file diff --git a/tests/baselines/reference/parser509546_1.errors.txt b/tests/baselines/reference/parser509546_1.errors.txt index 3bc50baa001..2620036c5b6 100644 --- a/tests/baselines/reference/parser509546_1.errors.txt +++ b/tests/baselines/reference/parser509546_1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts(1,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts (1 errors) ==== export class Logger { ~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. public } \ No newline at end of file diff --git a/tests/baselines/reference/parser509546_2.errors.txt b/tests/baselines/reference/parser509546_2.errors.txt index 08b4b95260d..f945ccaac00 100644 --- a/tests/baselines/reference/parser509546_2.errors.txt +++ b/tests/baselines/reference/parser509546_2.errors.txt @@ -1,9 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts(3,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided. + + ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts (1 errors) ==== "use strict"; export class Logger { ~~~~~~ -!!! Cannot compile external modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. public } \ No newline at end of file diff --git a/tests/baselines/reference/parser509618.errors.txt b/tests/baselines/reference/parser509618.errors.txt index 84ea778e0ca..fdc66573617 100644 --- a/tests/baselines/reference/parser509618.errors.txt +++ b/tests/baselines/reference/parser509618.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509618.ts(2,20): error TS1036: Statements are not allowed in ambient contexts. + + ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509618.ts (1 errors) ==== declare module ambiModule { interface i1 { }; ~ -!!! Statements are not allowed in ambient contexts. +!!! error TS1036: Statements are not allowed in ambient contexts. } \ No newline at end of file diff --git a/tests/baselines/reference/parser509630.errors.txt b/tests/baselines/reference/parser509630.errors.txt index 72be30146de..29e79f6522a 100644 --- a/tests/baselines/reference/parser509630.errors.txt +++ b/tests/baselines/reference/parser509630.errors.txt @@ -1,9 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509630.ts(3,1): error TS1137: Expression or comma expected. + + ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509630.ts (1 errors) ==== class Type { public examples = [ // typing here } ~ -!!! Expression or comma expected. +!!! error TS1137: Expression or comma expected. class Any extends Type { } \ No newline at end of file diff --git a/tests/baselines/reference/parser509667.errors.txt b/tests/baselines/reference/parser509667.errors.txt index 684616da419..86dd7178b0f 100644 --- a/tests/baselines/reference/parser509667.errors.txt +++ b/tests/baselines/reference/parser509667.errors.txt @@ -1,10 +1,13 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509667.ts(4,4): error TS1003: Identifier expected. + + ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509667.ts (1 errors) ==== class Foo { f1() { if (this. } ~ -!!! Identifier expected. +!!! error TS1003: Identifier expected. f2() { } diff --git a/tests/baselines/reference/parser509668.errors.txt b/tests/baselines/reference/parser509668.errors.txt index 36dc0523dd2..5ea380592ef 100644 --- a/tests/baselines/reference/parser509668.errors.txt +++ b/tests/baselines/reference/parser509668.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts(3,23): error TS1005: ',' expected. + + ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts (1 errors) ==== class Foo3 { // Doesn't work, but should constructor (public ...args: string[]) { } ~~~ -!!! ',' expected. +!!! error TS1005: ',' expected. } \ No newline at end of file diff --git a/tests/baselines/reference/parser509669.errors.txt b/tests/baselines/reference/parser509669.errors.txt index 05ce0f609e3..b943c20fcef 100644 --- a/tests/baselines/reference/parser509669.errors.txt +++ b/tests/baselines/reference/parser509669.errors.txt @@ -1,6 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509669.ts(2,17): error TS1005: '=>' expected. + + ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509669.ts (1 errors) ==== function foo():any { return ():void {}; ~ -!!! '=>' expected. +!!! error TS1005: '=>' expected. } \ No newline at end of file diff --git a/tests/baselines/reference/parser509693.errors.txt b/tests/baselines/reference/parser509693.errors.txt index dd1aa4b120f..b910af1c2e6 100644 --- a/tests/baselines/reference/parser509693.errors.txt +++ b/tests/baselines/reference/parser509693.errors.txt @@ -1,6 +1,10 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509693.ts(1,6): error TS2304: Cannot find name 'module'. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509693.ts(1,22): error TS2304: Cannot find name 'module'. + + ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509693.ts (2 errors) ==== if (!module.exports) module.exports = ""; ~~~~~~ -!!! Cannot find name 'module'. +!!! error TS2304: Cannot find name 'module'. ~~~~~~ -!!! Cannot find name 'module'. \ No newline at end of file +!!! error TS2304: Cannot find name 'module'. \ No newline at end of file diff --git a/tests/baselines/reference/parser509698.errors.txt b/tests/baselines/reference/parser509698.errors.txt index 8a8b23d44e4..2aaaec18dc2 100644 --- a/tests/baselines/reference/parser509698.errors.txt +++ b/tests/baselines/reference/parser509698.errors.txt @@ -1,11 +1,21 @@ -!!! Cannot find global type 'Array'. -!!! Cannot find global type 'Boolean'. -!!! Cannot find global type 'Function'. -!!! Cannot find global type 'IArguments'. -!!! Cannot find global type 'Number'. -!!! Cannot find global type 'Object'. -!!! Cannot find global type 'RegExp'. -!!! Cannot find global type 'String'. +error TS2318: Cannot find global type 'Array'. +error TS2318: Cannot find global type 'Boolean'. +error TS2318: Cannot find global type 'Function'. +error TS2318: Cannot find global type 'IArguments'. +error TS2318: Cannot find global type 'Number'. +error TS2318: Cannot find global type 'Object'. +error TS2318: Cannot find global type 'RegExp'. +error TS2318: Cannot find global type 'String'. + + +!!! error TS2318: Cannot find global type 'Array'. +!!! error TS2318: Cannot find global type 'Boolean'. +!!! error TS2318: Cannot find global type 'Function'. +!!! error TS2318: Cannot find global type 'IArguments'. +!!! error TS2318: Cannot find global type 'Number'. +!!! error TS2318: Cannot find global type 'Object'. +!!! error TS2318: Cannot find global type 'RegExp'. +!!! error TS2318: Cannot find global type 'String'. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509698.ts (0 errors) ==== ///